projen 0.51.7 → 0.51.8

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 (385) hide show
  1. package/.jsii +42 -6
  2. package/API.md +10 -0
  3. package/changelog.md +1 -6
  4. package/lib/awscdk/auto-discover.js +1 -1
  5. package/lib/awscdk/awscdk-app-java.js +1 -1
  6. package/lib/awscdk/awscdk-app-ts.js +1 -1
  7. package/lib/awscdk/awscdk-construct.js +2 -2
  8. package/lib/awscdk/awscdk-deps-java.js +1 -1
  9. package/lib/awscdk/awscdk-deps-js.js +1 -1
  10. package/lib/awscdk/awscdk-deps.js +1 -1
  11. package/lib/awscdk/cdk-config.js +1 -1
  12. package/lib/awscdk/cdk-tasks.js +1 -1
  13. package/lib/awscdk/integration-test.js +1 -1
  14. package/lib/awscdk/lambda-function.js +2 -2
  15. package/lib/build/build-workflow.js +1 -1
  16. package/lib/cdk/construct-lib.js +1 -1
  17. package/lib/cdk/jsii-docgen.js +1 -1
  18. package/lib/cdk/jsii-project.js +1 -1
  19. package/lib/cdk8s/cdk8s-app-ts.js +1 -1
  20. package/lib/cdk8s/cdk8s-construct.js +1 -1
  21. package/lib/cdktf/cdktf-construct.js +1 -1
  22. package/lib/component.js +1 -1
  23. package/lib/dependencies.js +1 -1
  24. package/lib/dev-env.js +1 -1
  25. package/lib/docker-compose.js +2 -2
  26. package/lib/file.js +1 -1
  27. package/lib/gitattributes.js +1 -1
  28. package/lib/github/auto-approve.js +1 -1
  29. package/lib/github/auto-merge.js +1 -1
  30. package/lib/github/dependabot.js +1 -1
  31. package/lib/github/github-project.js +1 -1
  32. package/lib/github/github.js +1 -1
  33. package/lib/github/mergify.js +1 -1
  34. package/lib/github/pr-template.js +1 -1
  35. package/lib/github/pull-request-lint.js +1 -1
  36. package/lib/github/stale.js +1 -1
  37. package/lib/github/task-workflow.js +1 -1
  38. package/lib/github/workflows.js +1 -1
  39. package/lib/gitlab/configuration.js +1 -1
  40. package/lib/gitlab/gitlab-configuration.js +1 -1
  41. package/lib/gitlab/nested-configuration.js +1 -1
  42. package/lib/gitpod.js +1 -1
  43. package/lib/ignore-file.js +1 -1
  44. package/lib/ini.js +1 -1
  45. package/lib/java/java-project.js +1 -1
  46. package/lib/java/junit.js +1 -1
  47. package/lib/java/maven-compile.js +1 -1
  48. package/lib/java/maven-packaging.js +1 -1
  49. package/lib/java/maven-sample.js +1 -1
  50. package/lib/java/pom.js +1 -1
  51. package/lib/java/projenrc.js +1 -1
  52. package/lib/javascript/bundler.js +1 -1
  53. package/lib/javascript/eslint.js +1 -1
  54. package/lib/javascript/jest.js +1 -1
  55. package/lib/javascript/node-package.js +1 -1
  56. package/lib/javascript/node-project.js +1 -1
  57. package/lib/javascript/npm-config.js +1 -1
  58. package/lib/javascript/prettier.js +1 -1
  59. package/lib/javascript/projenrc.js +1 -1
  60. package/lib/javascript/typescript-config.js +1 -1
  61. package/lib/javascript/upgrade-dependencies.js +2 -2
  62. package/lib/json.js +1 -1
  63. package/lib/license.js +1 -1
  64. package/lib/logger.js +1 -1
  65. package/lib/makefile.js +1 -1
  66. package/lib/object-file.js +1 -1
  67. package/lib/project-build.js +1 -1
  68. package/lib/project.js +1 -1
  69. package/lib/projects.js +1 -1
  70. package/lib/projenrc-json.js +1 -1
  71. package/lib/python/pip.js +1 -1
  72. package/lib/python/poetry.js +2 -2
  73. package/lib/python/projenrc.js +1 -1
  74. package/lib/python/pytest.js +1 -1
  75. package/lib/python/python-project.js +1 -1
  76. package/lib/python/python-sample.js +1 -1
  77. package/lib/python/requirements-file.js +1 -1
  78. package/lib/python/setuppy.js +1 -1
  79. package/lib/python/setuptools.js +1 -1
  80. package/lib/python/venv.js +1 -1
  81. package/lib/readme.js +1 -1
  82. package/lib/release/publisher.js +1 -1
  83. package/lib/release/release-trigger.js +1 -1
  84. package/lib/release/release.js +1 -1
  85. package/lib/sample-file.js +2 -2
  86. package/lib/semver.js +1 -1
  87. package/lib/source-code.js +1 -1
  88. package/lib/task-runtime.js +1 -1
  89. package/lib/task.js +1 -1
  90. package/lib/tasks.js +1 -1
  91. package/lib/testing.js +1 -1
  92. package/lib/textfile.js +1 -1
  93. package/lib/toml.js +1 -1
  94. package/lib/typescript/projenrc.js +1 -1
  95. package/lib/typescript/typescript-typedoc.js +1 -1
  96. package/lib/typescript/typescript.js +3 -3
  97. package/lib/version.js +1 -1
  98. package/lib/vscode/devcontainer.js +1 -1
  99. package/lib/vscode/launch-config.js +1 -1
  100. package/lib/vscode/vscode.js +1 -1
  101. package/lib/web/next.js +3 -3
  102. package/lib/web/postcss.js +1 -1
  103. package/lib/web/react.js +4 -4
  104. package/lib/web/tailwind.js +1 -1
  105. package/lib/xmlfile.js +1 -1
  106. package/lib/yaml.d.ts +13 -0
  107. package/lib/yaml.js +8 -3
  108. package/node_modules/yaml/LICENSE +1 -1
  109. package/node_modules/yaml/README.md +57 -41
  110. package/node_modules/yaml/browser/dist/compose/compose-collection.js +59 -0
  111. package/node_modules/yaml/browser/dist/compose/compose-doc.js +40 -0
  112. package/node_modules/yaml/browser/dist/compose/compose-node.js +81 -0
  113. package/node_modules/yaml/browser/dist/compose/compose-scalar.js +81 -0
  114. package/node_modules/yaml/browser/dist/compose/composer.js +219 -0
  115. package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +107 -0
  116. package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +185 -0
  117. package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +45 -0
  118. package/node_modules/yaml/browser/dist/compose/resolve-end.js +37 -0
  119. package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +200 -0
  120. package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +223 -0
  121. package/node_modules/yaml/browser/dist/compose/resolve-props.js +128 -0
  122. package/node_modules/yaml/browser/dist/compose/util-contains-newline.js +34 -0
  123. package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +27 -0
  124. package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +15 -0
  125. package/node_modules/yaml/browser/dist/compose/util-map-includes.js +17 -0
  126. package/node_modules/yaml/browser/dist/doc/Document.js +321 -0
  127. package/node_modules/yaml/browser/dist/doc/anchors.js +72 -0
  128. package/node_modules/yaml/browser/dist/doc/applyReviver.js +54 -0
  129. package/node_modules/yaml/browser/dist/doc/createNode.js +84 -0
  130. package/node_modules/yaml/browser/dist/doc/directives.js +166 -0
  131. package/node_modules/yaml/browser/dist/errors.js +57 -0
  132. package/node_modules/yaml/browser/dist/index.js +18 -1002
  133. package/node_modules/yaml/browser/dist/log.js +14 -0
  134. package/node_modules/yaml/browser/dist/node_modules/tslib/tslib.es6.js +164 -0
  135. package/node_modules/yaml/browser/dist/nodes/Alias.js +94 -0
  136. package/node_modules/yaml/browser/dist/nodes/Collection.js +146 -0
  137. package/node_modules/yaml/browser/dist/nodes/Node.js +48 -0
  138. package/node_modules/yaml/browser/dist/nodes/Pair.js +36 -0
  139. package/node_modules/yaml/browser/dist/nodes/Scalar.js +23 -0
  140. package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +116 -0
  141. package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +105 -0
  142. package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +104 -0
  143. package/node_modules/yaml/browser/dist/nodes/toJS.js +35 -0
  144. package/node_modules/yaml/browser/dist/options.js +18 -0
  145. package/node_modules/yaml/browser/dist/parse/cst-scalar.js +215 -0
  146. package/node_modules/yaml/browser/dist/parse/cst-stringify.js +61 -0
  147. package/node_modules/yaml/browser/dist/parse/cst-visit.js +97 -0
  148. package/node_modules/yaml/browser/dist/parse/cst.js +98 -0
  149. package/node_modules/yaml/browser/dist/parse/lexer.js +692 -0
  150. package/node_modules/yaml/browser/dist/parse/line-counter.js +39 -0
  151. package/node_modules/yaml/browser/dist/parse/parser.js +882 -0
  152. package/node_modules/yaml/browser/dist/public-api.js +99 -0
  153. package/node_modules/yaml/browser/dist/schema/Schema.js +34 -0
  154. package/node_modules/yaml/browser/dist/schema/common/map.js +42 -0
  155. package/node_modules/yaml/browser/dist/schema/common/null.js +13 -0
  156. package/node_modules/yaml/browser/dist/schema/common/seq.js +33 -0
  157. package/node_modules/yaml/browser/dist/schema/common/string.js +14 -0
  158. package/node_modules/yaml/browser/dist/schema/core/bool.js +19 -0
  159. package/node_modules/yaml/browser/dist/schema/core/float.js +43 -0
  160. package/node_modules/yaml/browser/dist/schema/core/int.js +38 -0
  161. package/node_modules/yaml/browser/dist/schema/core/schema.js +23 -0
  162. package/node_modules/yaml/browser/dist/schema/json/schema.js +62 -0
  163. package/node_modules/yaml/browser/dist/schema/tags.js +83 -0
  164. package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +66 -0
  165. package/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +26 -0
  166. package/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +46 -0
  167. package/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +71 -0
  168. package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +73 -0
  169. package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +77 -0
  170. package/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +37 -0
  171. package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +87 -0
  172. package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +101 -0
  173. package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +135 -0
  174. package/node_modules/yaml/browser/dist/stringify/stringify.js +124 -0
  175. package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +152 -0
  176. package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +18 -0
  177. package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +68 -0
  178. package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +24 -0
  179. package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +122 -0
  180. package/node_modules/yaml/browser/dist/stringify/stringifyString.js +314 -0
  181. package/node_modules/yaml/browser/dist/util.js +9 -2
  182. package/node_modules/yaml/browser/dist/visit.js +146 -0
  183. package/node_modules/yaml/browser/index.js +5 -1
  184. package/node_modules/yaml/browser/package.json +3 -0
  185. package/node_modules/yaml/dist/compose/compose-collection.d.ts +5 -0
  186. package/node_modules/yaml/dist/compose/compose-collection.js +61 -0
  187. package/node_modules/yaml/dist/compose/compose-doc.d.ts +6 -0
  188. package/node_modules/yaml/dist/compose/compose-doc.js +42 -0
  189. package/node_modules/yaml/dist/compose/compose-node.d.ts +26 -0
  190. package/node_modules/yaml/dist/compose/compose-node.js +84 -0
  191. package/node_modules/yaml/dist/compose/compose-scalar.d.ts +5 -0
  192. package/node_modules/yaml/dist/compose/compose-scalar.js +83 -0
  193. package/node_modules/yaml/dist/compose/composer.d.ts +62 -0
  194. package/node_modules/yaml/dist/compose/composer.js +223 -0
  195. package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +6 -0
  196. package/node_modules/yaml/dist/compose/resolve-block-map.js +109 -0
  197. package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +10 -0
  198. package/node_modules/yaml/dist/compose/resolve-block-scalar.js +187 -0
  199. package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +5 -0
  200. package/node_modules/yaml/dist/compose/resolve-block-seq.js +47 -0
  201. package/node_modules/yaml/dist/compose/resolve-end.d.ts +6 -0
  202. package/node_modules/yaml/dist/compose/resolve-end.js +39 -0
  203. package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +6 -0
  204. package/node_modules/yaml/dist/compose/resolve-flow-collection.js +202 -0
  205. package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +10 -0
  206. package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +225 -0
  207. package/node_modules/yaml/dist/compose/resolve-props.d.ts +21 -0
  208. package/node_modules/yaml/dist/compose/resolve-props.js +130 -0
  209. package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +2 -0
  210. package/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
  211. package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +2 -0
  212. package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +29 -0
  213. package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +3 -0
  214. package/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
  215. package/node_modules/yaml/dist/compose/util-map-includes.d.ts +4 -0
  216. package/node_modules/yaml/dist/compose/util-map-includes.js +19 -0
  217. package/node_modules/yaml/dist/doc/Document.d.ts +139 -0
  218. package/node_modules/yaml/dist/doc/Document.js +323 -0
  219. package/node_modules/yaml/dist/doc/anchors.d.ts +24 -0
  220. package/node_modules/yaml/dist/doc/anchors.js +77 -0
  221. package/node_modules/yaml/dist/doc/applyReviver.d.ts +9 -0
  222. package/node_modules/yaml/dist/doc/applyReviver.js +56 -0
  223. package/node_modules/yaml/dist/doc/createNode.d.ts +17 -0
  224. package/node_modules/yaml/dist/doc/createNode.js +86 -0
  225. package/node_modules/yaml/dist/doc/directives.d.ts +47 -0
  226. package/node_modules/yaml/dist/doc/directives.js +168 -0
  227. package/node_modules/yaml/dist/errors.d.ts +21 -0
  228. package/node_modules/yaml/dist/errors.js +62 -0
  229. package/node_modules/yaml/dist/index.d.ts +19 -0
  230. package/node_modules/yaml/dist/index.js +49 -77
  231. package/node_modules/yaml/dist/log.d.ts +3 -0
  232. package/node_modules/yaml/dist/log.js +17 -0
  233. package/node_modules/yaml/dist/node_modules/tslib/tslib.es6.js +76 -0
  234. package/node_modules/yaml/dist/nodes/Alias.d.ts +28 -0
  235. package/node_modules/yaml/dist/nodes/Alias.js +96 -0
  236. package/node_modules/yaml/dist/nodes/Collection.d.ts +73 -0
  237. package/node_modules/yaml/dist/nodes/Collection.js +150 -0
  238. package/node_modules/yaml/dist/nodes/Node.d.ts +53 -0
  239. package/node_modules/yaml/dist/nodes/Node.js +66 -0
  240. package/node_modules/yaml/dist/nodes/Pair.d.ts +21 -0
  241. package/node_modules/yaml/dist/nodes/Pair.js +39 -0
  242. package/node_modules/yaml/dist/nodes/Scalar.d.ts +42 -0
  243. package/node_modules/yaml/dist/nodes/Scalar.js +26 -0
  244. package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +41 -0
  245. package/node_modules/yaml/dist/nodes/YAMLMap.js +119 -0
  246. package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +55 -0
  247. package/node_modules/yaml/dist/nodes/YAMLSeq.js +107 -0
  248. package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +3 -0
  249. package/node_modules/yaml/dist/nodes/addPairToJSMap.js +106 -0
  250. package/node_modules/yaml/dist/nodes/toJS.d.ts +30 -0
  251. package/node_modules/yaml/dist/nodes/toJS.js +37 -0
  252. package/node_modules/yaml/dist/options.d.ts +338 -0
  253. package/node_modules/yaml/dist/options.js +20 -0
  254. package/node_modules/yaml/dist/parse/cst-scalar.d.ts +64 -0
  255. package/node_modules/yaml/dist/parse/cst-scalar.js +219 -0
  256. package/node_modules/yaml/dist/parse/cst-stringify.d.ts +8 -0
  257. package/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
  258. package/node_modules/yaml/dist/parse/cst-visit.d.ts +39 -0
  259. package/node_modules/yaml/dist/parse/cst-visit.js +99 -0
  260. package/node_modules/yaml/dist/parse/cst.d.ts +106 -0
  261. package/node_modules/yaml/dist/parse/cst.js +112 -0
  262. package/node_modules/yaml/dist/parse/lexer.d.ts +87 -0
  263. package/node_modules/yaml/dist/parse/lexer.js +694 -0
  264. package/node_modules/yaml/dist/parse/line-counter.d.ts +22 -0
  265. package/node_modules/yaml/dist/parse/line-counter.js +41 -0
  266. package/node_modules/yaml/dist/parse/parser.d.ts +84 -0
  267. package/node_modules/yaml/dist/parse/parser.js +886 -0
  268. package/node_modules/yaml/dist/public-api.d.ts +43 -0
  269. package/node_modules/yaml/dist/public-api.js +104 -0
  270. package/node_modules/yaml/dist/schema/Schema.d.ts +18 -0
  271. package/node_modules/yaml/dist/schema/Schema.js +36 -0
  272. package/node_modules/yaml/dist/schema/common/map.d.ts +2 -0
  273. package/node_modules/yaml/dist/schema/common/map.js +44 -0
  274. package/node_modules/yaml/dist/schema/common/null.d.ts +4 -0
  275. package/node_modules/yaml/dist/schema/common/null.js +15 -0
  276. package/node_modules/yaml/dist/schema/common/seq.d.ts +2 -0
  277. package/node_modules/yaml/dist/schema/common/seq.js +35 -0
  278. package/node_modules/yaml/dist/schema/common/string.d.ts +2 -0
  279. package/node_modules/yaml/dist/schema/common/string.js +16 -0
  280. package/node_modules/yaml/dist/schema/core/bool.d.ts +4 -0
  281. package/node_modules/yaml/dist/schema/core/bool.js +21 -0
  282. package/node_modules/yaml/dist/schema/core/float.d.ts +4 -0
  283. package/node_modules/yaml/dist/schema/core/float.js +47 -0
  284. package/node_modules/yaml/dist/schema/core/int.d.ts +4 -0
  285. package/node_modules/yaml/dist/schema/core/int.js +42 -0
  286. package/node_modules/yaml/dist/schema/core/schema.d.ts +1 -0
  287. package/node_modules/yaml/dist/schema/core/schema.js +25 -0
  288. package/node_modules/yaml/dist/schema/json/schema.d.ts +2 -0
  289. package/node_modules/yaml/dist/schema/json/schema.js +64 -0
  290. package/node_modules/yaml/dist/schema/tags.d.ts +40 -0
  291. package/node_modules/yaml/dist/schema/tags.js +86 -0
  292. package/node_modules/yaml/dist/schema/types.d.ts +82 -0
  293. package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +2 -0
  294. package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +68 -0
  295. package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +7 -0
  296. package/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
  297. package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +4 -0
  298. package/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
  299. package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +5 -0
  300. package/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
  301. package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +21 -0
  302. package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +76 -0
  303. package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +10 -0
  304. package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +81 -0
  305. package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -0
  306. package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +39 -0
  307. package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +22 -0
  308. package/node_modules/yaml/dist/schema/yaml-1.1/set.js +90 -0
  309. package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +6 -0
  310. package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
  311. package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +34 -0
  312. package/node_modules/yaml/dist/stringify/foldFlowLines.js +140 -0
  313. package/node_modules/yaml/dist/stringify/stringify.d.ts +20 -0
  314. package/node_modules/yaml/dist/stringify/stringify.js +127 -0
  315. package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +17 -0
  316. package/node_modules/yaml/dist/stringify/stringifyCollection.js +154 -0
  317. package/node_modules/yaml/dist/stringify/stringifyComment.d.ts +10 -0
  318. package/node_modules/yaml/dist/stringify/stringifyComment.js +22 -0
  319. package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +3 -0
  320. package/node_modules/yaml/dist/stringify/stringifyDocument.js +70 -0
  321. package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +2 -0
  322. package/node_modules/yaml/dist/stringify/stringifyNumber.js +26 -0
  323. package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +3 -0
  324. package/node_modules/yaml/dist/stringify/stringifyPair.js +124 -0
  325. package/node_modules/yaml/dist/stringify/stringifyString.d.ts +3 -0
  326. package/node_modules/yaml/dist/stringify/stringifyString.js +316 -0
  327. package/node_modules/yaml/dist/test-events.d.ts +4 -0
  328. package/node_modules/yaml/dist/test-events.js +126 -152
  329. package/node_modules/yaml/dist/util.d.ts +9 -0
  330. package/node_modules/yaml/dist/util.js +19 -14
  331. package/node_modules/yaml/dist/visit.d.ts +63 -0
  332. package/node_modules/yaml/dist/visit.js +148 -0
  333. package/node_modules/yaml/package.json +43 -55
  334. package/node_modules/yaml/util.d.ts +3 -86
  335. package/node_modules/yaml/util.js +2 -16
  336. package/package.json +2 -2
  337. package/releasetag.txt +1 -1
  338. package/version.txt +1 -1
  339. package/node_modules/yaml/browser/dist/PlainValue-b8036b75.js +0 -1275
  340. package/node_modules/yaml/browser/dist/Schema-e94716c8.js +0 -682
  341. package/node_modules/yaml/browser/dist/legacy-exports.js +0 -3
  342. package/node_modules/yaml/browser/dist/package.json +0 -1
  343. package/node_modules/yaml/browser/dist/parse-cst.js +0 -1904
  344. package/node_modules/yaml/browser/dist/resolveSeq-492ab440.js +0 -2419
  345. package/node_modules/yaml/browser/dist/types.js +0 -4
  346. package/node_modules/yaml/browser/dist/warnings-df54cb69.js +0 -499
  347. package/node_modules/yaml/browser/map.js +0 -2
  348. package/node_modules/yaml/browser/pair.js +0 -2
  349. package/node_modules/yaml/browser/parse-cst.js +0 -1
  350. package/node_modules/yaml/browser/scalar.js +0 -2
  351. package/node_modules/yaml/browser/schema.js +0 -9
  352. package/node_modules/yaml/browser/seq.js +0 -2
  353. package/node_modules/yaml/browser/types/binary.js +0 -8
  354. package/node_modules/yaml/browser/types/omap.js +0 -3
  355. package/node_modules/yaml/browser/types/pairs.js +0 -3
  356. package/node_modules/yaml/browser/types/set.js +0 -3
  357. package/node_modules/yaml/browser/types/timestamp.js +0 -10
  358. package/node_modules/yaml/browser/types.js +0 -1
  359. package/node_modules/yaml/browser/util.js +0 -1
  360. package/node_modules/yaml/dist/Document-9b4560a1.js +0 -757
  361. package/node_modules/yaml/dist/PlainValue-ec8e588e.js +0 -876
  362. package/node_modules/yaml/dist/Schema-88e323a7.js +0 -525
  363. package/node_modules/yaml/dist/legacy-exports.js +0 -16
  364. package/node_modules/yaml/dist/parse-cst.js +0 -1753
  365. package/node_modules/yaml/dist/resolveSeq-d03cb037.js +0 -2161
  366. package/node_modules/yaml/dist/types.js +0 -23
  367. package/node_modules/yaml/dist/warnings-1000a372.js +0 -416
  368. package/node_modules/yaml/index.d.ts +0 -372
  369. package/node_modules/yaml/index.js +0 -1
  370. package/node_modules/yaml/map.js +0 -2
  371. package/node_modules/yaml/pair.js +0 -2
  372. package/node_modules/yaml/parse-cst.d.ts +0 -191
  373. package/node_modules/yaml/parse-cst.js +0 -1
  374. package/node_modules/yaml/scalar.js +0 -2
  375. package/node_modules/yaml/schema.js +0 -9
  376. package/node_modules/yaml/seq.js +0 -2
  377. package/node_modules/yaml/types/binary.js +0 -8
  378. package/node_modules/yaml/types/omap.js +0 -3
  379. package/node_modules/yaml/types/pairs.js +0 -3
  380. package/node_modules/yaml/types/set.js +0 -3
  381. package/node_modules/yaml/types/timestamp.js +0 -10
  382. package/node_modules/yaml/types.d.ts +0 -407
  383. package/node_modules/yaml/types.js +0 -17
  384. package/node_modules/yaml/types.mjs +0 -17
  385. package/node_modules/yaml/util.mjs +0 -18
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * `yaml` defines document-specific options in three places: as an argument of
5
+ * parse, create and stringify calls, in the values of `YAML.defaultOptions`,
6
+ * and in the version-dependent `YAML.Document.defaults` object. Values set in
7
+ * `YAML.defaultOptions` override version-dependent defaults, and argument
8
+ * options override both.
9
+ */
10
+ const defaultOptions = {
11
+ intAsBigInt: false,
12
+ keepSourceTokens: false,
13
+ logLevel: 'warn',
14
+ prettyErrors: true,
15
+ strict: true,
16
+ uniqueKeys: true,
17
+ version: '1.2'
18
+ };
19
+
20
+ exports.defaultOptions = defaultOptions;
@@ -0,0 +1,64 @@
1
+ import { ErrorCode } from '../errors.js';
2
+ import { Range } from '../nodes/Node.js';
3
+ import type { Scalar } from '../nodes/Scalar.js';
4
+ import type { BlockScalar, FlowScalar, SourceToken, Token } from './cst.js';
5
+ /**
6
+ * If `token` is a CST flow or block scalar, determine its string value and a few other attributes.
7
+ * Otherwise, return `null`.
8
+ */
9
+ export declare function resolveAsScalar(token: FlowScalar | BlockScalar, strict?: boolean, onError?: (offset: number, code: ErrorCode, message: string) => void): {
10
+ value: string;
11
+ type: Scalar.Type | null;
12
+ comment: string;
13
+ range: Range;
14
+ };
15
+ export declare function resolveAsScalar(token: Token | null | undefined, strict?: boolean, onError?: (offset: number, code: ErrorCode, message: string) => void): {
16
+ value: string;
17
+ type: Scalar.Type | null;
18
+ comment: string;
19
+ range: Range;
20
+ } | null;
21
+ /**
22
+ * Create a new scalar token with `value`
23
+ *
24
+ * Values that represent an actual string but may be parsed as a different type should use a `type` other than `'PLAIN'`,
25
+ * as this function does not support any schema operations and won't check for such conflicts.
26
+ *
27
+ * @param value The string representation of the value, which will have its content properly indented.
28
+ * @param context.end Comments and whitespace after the end of the value, or after the block scalar header. If undefined, a newline will be added.
29
+ * @param context.implicitKey Being within an implicit key may affect the resolved type of the token's value.
30
+ * @param context.indent The indent level of the token.
31
+ * @param context.inFlow Is this scalar within a flow collection? This may affect the resolved type of the token's value.
32
+ * @param context.offset The offset position of the token.
33
+ * @param context.type The preferred type of the scalar token. If undefined, the previous type of the `token` will be used, defaulting to `'PLAIN'`.
34
+ */
35
+ export declare function createScalarToken(value: string, context: {
36
+ end?: SourceToken[];
37
+ implicitKey?: boolean;
38
+ indent: number;
39
+ inFlow?: boolean;
40
+ offset?: number;
41
+ type?: Scalar.Type;
42
+ }): BlockScalar | FlowScalar;
43
+ /**
44
+ * Set the value of `token` to the given string `value`, overwriting any previous contents and type that it may have.
45
+ *
46
+ * Best efforts are made to retain any comments previously associated with the `token`,
47
+ * though all contents within a collection's `items` will be overwritten.
48
+ *
49
+ * Values that represent an actual string but may be parsed as a different type should use a `type` other than `'PLAIN'`,
50
+ * as this function does not support any schema operations and won't check for such conflicts.
51
+ *
52
+ * @param token Any token. If it does not include an `indent` value, the value will be stringified as if it were an implicit key.
53
+ * @param value The string representation of the value, which will have its content properly indented.
54
+ * @param context.afterKey In most cases, values after a key should have an additional level of indentation.
55
+ * @param context.implicitKey Being within an implicit key may affect the resolved type of the token's value.
56
+ * @param context.inFlow Being within a flow collection may affect the resolved type of the token's value.
57
+ * @param context.type The preferred type of the scalar token. If undefined, the previous type of the `token` will be used, defaulting to `'PLAIN'`.
58
+ */
59
+ export declare function setScalarValue(token: Token, value: string, context?: {
60
+ afterKey?: boolean;
61
+ implicitKey?: boolean;
62
+ inFlow?: boolean;
63
+ type?: Scalar.Type;
64
+ }): void;
@@ -0,0 +1,219 @@
1
+ 'use strict';
2
+
3
+ var resolveBlockScalar = require('../compose/resolve-block-scalar.js');
4
+ var resolveFlowScalar = require('../compose/resolve-flow-scalar.js');
5
+ var errors = require('../errors.js');
6
+ var stringifyString = require('../stringify/stringifyString.js');
7
+
8
+ function resolveAsScalar(token, strict = true, onError) {
9
+ if (token) {
10
+ const _onError = (pos, code, message) => {
11
+ const offset = typeof pos === 'number' ? pos : Array.isArray(pos) ? pos[0] : pos.offset;
12
+ if (onError)
13
+ onError(offset, code, message);
14
+ else
15
+ throw new errors.YAMLParseError([offset, offset + 1], code, message);
16
+ };
17
+ switch (token.type) {
18
+ case 'scalar':
19
+ case 'single-quoted-scalar':
20
+ case 'double-quoted-scalar':
21
+ return resolveFlowScalar.resolveFlowScalar(token, strict, _onError);
22
+ case 'block-scalar':
23
+ return resolveBlockScalar.resolveBlockScalar(token, strict, _onError);
24
+ }
25
+ }
26
+ return null;
27
+ }
28
+ /**
29
+ * Create a new scalar token with `value`
30
+ *
31
+ * Values that represent an actual string but may be parsed as a different type should use a `type` other than `'PLAIN'`,
32
+ * as this function does not support any schema operations and won't check for such conflicts.
33
+ *
34
+ * @param value The string representation of the value, which will have its content properly indented.
35
+ * @param context.end Comments and whitespace after the end of the value, or after the block scalar header. If undefined, a newline will be added.
36
+ * @param context.implicitKey Being within an implicit key may affect the resolved type of the token's value.
37
+ * @param context.indent The indent level of the token.
38
+ * @param context.inFlow Is this scalar within a flow collection? This may affect the resolved type of the token's value.
39
+ * @param context.offset The offset position of the token.
40
+ * @param context.type The preferred type of the scalar token. If undefined, the previous type of the `token` will be used, defaulting to `'PLAIN'`.
41
+ */
42
+ function createScalarToken(value, context) {
43
+ var _a;
44
+ const { implicitKey = false, indent, inFlow = false, offset = -1, type = 'PLAIN' } = context;
45
+ const source = stringifyString.stringifyString({ type, value }, {
46
+ implicitKey,
47
+ indent: indent > 0 ? ' '.repeat(indent) : '',
48
+ inFlow,
49
+ options: { blockQuote: true, lineWidth: -1 }
50
+ });
51
+ const end = (_a = context.end) !== null && _a !== void 0 ? _a : [
52
+ { type: 'newline', offset: -1, indent, source: '\n' }
53
+ ];
54
+ switch (source[0]) {
55
+ case '|':
56
+ case '>': {
57
+ const he = source.indexOf('\n');
58
+ const head = source.substring(0, he);
59
+ const body = source.substring(he + 1) + '\n';
60
+ const props = [
61
+ { type: 'block-scalar-header', offset, indent, source: head }
62
+ ];
63
+ if (!addEndtoBlockProps(props, end))
64
+ props.push({ type: 'newline', offset: -1, indent, source: '\n' });
65
+ return { type: 'block-scalar', offset, indent, props, source: body };
66
+ }
67
+ case '"':
68
+ return { type: 'double-quoted-scalar', offset, indent, source, end };
69
+ case "'":
70
+ return { type: 'single-quoted-scalar', offset, indent, source, end };
71
+ default:
72
+ return { type: 'scalar', offset, indent, source, end };
73
+ }
74
+ }
75
+ /**
76
+ * Set the value of `token` to the given string `value`, overwriting any previous contents and type that it may have.
77
+ *
78
+ * Best efforts are made to retain any comments previously associated with the `token`,
79
+ * though all contents within a collection's `items` will be overwritten.
80
+ *
81
+ * Values that represent an actual string but may be parsed as a different type should use a `type` other than `'PLAIN'`,
82
+ * as this function does not support any schema operations and won't check for such conflicts.
83
+ *
84
+ * @param token Any token. If it does not include an `indent` value, the value will be stringified as if it were an implicit key.
85
+ * @param value The string representation of the value, which will have its content properly indented.
86
+ * @param context.afterKey In most cases, values after a key should have an additional level of indentation.
87
+ * @param context.implicitKey Being within an implicit key may affect the resolved type of the token's value.
88
+ * @param context.inFlow Being within a flow collection may affect the resolved type of the token's value.
89
+ * @param context.type The preferred type of the scalar token. If undefined, the previous type of the `token` will be used, defaulting to `'PLAIN'`.
90
+ */
91
+ function setScalarValue(token, value, context = {}) {
92
+ let { afterKey = false, implicitKey = false, inFlow = false, type } = context;
93
+ let indent = 'indent' in token ? token.indent : null;
94
+ if (afterKey && typeof indent === 'number')
95
+ indent += 2;
96
+ if (!type)
97
+ switch (token.type) {
98
+ case 'single-quoted-scalar':
99
+ type = 'QUOTE_SINGLE';
100
+ break;
101
+ case 'double-quoted-scalar':
102
+ type = 'QUOTE_DOUBLE';
103
+ break;
104
+ case 'block-scalar': {
105
+ const header = token.props[0];
106
+ if (header.type !== 'block-scalar-header')
107
+ throw new Error('Invalid block scalar header');
108
+ type = header.source[0] === '>' ? 'BLOCK_FOLDED' : 'BLOCK_LITERAL';
109
+ break;
110
+ }
111
+ default:
112
+ type = 'PLAIN';
113
+ }
114
+ const source = stringifyString.stringifyString({ type, value }, {
115
+ implicitKey: implicitKey || indent === null,
116
+ indent: indent !== null && indent > 0 ? ' '.repeat(indent) : '',
117
+ inFlow,
118
+ options: { blockQuote: true, lineWidth: -1 }
119
+ });
120
+ switch (source[0]) {
121
+ case '|':
122
+ case '>':
123
+ setBlockScalarValue(token, source);
124
+ break;
125
+ case '"':
126
+ setFlowScalarValue(token, source, 'double-quoted-scalar');
127
+ break;
128
+ case "'":
129
+ setFlowScalarValue(token, source, 'single-quoted-scalar');
130
+ break;
131
+ default:
132
+ setFlowScalarValue(token, source, 'scalar');
133
+ }
134
+ }
135
+ function setBlockScalarValue(token, source) {
136
+ const he = source.indexOf('\n');
137
+ const head = source.substring(0, he);
138
+ const body = source.substring(he + 1) + '\n';
139
+ if (token.type === 'block-scalar') {
140
+ const header = token.props[0];
141
+ if (header.type !== 'block-scalar-header')
142
+ throw new Error('Invalid block scalar header');
143
+ header.source = head;
144
+ token.source = body;
145
+ }
146
+ else {
147
+ const { offset } = token;
148
+ const indent = 'indent' in token ? token.indent : -1;
149
+ const props = [
150
+ { type: 'block-scalar-header', offset, indent, source: head }
151
+ ];
152
+ if (!addEndtoBlockProps(props, 'end' in token ? token.end : undefined))
153
+ props.push({ type: 'newline', offset: -1, indent, source: '\n' });
154
+ for (const key of Object.keys(token))
155
+ if (key !== 'type' && key !== 'offset')
156
+ delete token[key];
157
+ Object.assign(token, { type: 'block-scalar', indent, props, source: body });
158
+ }
159
+ }
160
+ /** @returns `true` if last token is a newline */
161
+ function addEndtoBlockProps(props, end) {
162
+ if (end)
163
+ for (const st of end)
164
+ switch (st.type) {
165
+ case 'space':
166
+ case 'comment':
167
+ props.push(st);
168
+ break;
169
+ case 'newline':
170
+ props.push(st);
171
+ return true;
172
+ }
173
+ return false;
174
+ }
175
+ function setFlowScalarValue(token, source, type) {
176
+ switch (token.type) {
177
+ case 'scalar':
178
+ case 'double-quoted-scalar':
179
+ case 'single-quoted-scalar':
180
+ token.type = type;
181
+ token.source = source;
182
+ break;
183
+ case 'block-scalar': {
184
+ const end = token.props.slice(1);
185
+ let oa = source.length;
186
+ if (token.props[0].type === 'block-scalar-header')
187
+ oa -= token.props[0].source.length;
188
+ for (const tok of end)
189
+ tok.offset += oa;
190
+ delete token.props;
191
+ Object.assign(token, { type, source, end });
192
+ break;
193
+ }
194
+ case 'block-map':
195
+ case 'block-seq': {
196
+ const offset = token.offset + source.length;
197
+ const nl = { type: 'newline', offset, indent: token.indent, source: '\n' };
198
+ delete token.items;
199
+ Object.assign(token, { type, source, end: [nl] });
200
+ break;
201
+ }
202
+ default: {
203
+ const indent = 'indent' in token ? token.indent : -1;
204
+ const end = 'end' in token && Array.isArray(token.end)
205
+ ? token.end.filter(st => st.type === 'space' ||
206
+ st.type === 'comment' ||
207
+ st.type === 'newline')
208
+ : [];
209
+ for (const key of Object.keys(token))
210
+ if (key !== 'type' && key !== 'offset')
211
+ delete token[key];
212
+ Object.assign(token, { type, indent, source, end });
213
+ }
214
+ }
215
+ }
216
+
217
+ exports.createScalarToken = createScalarToken;
218
+ exports.resolveAsScalar = resolveAsScalar;
219
+ exports.setScalarValue = setScalarValue;
@@ -0,0 +1,8 @@
1
+ import type { CollectionItem, Token } from './cst.js';
2
+ /**
3
+ * Stringify a CST document, token, or collection item
4
+ *
5
+ * Fair warning: This applies no validation whatsoever, and
6
+ * simply concatenates the sources in their logical order.
7
+ */
8
+ export declare const stringify: (cst: Token | CollectionItem) => string;
@@ -0,0 +1,63 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Stringify a CST document, token, or collection item
5
+ *
6
+ * Fair warning: This applies no validation whatsoever, and
7
+ * simply concatenates the sources in their logical order.
8
+ */
9
+ const stringify = (cst) => 'type' in cst ? stringifyToken(cst) : stringifyItem(cst);
10
+ function stringifyToken(token) {
11
+ switch (token.type) {
12
+ case 'block-scalar': {
13
+ let res = '';
14
+ for (const tok of token.props)
15
+ res += stringifyToken(tok);
16
+ return res + token.source;
17
+ }
18
+ case 'block-map':
19
+ case 'block-seq': {
20
+ let res = '';
21
+ for (const item of token.items)
22
+ res += stringifyItem(item);
23
+ return res;
24
+ }
25
+ case 'flow-collection': {
26
+ let res = token.start.source;
27
+ for (const item of token.items)
28
+ res += stringifyItem(item);
29
+ for (const st of token.end)
30
+ res += st.source;
31
+ return res;
32
+ }
33
+ case 'document': {
34
+ let res = stringifyItem(token);
35
+ if (token.end)
36
+ for (const st of token.end)
37
+ res += st.source;
38
+ return res;
39
+ }
40
+ default: {
41
+ let res = token.source;
42
+ if ('end' in token && token.end)
43
+ for (const st of token.end)
44
+ res += st.source;
45
+ return res;
46
+ }
47
+ }
48
+ }
49
+ function stringifyItem({ start, key, sep, value }) {
50
+ let res = '';
51
+ for (const st of start)
52
+ res += st.source;
53
+ if (key)
54
+ res += stringifyToken(key);
55
+ if (sep)
56
+ for (const st of sep)
57
+ res += st.source;
58
+ if (value)
59
+ res += stringifyToken(value);
60
+ return res;
61
+ }
62
+
63
+ exports.stringify = stringify;
@@ -0,0 +1,39 @@
1
+ import type { CollectionItem, Document } from './cst.js';
2
+ export declare type VisitPath = readonly ['key' | 'value', number][];
3
+ export declare type Visitor = (item: CollectionItem, path: VisitPath) => number | symbol | Visitor | void;
4
+ /**
5
+ * Apply a visitor to a CST document or item.
6
+ *
7
+ * Walks through the tree (depth-first) starting from the root, calling a
8
+ * `visitor` function with two arguments when entering each item:
9
+ * - `item`: The current item, which included the following members:
10
+ * - `start: SourceToken[]` – Source tokens before the key or value,
11
+ * possibly including its anchor or tag.
12
+ * - `key?: Token | null` – Set for pair values. May then be `null`, if
13
+ * the key before the `:` separator is empty.
14
+ * - `sep?: SourceToken[]` – Source tokens between the key and the value,
15
+ * which should include the `:` map value indicator if `value` is set.
16
+ * - `value?: Token` – The value of a sequence item, or of a map pair.
17
+ * - `path`: The steps from the root to the current node, as an array of
18
+ * `['key' | 'value', number]` tuples.
19
+ *
20
+ * The return value of the visitor may be used to control the traversal:
21
+ * - `undefined` (default): Do nothing and continue
22
+ * - `visit.SKIP`: Do not visit the children of this token, continue with
23
+ * next sibling
24
+ * - `visit.BREAK`: Terminate traversal completely
25
+ * - `visit.REMOVE`: Remove the current item, then continue with the next one
26
+ * - `number`: Set the index of the next step. This is useful especially if
27
+ * the index of the current token has changed.
28
+ * - `function`: Define the next visitor for this item. After the original
29
+ * visitor is called on item entry, next visitors are called after handling
30
+ * a non-empty `key` and when exiting the item.
31
+ */
32
+ export declare function visit(cst: Document | CollectionItem, visitor: Visitor): void;
33
+ export declare namespace visit {
34
+ var BREAK: symbol;
35
+ var SKIP: symbol;
36
+ var REMOVE: symbol;
37
+ var itemAtPath: (cst: Document | CollectionItem, path: VisitPath) => CollectionItem | undefined;
38
+ var parentCollection: (cst: Document | CollectionItem, path: VisitPath) => import("./cst.js").BlockMap | import("./cst.js").BlockSequence | import("./cst.js").FlowCollection;
39
+ }
@@ -0,0 +1,99 @@
1
+ 'use strict';
2
+
3
+ const BREAK = Symbol('break visit');
4
+ const SKIP = Symbol('skip children');
5
+ const REMOVE = Symbol('remove item');
6
+ /**
7
+ * Apply a visitor to a CST document or item.
8
+ *
9
+ * Walks through the tree (depth-first) starting from the root, calling a
10
+ * `visitor` function with two arguments when entering each item:
11
+ * - `item`: The current item, which included the following members:
12
+ * - `start: SourceToken[]` – Source tokens before the key or value,
13
+ * possibly including its anchor or tag.
14
+ * - `key?: Token | null` – Set for pair values. May then be `null`, if
15
+ * the key before the `:` separator is empty.
16
+ * - `sep?: SourceToken[]` – Source tokens between the key and the value,
17
+ * which should include the `:` map value indicator if `value` is set.
18
+ * - `value?: Token` – The value of a sequence item, or of a map pair.
19
+ * - `path`: The steps from the root to the current node, as an array of
20
+ * `['key' | 'value', number]` tuples.
21
+ *
22
+ * The return value of the visitor may be used to control the traversal:
23
+ * - `undefined` (default): Do nothing and continue
24
+ * - `visit.SKIP`: Do not visit the children of this token, continue with
25
+ * next sibling
26
+ * - `visit.BREAK`: Terminate traversal completely
27
+ * - `visit.REMOVE`: Remove the current item, then continue with the next one
28
+ * - `number`: Set the index of the next step. This is useful especially if
29
+ * the index of the current token has changed.
30
+ * - `function`: Define the next visitor for this item. After the original
31
+ * visitor is called on item entry, next visitors are called after handling
32
+ * a non-empty `key` and when exiting the item.
33
+ */
34
+ function visit(cst, visitor) {
35
+ if ('type' in cst && cst.type === 'document')
36
+ cst = { start: cst.start, value: cst.value };
37
+ _visit(Object.freeze([]), cst, visitor);
38
+ }
39
+ // Without the `as symbol` casts, TS declares these in the `visit`
40
+ // namespace using `var`, but then complains about that because
41
+ // `unique symbol` must be `const`.
42
+ /** Terminate visit traversal completely */
43
+ visit.BREAK = BREAK;
44
+ /** Do not visit the children of the current item */
45
+ visit.SKIP = SKIP;
46
+ /** Remove the current item */
47
+ visit.REMOVE = REMOVE;
48
+ /** Find the item at `path` from `cst` as the root */
49
+ visit.itemAtPath = (cst, path) => {
50
+ let item = cst;
51
+ for (const [field, index] of path) {
52
+ const tok = item && item[field];
53
+ if (tok && 'items' in tok) {
54
+ item = tok.items[index];
55
+ }
56
+ else
57
+ return undefined;
58
+ }
59
+ return item;
60
+ };
61
+ /**
62
+ * Get the immediate parent collection of the item at `path` from `cst` as the root.
63
+ *
64
+ * Throws an error if the collection is not found, which should never happen if the item itself exists.
65
+ */
66
+ visit.parentCollection = (cst, path) => {
67
+ const parent = visit.itemAtPath(cst, path.slice(0, -1));
68
+ const field = path[path.length - 1][0];
69
+ const coll = parent && parent[field];
70
+ if (coll && 'items' in coll)
71
+ return coll;
72
+ throw new Error('Parent collection not found');
73
+ };
74
+ function _visit(path, item, visitor) {
75
+ let ctrl = visitor(item, path);
76
+ if (typeof ctrl === 'symbol')
77
+ return ctrl;
78
+ for (const field of ['key', 'value']) {
79
+ const token = item[field];
80
+ if (token && 'items' in token) {
81
+ for (let i = 0; i < token.items.length; ++i) {
82
+ const ci = _visit(Object.freeze(path.concat([[field, i]])), token.items[i], visitor);
83
+ if (typeof ci === 'number')
84
+ i = ci - 1;
85
+ else if (ci === BREAK)
86
+ return BREAK;
87
+ else if (ci === REMOVE) {
88
+ token.items.splice(i, 1);
89
+ i -= 1;
90
+ }
91
+ }
92
+ if (typeof ctrl === 'function' && field === 'key')
93
+ ctrl = ctrl(item, path);
94
+ }
95
+ }
96
+ return typeof ctrl === 'function' ? ctrl(item, path) : ctrl;
97
+ }
98
+
99
+ exports.visit = visit;
@@ -0,0 +1,106 @@
1
+ export { createScalarToken, resolveAsScalar, setScalarValue } from './cst-scalar.js';
2
+ export { stringify } from './cst-stringify.js';
3
+ export { visit, Visitor, VisitPath } from './cst-visit.js';
4
+ export interface SourceToken {
5
+ type: 'byte-order-mark' | 'doc-mode' | 'doc-start' | 'space' | 'comment' | 'newline' | 'directive-line' | 'anchor' | 'tag' | 'seq-item-ind' | 'explicit-key-ind' | 'map-value-ind' | 'flow-map-start' | 'flow-map-end' | 'flow-seq-start' | 'flow-seq-end' | 'flow-error-end' | 'comma' | 'block-scalar-header';
6
+ offset: number;
7
+ indent: number;
8
+ source: string;
9
+ }
10
+ export interface ErrorToken {
11
+ type: 'error';
12
+ offset: number;
13
+ source: string;
14
+ message: string;
15
+ }
16
+ export interface Directive {
17
+ type: 'directive';
18
+ offset: number;
19
+ source: string;
20
+ }
21
+ export interface Document {
22
+ type: 'document';
23
+ offset: number;
24
+ start: SourceToken[];
25
+ value?: Token;
26
+ end?: SourceToken[];
27
+ }
28
+ export interface DocumentEnd {
29
+ type: 'doc-end';
30
+ offset: number;
31
+ source: string;
32
+ end?: SourceToken[];
33
+ }
34
+ export interface FlowScalar {
35
+ type: 'alias' | 'scalar' | 'single-quoted-scalar' | 'double-quoted-scalar';
36
+ offset: number;
37
+ indent: number;
38
+ source: string;
39
+ end?: SourceToken[];
40
+ }
41
+ export interface BlockScalar {
42
+ type: 'block-scalar';
43
+ offset: number;
44
+ indent: number;
45
+ props: Token[];
46
+ source: string;
47
+ }
48
+ export interface BlockMap {
49
+ type: 'block-map';
50
+ offset: number;
51
+ indent: number;
52
+ items: Array<{
53
+ start: SourceToken[];
54
+ key?: never;
55
+ sep?: never;
56
+ value?: never;
57
+ } | {
58
+ start: SourceToken[];
59
+ key: Token | null;
60
+ sep: SourceToken[];
61
+ value?: Token;
62
+ }>;
63
+ }
64
+ export interface BlockSequence {
65
+ type: 'block-seq';
66
+ offset: number;
67
+ indent: number;
68
+ items: Array<{
69
+ start: SourceToken[];
70
+ key?: never;
71
+ sep?: never;
72
+ value?: Token;
73
+ }>;
74
+ }
75
+ export declare type CollectionItem = {
76
+ start: SourceToken[];
77
+ key?: Token | null;
78
+ sep?: SourceToken[];
79
+ value?: Token;
80
+ };
81
+ export interface FlowCollection {
82
+ type: 'flow-collection';
83
+ offset: number;
84
+ indent: number;
85
+ start: SourceToken;
86
+ items: CollectionItem[];
87
+ end: SourceToken[];
88
+ }
89
+ export declare type Token = SourceToken | ErrorToken | Directive | Document | DocumentEnd | FlowScalar | BlockScalar | BlockMap | BlockSequence | FlowCollection;
90
+ export declare type TokenType = SourceToken['type'] | DocumentEnd['type'] | FlowScalar['type'];
91
+ /** The byte order mark */
92
+ export declare const BOM = "\uFEFF";
93
+ /** Start of doc-mode */
94
+ export declare const DOCUMENT = "\u0002";
95
+ /** Unexpected end of flow-mode */
96
+ export declare const FLOW_END = "\u0018";
97
+ /** Next token is a scalar value */
98
+ export declare const SCALAR = "\u001F";
99
+ /** @returns `true` if `token` is a flow or block collection */
100
+ export declare const isCollection: (token: Token | null | undefined) => token is BlockMap | BlockSequence | FlowCollection;
101
+ /** @returns `true` if `token` is a flow or block scalar; not an alias */
102
+ export declare const isScalar: (token: Token | null | undefined) => token is BlockScalar | FlowScalar;
103
+ /** Get a printable representation of a lexer token */
104
+ export declare function prettyToken(token: string): string;
105
+ /** Identify the type of a lexer token. May return `null` for unknown tokens. */
106
+ export declare function tokenType(source: string): TokenType | null;