projen 0.51.7 → 0.51.11

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 (395) 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/resolve/.eslintrc +1 -0
  109. package/node_modules/resolve/bin/resolve +7 -4
  110. package/node_modules/resolve/lib/async.js +10 -1
  111. package/node_modules/resolve/lib/core.json +5 -5
  112. package/node_modules/resolve/lib/homedir.js +24 -0
  113. package/node_modules/resolve/lib/sync.js +10 -1
  114. package/node_modules/resolve/package.json +11 -6
  115. package/node_modules/resolve/test/home_paths.js +127 -0
  116. package/node_modules/resolve/test/home_paths_sync.js +114 -0
  117. package/node_modules/resolve/test/resolver_sync.js +230 -28
  118. package/node_modules/yaml/LICENSE +1 -1
  119. package/node_modules/yaml/README.md +57 -41
  120. package/node_modules/yaml/browser/dist/compose/compose-collection.js +59 -0
  121. package/node_modules/yaml/browser/dist/compose/compose-doc.js +40 -0
  122. package/node_modules/yaml/browser/dist/compose/compose-node.js +81 -0
  123. package/node_modules/yaml/browser/dist/compose/compose-scalar.js +81 -0
  124. package/node_modules/yaml/browser/dist/compose/composer.js +219 -0
  125. package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +107 -0
  126. package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +185 -0
  127. package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +45 -0
  128. package/node_modules/yaml/browser/dist/compose/resolve-end.js +37 -0
  129. package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +200 -0
  130. package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +223 -0
  131. package/node_modules/yaml/browser/dist/compose/resolve-props.js +128 -0
  132. package/node_modules/yaml/browser/dist/compose/util-contains-newline.js +34 -0
  133. package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +27 -0
  134. package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +15 -0
  135. package/node_modules/yaml/browser/dist/compose/util-map-includes.js +17 -0
  136. package/node_modules/yaml/browser/dist/doc/Document.js +321 -0
  137. package/node_modules/yaml/browser/dist/doc/anchors.js +72 -0
  138. package/node_modules/yaml/browser/dist/doc/applyReviver.js +54 -0
  139. package/node_modules/yaml/browser/dist/doc/createNode.js +84 -0
  140. package/node_modules/yaml/browser/dist/doc/directives.js +166 -0
  141. package/node_modules/yaml/browser/dist/errors.js +57 -0
  142. package/node_modules/yaml/browser/dist/index.js +18 -1002
  143. package/node_modules/yaml/browser/dist/log.js +14 -0
  144. package/node_modules/yaml/browser/dist/node_modules/tslib/tslib.es6.js +164 -0
  145. package/node_modules/yaml/browser/dist/nodes/Alias.js +94 -0
  146. package/node_modules/yaml/browser/dist/nodes/Collection.js +146 -0
  147. package/node_modules/yaml/browser/dist/nodes/Node.js +48 -0
  148. package/node_modules/yaml/browser/dist/nodes/Pair.js +36 -0
  149. package/node_modules/yaml/browser/dist/nodes/Scalar.js +23 -0
  150. package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +116 -0
  151. package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +105 -0
  152. package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +104 -0
  153. package/node_modules/yaml/browser/dist/nodes/toJS.js +35 -0
  154. package/node_modules/yaml/browser/dist/options.js +18 -0
  155. package/node_modules/yaml/browser/dist/parse/cst-scalar.js +215 -0
  156. package/node_modules/yaml/browser/dist/parse/cst-stringify.js +61 -0
  157. package/node_modules/yaml/browser/dist/parse/cst-visit.js +97 -0
  158. package/node_modules/yaml/browser/dist/parse/cst.js +98 -0
  159. package/node_modules/yaml/browser/dist/parse/lexer.js +692 -0
  160. package/node_modules/yaml/browser/dist/parse/line-counter.js +39 -0
  161. package/node_modules/yaml/browser/dist/parse/parser.js +882 -0
  162. package/node_modules/yaml/browser/dist/public-api.js +99 -0
  163. package/node_modules/yaml/browser/dist/schema/Schema.js +34 -0
  164. package/node_modules/yaml/browser/dist/schema/common/map.js +42 -0
  165. package/node_modules/yaml/browser/dist/schema/common/null.js +13 -0
  166. package/node_modules/yaml/browser/dist/schema/common/seq.js +33 -0
  167. package/node_modules/yaml/browser/dist/schema/common/string.js +14 -0
  168. package/node_modules/yaml/browser/dist/schema/core/bool.js +19 -0
  169. package/node_modules/yaml/browser/dist/schema/core/float.js +43 -0
  170. package/node_modules/yaml/browser/dist/schema/core/int.js +38 -0
  171. package/node_modules/yaml/browser/dist/schema/core/schema.js +23 -0
  172. package/node_modules/yaml/browser/dist/schema/json/schema.js +62 -0
  173. package/node_modules/yaml/browser/dist/schema/tags.js +83 -0
  174. package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +66 -0
  175. package/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +26 -0
  176. package/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +46 -0
  177. package/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +71 -0
  178. package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +73 -0
  179. package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +77 -0
  180. package/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +37 -0
  181. package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +87 -0
  182. package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +101 -0
  183. package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +135 -0
  184. package/node_modules/yaml/browser/dist/stringify/stringify.js +124 -0
  185. package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +152 -0
  186. package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +18 -0
  187. package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +68 -0
  188. package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +24 -0
  189. package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +122 -0
  190. package/node_modules/yaml/browser/dist/stringify/stringifyString.js +314 -0
  191. package/node_modules/yaml/browser/dist/util.js +9 -2
  192. package/node_modules/yaml/browser/dist/visit.js +146 -0
  193. package/node_modules/yaml/browser/index.js +5 -1
  194. package/node_modules/yaml/browser/package.json +3 -0
  195. package/node_modules/yaml/dist/compose/compose-collection.d.ts +5 -0
  196. package/node_modules/yaml/dist/compose/compose-collection.js +61 -0
  197. package/node_modules/yaml/dist/compose/compose-doc.d.ts +6 -0
  198. package/node_modules/yaml/dist/compose/compose-doc.js +42 -0
  199. package/node_modules/yaml/dist/compose/compose-node.d.ts +26 -0
  200. package/node_modules/yaml/dist/compose/compose-node.js +84 -0
  201. package/node_modules/yaml/dist/compose/compose-scalar.d.ts +5 -0
  202. package/node_modules/yaml/dist/compose/compose-scalar.js +83 -0
  203. package/node_modules/yaml/dist/compose/composer.d.ts +62 -0
  204. package/node_modules/yaml/dist/compose/composer.js +223 -0
  205. package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +6 -0
  206. package/node_modules/yaml/dist/compose/resolve-block-map.js +109 -0
  207. package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +10 -0
  208. package/node_modules/yaml/dist/compose/resolve-block-scalar.js +187 -0
  209. package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +5 -0
  210. package/node_modules/yaml/dist/compose/resolve-block-seq.js +47 -0
  211. package/node_modules/yaml/dist/compose/resolve-end.d.ts +6 -0
  212. package/node_modules/yaml/dist/compose/resolve-end.js +39 -0
  213. package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +6 -0
  214. package/node_modules/yaml/dist/compose/resolve-flow-collection.js +202 -0
  215. package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +10 -0
  216. package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +225 -0
  217. package/node_modules/yaml/dist/compose/resolve-props.d.ts +21 -0
  218. package/node_modules/yaml/dist/compose/resolve-props.js +130 -0
  219. package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +2 -0
  220. package/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
  221. package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +2 -0
  222. package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +29 -0
  223. package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +3 -0
  224. package/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
  225. package/node_modules/yaml/dist/compose/util-map-includes.d.ts +4 -0
  226. package/node_modules/yaml/dist/compose/util-map-includes.js +19 -0
  227. package/node_modules/yaml/dist/doc/Document.d.ts +139 -0
  228. package/node_modules/yaml/dist/doc/Document.js +323 -0
  229. package/node_modules/yaml/dist/doc/anchors.d.ts +24 -0
  230. package/node_modules/yaml/dist/doc/anchors.js +77 -0
  231. package/node_modules/yaml/dist/doc/applyReviver.d.ts +9 -0
  232. package/node_modules/yaml/dist/doc/applyReviver.js +56 -0
  233. package/node_modules/yaml/dist/doc/createNode.d.ts +17 -0
  234. package/node_modules/yaml/dist/doc/createNode.js +86 -0
  235. package/node_modules/yaml/dist/doc/directives.d.ts +47 -0
  236. package/node_modules/yaml/dist/doc/directives.js +168 -0
  237. package/node_modules/yaml/dist/errors.d.ts +21 -0
  238. package/node_modules/yaml/dist/errors.js +62 -0
  239. package/node_modules/yaml/dist/index.d.ts +19 -0
  240. package/node_modules/yaml/dist/index.js +49 -77
  241. package/node_modules/yaml/dist/log.d.ts +3 -0
  242. package/node_modules/yaml/dist/log.js +17 -0
  243. package/node_modules/yaml/dist/node_modules/tslib/tslib.es6.js +76 -0
  244. package/node_modules/yaml/dist/nodes/Alias.d.ts +28 -0
  245. package/node_modules/yaml/dist/nodes/Alias.js +96 -0
  246. package/node_modules/yaml/dist/nodes/Collection.d.ts +73 -0
  247. package/node_modules/yaml/dist/nodes/Collection.js +150 -0
  248. package/node_modules/yaml/dist/nodes/Node.d.ts +53 -0
  249. package/node_modules/yaml/dist/nodes/Node.js +66 -0
  250. package/node_modules/yaml/dist/nodes/Pair.d.ts +21 -0
  251. package/node_modules/yaml/dist/nodes/Pair.js +39 -0
  252. package/node_modules/yaml/dist/nodes/Scalar.d.ts +42 -0
  253. package/node_modules/yaml/dist/nodes/Scalar.js +26 -0
  254. package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +41 -0
  255. package/node_modules/yaml/dist/nodes/YAMLMap.js +119 -0
  256. package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +55 -0
  257. package/node_modules/yaml/dist/nodes/YAMLSeq.js +107 -0
  258. package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +3 -0
  259. package/node_modules/yaml/dist/nodes/addPairToJSMap.js +106 -0
  260. package/node_modules/yaml/dist/nodes/toJS.d.ts +30 -0
  261. package/node_modules/yaml/dist/nodes/toJS.js +37 -0
  262. package/node_modules/yaml/dist/options.d.ts +338 -0
  263. package/node_modules/yaml/dist/options.js +20 -0
  264. package/node_modules/yaml/dist/parse/cst-scalar.d.ts +64 -0
  265. package/node_modules/yaml/dist/parse/cst-scalar.js +219 -0
  266. package/node_modules/yaml/dist/parse/cst-stringify.d.ts +8 -0
  267. package/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
  268. package/node_modules/yaml/dist/parse/cst-visit.d.ts +39 -0
  269. package/node_modules/yaml/dist/parse/cst-visit.js +99 -0
  270. package/node_modules/yaml/dist/parse/cst.d.ts +106 -0
  271. package/node_modules/yaml/dist/parse/cst.js +112 -0
  272. package/node_modules/yaml/dist/parse/lexer.d.ts +87 -0
  273. package/node_modules/yaml/dist/parse/lexer.js +694 -0
  274. package/node_modules/yaml/dist/parse/line-counter.d.ts +22 -0
  275. package/node_modules/yaml/dist/parse/line-counter.js +41 -0
  276. package/node_modules/yaml/dist/parse/parser.d.ts +84 -0
  277. package/node_modules/yaml/dist/parse/parser.js +886 -0
  278. package/node_modules/yaml/dist/public-api.d.ts +43 -0
  279. package/node_modules/yaml/dist/public-api.js +104 -0
  280. package/node_modules/yaml/dist/schema/Schema.d.ts +18 -0
  281. package/node_modules/yaml/dist/schema/Schema.js +36 -0
  282. package/node_modules/yaml/dist/schema/common/map.d.ts +2 -0
  283. package/node_modules/yaml/dist/schema/common/map.js +44 -0
  284. package/node_modules/yaml/dist/schema/common/null.d.ts +4 -0
  285. package/node_modules/yaml/dist/schema/common/null.js +15 -0
  286. package/node_modules/yaml/dist/schema/common/seq.d.ts +2 -0
  287. package/node_modules/yaml/dist/schema/common/seq.js +35 -0
  288. package/node_modules/yaml/dist/schema/common/string.d.ts +2 -0
  289. package/node_modules/yaml/dist/schema/common/string.js +16 -0
  290. package/node_modules/yaml/dist/schema/core/bool.d.ts +4 -0
  291. package/node_modules/yaml/dist/schema/core/bool.js +21 -0
  292. package/node_modules/yaml/dist/schema/core/float.d.ts +4 -0
  293. package/node_modules/yaml/dist/schema/core/float.js +47 -0
  294. package/node_modules/yaml/dist/schema/core/int.d.ts +4 -0
  295. package/node_modules/yaml/dist/schema/core/int.js +42 -0
  296. package/node_modules/yaml/dist/schema/core/schema.d.ts +1 -0
  297. package/node_modules/yaml/dist/schema/core/schema.js +25 -0
  298. package/node_modules/yaml/dist/schema/json/schema.d.ts +2 -0
  299. package/node_modules/yaml/dist/schema/json/schema.js +64 -0
  300. package/node_modules/yaml/dist/schema/tags.d.ts +40 -0
  301. package/node_modules/yaml/dist/schema/tags.js +86 -0
  302. package/node_modules/yaml/dist/schema/types.d.ts +82 -0
  303. package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +2 -0
  304. package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +68 -0
  305. package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +7 -0
  306. package/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
  307. package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +4 -0
  308. package/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
  309. package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +5 -0
  310. package/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
  311. package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +21 -0
  312. package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +76 -0
  313. package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +10 -0
  314. package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +81 -0
  315. package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -0
  316. package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +39 -0
  317. package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +22 -0
  318. package/node_modules/yaml/dist/schema/yaml-1.1/set.js +90 -0
  319. package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +6 -0
  320. package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
  321. package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +34 -0
  322. package/node_modules/yaml/dist/stringify/foldFlowLines.js +140 -0
  323. package/node_modules/yaml/dist/stringify/stringify.d.ts +20 -0
  324. package/node_modules/yaml/dist/stringify/stringify.js +127 -0
  325. package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +17 -0
  326. package/node_modules/yaml/dist/stringify/stringifyCollection.js +154 -0
  327. package/node_modules/yaml/dist/stringify/stringifyComment.d.ts +10 -0
  328. package/node_modules/yaml/dist/stringify/stringifyComment.js +22 -0
  329. package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +3 -0
  330. package/node_modules/yaml/dist/stringify/stringifyDocument.js +70 -0
  331. package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +2 -0
  332. package/node_modules/yaml/dist/stringify/stringifyNumber.js +26 -0
  333. package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +3 -0
  334. package/node_modules/yaml/dist/stringify/stringifyPair.js +124 -0
  335. package/node_modules/yaml/dist/stringify/stringifyString.d.ts +3 -0
  336. package/node_modules/yaml/dist/stringify/stringifyString.js +316 -0
  337. package/node_modules/yaml/dist/test-events.d.ts +4 -0
  338. package/node_modules/yaml/dist/test-events.js +126 -152
  339. package/node_modules/yaml/dist/util.d.ts +9 -0
  340. package/node_modules/yaml/dist/util.js +19 -14
  341. package/node_modules/yaml/dist/visit.d.ts +63 -0
  342. package/node_modules/yaml/dist/visit.js +148 -0
  343. package/node_modules/yaml/package.json +43 -55
  344. package/node_modules/yaml/util.d.ts +3 -86
  345. package/node_modules/yaml/util.js +2 -16
  346. package/package.json +3 -3
  347. package/releasetag.txt +1 -1
  348. package/version.txt +1 -1
  349. package/node_modules/yaml/browser/dist/PlainValue-b8036b75.js +0 -1275
  350. package/node_modules/yaml/browser/dist/Schema-e94716c8.js +0 -682
  351. package/node_modules/yaml/browser/dist/legacy-exports.js +0 -3
  352. package/node_modules/yaml/browser/dist/package.json +0 -1
  353. package/node_modules/yaml/browser/dist/parse-cst.js +0 -1904
  354. package/node_modules/yaml/browser/dist/resolveSeq-492ab440.js +0 -2419
  355. package/node_modules/yaml/browser/dist/types.js +0 -4
  356. package/node_modules/yaml/browser/dist/warnings-df54cb69.js +0 -499
  357. package/node_modules/yaml/browser/map.js +0 -2
  358. package/node_modules/yaml/browser/pair.js +0 -2
  359. package/node_modules/yaml/browser/parse-cst.js +0 -1
  360. package/node_modules/yaml/browser/scalar.js +0 -2
  361. package/node_modules/yaml/browser/schema.js +0 -9
  362. package/node_modules/yaml/browser/seq.js +0 -2
  363. package/node_modules/yaml/browser/types/binary.js +0 -8
  364. package/node_modules/yaml/browser/types/omap.js +0 -3
  365. package/node_modules/yaml/browser/types/pairs.js +0 -3
  366. package/node_modules/yaml/browser/types/set.js +0 -3
  367. package/node_modules/yaml/browser/types/timestamp.js +0 -10
  368. package/node_modules/yaml/browser/types.js +0 -1
  369. package/node_modules/yaml/browser/util.js +0 -1
  370. package/node_modules/yaml/dist/Document-9b4560a1.js +0 -757
  371. package/node_modules/yaml/dist/PlainValue-ec8e588e.js +0 -876
  372. package/node_modules/yaml/dist/Schema-88e323a7.js +0 -525
  373. package/node_modules/yaml/dist/legacy-exports.js +0 -16
  374. package/node_modules/yaml/dist/parse-cst.js +0 -1753
  375. package/node_modules/yaml/dist/resolveSeq-d03cb037.js +0 -2161
  376. package/node_modules/yaml/dist/types.js +0 -23
  377. package/node_modules/yaml/dist/warnings-1000a372.js +0 -416
  378. package/node_modules/yaml/index.d.ts +0 -372
  379. package/node_modules/yaml/index.js +0 -1
  380. package/node_modules/yaml/map.js +0 -2
  381. package/node_modules/yaml/pair.js +0 -2
  382. package/node_modules/yaml/parse-cst.d.ts +0 -191
  383. package/node_modules/yaml/parse-cst.js +0 -1
  384. package/node_modules/yaml/scalar.js +0 -2
  385. package/node_modules/yaml/schema.js +0 -9
  386. package/node_modules/yaml/seq.js +0 -2
  387. package/node_modules/yaml/types/binary.js +0 -8
  388. package/node_modules/yaml/types/omap.js +0 -3
  389. package/node_modules/yaml/types/pairs.js +0 -3
  390. package/node_modules/yaml/types/set.js +0 -3
  391. package/node_modules/yaml/types/timestamp.js +0 -10
  392. package/node_modules/yaml/types.d.ts +0 -407
  393. package/node_modules/yaml/types.js +0 -17
  394. package/node_modules/yaml/types.mjs +0 -17
  395. package/node_modules/yaml/util.mjs +0 -18
@@ -0,0 +1,73 @@
1
+ import type { Schema } from '../schema/Schema.js';
2
+ import { NodeBase, NODE_TYPE } from './Node.js';
3
+ export declare function collectionFromPath(schema: Schema, path: unknown[], value: unknown): import("./Node.js").Node;
4
+ export declare const isEmptyPath: (path: Iterable<unknown> | null | undefined) => boolean;
5
+ export declare abstract class Collection extends NodeBase {
6
+ static maxFlowStringSingleLineLength: number;
7
+ schema: Schema | undefined;
8
+ [NODE_TYPE]: symbol;
9
+ items: unknown[];
10
+ /** An optional anchor on this node. Used by alias nodes. */
11
+ anchor?: string;
12
+ /**
13
+ * If true, stringify this and all child nodes using flow rather than
14
+ * block styles.
15
+ */
16
+ flow?: boolean;
17
+ constructor(type: symbol, schema?: Schema);
18
+ /**
19
+ * Create a copy of this collection.
20
+ *
21
+ * @param schema - If defined, overwrites the original's schema
22
+ */
23
+ clone(schema?: Schema): Collection;
24
+ /** Adds a value to the collection. */
25
+ abstract add(value: unknown): void;
26
+ /**
27
+ * Removes a value from the collection.
28
+ * @returns `true` if the item was found and removed.
29
+ */
30
+ abstract delete(key: unknown): boolean;
31
+ /**
32
+ * Returns item at `key`, or `undefined` if not found. By default unwraps
33
+ * scalar values from their surrounding node; to disable set `keepScalar` to
34
+ * `true` (collections are always returned intact).
35
+ */
36
+ abstract get(key: unknown, keepScalar?: boolean): unknown;
37
+ /**
38
+ * Checks if the collection includes a value with the key `key`.
39
+ */
40
+ abstract has(key: unknown): boolean;
41
+ /**
42
+ * Sets a value in this collection. For `!!set`, `value` needs to be a
43
+ * boolean to add/remove the item from the set.
44
+ */
45
+ abstract set(key: unknown, value: unknown): void;
46
+ /**
47
+ * Adds a value to the collection. For `!!map` and `!!omap` the value must
48
+ * be a Pair instance or a `{ key, value }` object, which may not have a key
49
+ * that already exists in the map.
50
+ */
51
+ addIn(path: Iterable<unknown>, value: unknown): void;
52
+ /**
53
+ * Removes a value from the collection.
54
+ * @returns `true` if the item was found and removed.
55
+ */
56
+ deleteIn(path: Iterable<unknown>): boolean;
57
+ /**
58
+ * Returns item at `key`, or `undefined` if not found. By default unwraps
59
+ * scalar values from their surrounding node; to disable set `keepScalar` to
60
+ * `true` (collections are always returned intact).
61
+ */
62
+ getIn(path: Iterable<unknown>, keepScalar?: boolean): unknown;
63
+ hasAllNullValues(allowScalar?: boolean): boolean;
64
+ /**
65
+ * Checks if the collection includes a value with the key `key`.
66
+ */
67
+ hasIn(path: Iterable<unknown>): boolean;
68
+ /**
69
+ * Sets a value in this collection. For `!!set`, `value` needs to be a
70
+ * boolean to add/remove the item from the set.
71
+ */
72
+ setIn(path: Iterable<unknown>, value: unknown): void;
73
+ }
@@ -0,0 +1,150 @@
1
+ 'use strict';
2
+
3
+ var createNode = require('../doc/createNode.js');
4
+ var Node = require('./Node.js');
5
+
6
+ function collectionFromPath(schema, path, value) {
7
+ let v = value;
8
+ for (let i = path.length - 1; i >= 0; --i) {
9
+ const k = path[i];
10
+ if (typeof k === 'number' && Number.isInteger(k) && k >= 0) {
11
+ const a = [];
12
+ a[k] = v;
13
+ v = a;
14
+ }
15
+ else {
16
+ v = new Map([[k, v]]);
17
+ }
18
+ }
19
+ return createNode.createNode(v, undefined, {
20
+ aliasDuplicateObjects: false,
21
+ keepUndefined: false,
22
+ onAnchor: () => {
23
+ throw new Error('This should not happen, please report a bug.');
24
+ },
25
+ schema,
26
+ sourceObjects: new Map()
27
+ });
28
+ }
29
+ // null, undefined, or an empty non-string iterable (e.g. [])
30
+ const isEmptyPath = (path) => path == null ||
31
+ (typeof path === 'object' && !!path[Symbol.iterator]().next().done);
32
+ class Collection extends Node.NodeBase {
33
+ constructor(type, schema) {
34
+ super(type);
35
+ Object.defineProperty(this, 'schema', {
36
+ value: schema,
37
+ configurable: true,
38
+ enumerable: false,
39
+ writable: true
40
+ });
41
+ }
42
+ /**
43
+ * Create a copy of this collection.
44
+ *
45
+ * @param schema - If defined, overwrites the original's schema
46
+ */
47
+ clone(schema) {
48
+ const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
49
+ if (schema)
50
+ copy.schema = schema;
51
+ copy.items = copy.items.map(it => Node.isNode(it) || Node.isPair(it) ? it.clone(schema) : it);
52
+ if (this.range)
53
+ copy.range = this.range.slice();
54
+ return copy;
55
+ }
56
+ /**
57
+ * Adds a value to the collection. For `!!map` and `!!omap` the value must
58
+ * be a Pair instance or a `{ key, value }` object, which may not have a key
59
+ * that already exists in the map.
60
+ */
61
+ addIn(path, value) {
62
+ if (isEmptyPath(path))
63
+ this.add(value);
64
+ else {
65
+ const [key, ...rest] = path;
66
+ const node = this.get(key, true);
67
+ if (Node.isCollection(node))
68
+ node.addIn(rest, value);
69
+ else if (node === undefined && this.schema)
70
+ this.set(key, collectionFromPath(this.schema, rest, value));
71
+ else
72
+ throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
73
+ }
74
+ }
75
+ /**
76
+ * Removes a value from the collection.
77
+ * @returns `true` if the item was found and removed.
78
+ */
79
+ deleteIn(path) {
80
+ const [key, ...rest] = path;
81
+ if (rest.length === 0)
82
+ return this.delete(key);
83
+ const node = this.get(key, true);
84
+ if (Node.isCollection(node))
85
+ return node.deleteIn(rest);
86
+ else
87
+ throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
88
+ }
89
+ /**
90
+ * Returns item at `key`, or `undefined` if not found. By default unwraps
91
+ * scalar values from their surrounding node; to disable set `keepScalar` to
92
+ * `true` (collections are always returned intact).
93
+ */
94
+ getIn(path, keepScalar) {
95
+ const [key, ...rest] = path;
96
+ const node = this.get(key, true);
97
+ if (rest.length === 0)
98
+ return !keepScalar && Node.isScalar(node) ? node.value : node;
99
+ else
100
+ return Node.isCollection(node) ? node.getIn(rest, keepScalar) : undefined;
101
+ }
102
+ hasAllNullValues(allowScalar) {
103
+ return this.items.every(node => {
104
+ if (!Node.isPair(node))
105
+ return false;
106
+ const n = node.value;
107
+ return (n == null ||
108
+ (allowScalar &&
109
+ Node.isScalar(n) &&
110
+ n.value == null &&
111
+ !n.commentBefore &&
112
+ !n.comment &&
113
+ !n.tag));
114
+ });
115
+ }
116
+ /**
117
+ * Checks if the collection includes a value with the key `key`.
118
+ */
119
+ hasIn(path) {
120
+ const [key, ...rest] = path;
121
+ if (rest.length === 0)
122
+ return this.has(key);
123
+ const node = this.get(key, true);
124
+ return Node.isCollection(node) ? node.hasIn(rest) : false;
125
+ }
126
+ /**
127
+ * Sets a value in this collection. For `!!set`, `value` needs to be a
128
+ * boolean to add/remove the item from the set.
129
+ */
130
+ setIn(path, value) {
131
+ const [key, ...rest] = path;
132
+ if (rest.length === 0) {
133
+ this.set(key, value);
134
+ }
135
+ else {
136
+ const node = this.get(key, true);
137
+ if (Node.isCollection(node))
138
+ node.setIn(rest, value);
139
+ else if (node === undefined && this.schema)
140
+ this.set(key, collectionFromPath(this.schema, rest, value));
141
+ else
142
+ throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
143
+ }
144
+ }
145
+ }
146
+ Collection.maxFlowStringSingleLineLength = 60;
147
+
148
+ exports.Collection = Collection;
149
+ exports.collectionFromPath = collectionFromPath;
150
+ exports.isEmptyPath = isEmptyPath;
@@ -0,0 +1,53 @@
1
+ import type { Document } from '../doc/Document.js';
2
+ import { Token } from '../parse/cst.js';
3
+ import type { StringifyContext } from '../stringify/stringify.js';
4
+ import type { Alias } from './Alias.js';
5
+ import type { Pair } from './Pair.js';
6
+ import type { Scalar } from './Scalar.js';
7
+ import type { YAMLMap } from './YAMLMap.js';
8
+ import type { YAMLSeq } from './YAMLSeq.js';
9
+ export declare type Node = Alias | Scalar | YAMLMap | YAMLSeq;
10
+ export declare type ParsedNode = Alias.Parsed | Scalar.Parsed | YAMLMap.Parsed | YAMLSeq.Parsed;
11
+ export declare type Range = [number, number, number];
12
+ export declare const ALIAS: unique symbol;
13
+ export declare const DOC: unique symbol;
14
+ export declare const MAP: unique symbol;
15
+ export declare const PAIR: unique symbol;
16
+ export declare const SCALAR: unique symbol;
17
+ export declare const SEQ: unique symbol;
18
+ export declare const NODE_TYPE: unique symbol;
19
+ export declare const isAlias: (node: any) => node is Alias;
20
+ export declare const isDocument: (node: any) => node is Document<unknown>;
21
+ export declare const isMap: (node: any) => node is YAMLMap<unknown, unknown>;
22
+ export declare const isPair: (node: any) => node is Pair<unknown, unknown>;
23
+ export declare const isScalar: (node: any) => node is Scalar<unknown>;
24
+ export declare const isSeq: (node: any) => node is YAMLSeq<unknown>;
25
+ export declare function isCollection(node: any): node is YAMLMap | YAMLSeq;
26
+ export declare function isNode(node: any): node is Node;
27
+ export declare const hasAnchor: (node: unknown) => node is Scalar<unknown> | YAMLMap<unknown, unknown> | YAMLSeq<unknown>;
28
+ export declare abstract class NodeBase {
29
+ readonly [NODE_TYPE]: symbol;
30
+ /** A comment on or immediately after this */
31
+ comment?: string | null;
32
+ /** A comment before this */
33
+ commentBefore?: string | null;
34
+ /**
35
+ * The `[start, value-end, node-end]` character offsets for the part of the
36
+ * source parsed into this node (undefined if not parsed). The `value-end`
37
+ * and `node-end` positions are themselves not included in their respective
38
+ * ranges.
39
+ */
40
+ range?: Range | null;
41
+ /** A blank line before this node and its commentBefore */
42
+ spaceBefore?: boolean;
43
+ /** The CST token that was composed into this node. */
44
+ srcToken?: Token;
45
+ /** A fully qualified tag, if required */
46
+ tag?: string;
47
+ /** A plain JS representation of this node */
48
+ abstract toJSON(): any;
49
+ abstract toString(ctx?: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string;
50
+ constructor(type: symbol);
51
+ /** Create a copy of this node. */
52
+ clone(): NodeBase;
53
+ }
@@ -0,0 +1,66 @@
1
+ 'use strict';
2
+
3
+ const ALIAS = Symbol.for('yaml.alias');
4
+ const DOC = Symbol.for('yaml.document');
5
+ const MAP = Symbol.for('yaml.map');
6
+ const PAIR = Symbol.for('yaml.pair');
7
+ const SCALAR = Symbol.for('yaml.scalar');
8
+ const SEQ = Symbol.for('yaml.seq');
9
+ const NODE_TYPE = Symbol.for('yaml.node.type');
10
+ const isAlias = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === ALIAS;
11
+ const isDocument = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === DOC;
12
+ const isMap = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === MAP;
13
+ const isPair = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === PAIR;
14
+ const isScalar = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === SCALAR;
15
+ const isSeq = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === SEQ;
16
+ function isCollection(node) {
17
+ if (node && typeof node === 'object')
18
+ switch (node[NODE_TYPE]) {
19
+ case MAP:
20
+ case SEQ:
21
+ return true;
22
+ }
23
+ return false;
24
+ }
25
+ function isNode(node) {
26
+ if (node && typeof node === 'object')
27
+ switch (node[NODE_TYPE]) {
28
+ case ALIAS:
29
+ case MAP:
30
+ case SCALAR:
31
+ case SEQ:
32
+ return true;
33
+ }
34
+ return false;
35
+ }
36
+ const hasAnchor = (node) => (isScalar(node) || isCollection(node)) && !!node.anchor;
37
+ class NodeBase {
38
+ constructor(type) {
39
+ Object.defineProperty(this, NODE_TYPE, { value: type });
40
+ }
41
+ /** Create a copy of this node. */
42
+ clone() {
43
+ const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
44
+ if (this.range)
45
+ copy.range = this.range.slice();
46
+ return copy;
47
+ }
48
+ }
49
+
50
+ exports.ALIAS = ALIAS;
51
+ exports.DOC = DOC;
52
+ exports.MAP = MAP;
53
+ exports.NODE_TYPE = NODE_TYPE;
54
+ exports.NodeBase = NodeBase;
55
+ exports.PAIR = PAIR;
56
+ exports.SCALAR = SCALAR;
57
+ exports.SEQ = SEQ;
58
+ exports.hasAnchor = hasAnchor;
59
+ exports.isAlias = isAlias;
60
+ exports.isCollection = isCollection;
61
+ exports.isDocument = isDocument;
62
+ exports.isMap = isMap;
63
+ exports.isNode = isNode;
64
+ exports.isPair = isPair;
65
+ exports.isScalar = isScalar;
66
+ exports.isSeq = isSeq;
@@ -0,0 +1,21 @@
1
+ import { CreateNodeContext } from '../doc/createNode.js';
2
+ import type { CollectionItem } from '../parse/cst.js';
3
+ import type { Schema } from '../schema/Schema.js';
4
+ import type { StringifyContext } from '../stringify/stringify.js';
5
+ import { addPairToJSMap } from './addPairToJSMap.js';
6
+ import { NODE_TYPE } from './Node.js';
7
+ import type { ToJSContext } from './toJS.js';
8
+ export declare function createPair(key: unknown, value: unknown, ctx: CreateNodeContext): Pair<import("./Node.js").Node, import("./Alias.js").Alias | import("./Scalar.js").Scalar<unknown> | import("./YAMLMap.js").YAMLMap<unknown, unknown> | import("./YAMLSeq.js").YAMLSeq<unknown>>;
9
+ export declare class Pair<K = unknown, V = unknown> {
10
+ readonly [NODE_TYPE]: symbol;
11
+ /** Always Node or null when parsed, but can be set to anything. */
12
+ key: K;
13
+ /** Always Node or null when parsed, but can be set to anything. */
14
+ value: V | null;
15
+ /** The CST token that was composed into this pair. */
16
+ srcToken?: CollectionItem;
17
+ constructor(key: K, value?: V | null);
18
+ clone(schema?: Schema): Pair<K, V>;
19
+ toJSON(_?: unknown, ctx?: ToJSContext): ReturnType<typeof addPairToJSMap>;
20
+ toString(ctx?: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string;
21
+ }
@@ -0,0 +1,39 @@
1
+ 'use strict';
2
+
3
+ var createNode = require('../doc/createNode.js');
4
+ var stringifyPair = require('../stringify/stringifyPair.js');
5
+ var addPairToJSMap = require('./addPairToJSMap.js');
6
+ var Node = require('./Node.js');
7
+
8
+ function createPair(key, value, ctx) {
9
+ const k = createNode.createNode(key, undefined, ctx);
10
+ const v = createNode.createNode(value, undefined, ctx);
11
+ return new Pair(k, v);
12
+ }
13
+ class Pair {
14
+ constructor(key, value = null) {
15
+ Object.defineProperty(this, Node.NODE_TYPE, { value: Node.PAIR });
16
+ this.key = key;
17
+ this.value = value;
18
+ }
19
+ clone(schema) {
20
+ let { key, value } = this;
21
+ if (Node.isNode(key))
22
+ key = key.clone(schema);
23
+ if (Node.isNode(value))
24
+ value = value.clone(schema);
25
+ return new Pair(key, value);
26
+ }
27
+ toJSON(_, ctx) {
28
+ const pair = ctx && ctx.mapAsMap ? new Map() : {};
29
+ return addPairToJSMap.addPairToJSMap(ctx, pair, this);
30
+ }
31
+ toString(ctx, onComment, onChompKeep) {
32
+ return ctx && ctx.doc
33
+ ? stringifyPair.stringifyPair(this, ctx, onComment, onChompKeep)
34
+ : JSON.stringify(this);
35
+ }
36
+ }
37
+
38
+ exports.Pair = Pair;
39
+ exports.createPair = createPair;
@@ -0,0 +1,42 @@
1
+ import type { BlockScalar, FlowScalar } from '../parse/cst.js';
2
+ import { NodeBase, Range } from './Node.js';
3
+ import { ToJSContext } from './toJS.js';
4
+ export declare const isScalarValue: (value: unknown) => boolean;
5
+ export declare namespace Scalar {
6
+ interface Parsed extends Scalar {
7
+ range: Range;
8
+ source: string;
9
+ srcToken?: FlowScalar | BlockScalar;
10
+ }
11
+ type BLOCK_FOLDED = 'BLOCK_FOLDED';
12
+ type BLOCK_LITERAL = 'BLOCK_LITERAL';
13
+ type PLAIN = 'PLAIN';
14
+ type QUOTE_DOUBLE = 'QUOTE_DOUBLE';
15
+ type QUOTE_SINGLE = 'QUOTE_SINGLE';
16
+ type Type = BLOCK_FOLDED | BLOCK_LITERAL | PLAIN | QUOTE_DOUBLE | QUOTE_SINGLE;
17
+ }
18
+ export declare class Scalar<T = unknown> extends NodeBase {
19
+ static readonly BLOCK_FOLDED = "BLOCK_FOLDED";
20
+ static readonly BLOCK_LITERAL = "BLOCK_LITERAL";
21
+ static readonly PLAIN = "PLAIN";
22
+ static readonly QUOTE_DOUBLE = "QUOTE_DOUBLE";
23
+ static readonly QUOTE_SINGLE = "QUOTE_SINGLE";
24
+ value: T;
25
+ /** An optional anchor on this node. Used by alias nodes. */
26
+ anchor?: string;
27
+ /**
28
+ * By default (undefined), numbers use decimal notation.
29
+ * The YAML 1.2 core schema only supports 'HEX' and 'OCT'.
30
+ * The YAML 1.1 schema also supports 'BIN' and 'TIME'
31
+ */
32
+ format?: string;
33
+ /** If `value` is a number, use this value when stringifying this node. */
34
+ minFractionDigits?: number;
35
+ /** Set during parsing to the source string value */
36
+ source?: string;
37
+ /** The scalar style used for the node's string representation */
38
+ type?: Scalar.Type;
39
+ constructor(value: T);
40
+ toJSON(arg?: any, ctx?: ToJSContext): any;
41
+ toString(): string;
42
+ }
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ var Node = require('./Node.js');
4
+ var toJS = require('./toJS.js');
5
+
6
+ const isScalarValue = (value) => !value || (typeof value !== 'function' && typeof value !== 'object');
7
+ class Scalar extends Node.NodeBase {
8
+ constructor(value) {
9
+ super(Node.SCALAR);
10
+ this.value = value;
11
+ }
12
+ toJSON(arg, ctx) {
13
+ return ctx && ctx.keep ? this.value : toJS.toJS(this.value, arg, ctx);
14
+ }
15
+ toString() {
16
+ return String(this.value);
17
+ }
18
+ }
19
+ Scalar.BLOCK_FOLDED = 'BLOCK_FOLDED';
20
+ Scalar.BLOCK_LITERAL = 'BLOCK_LITERAL';
21
+ Scalar.PLAIN = 'PLAIN';
22
+ Scalar.QUOTE_DOUBLE = 'QUOTE_DOUBLE';
23
+ Scalar.QUOTE_SINGLE = 'QUOTE_SINGLE';
24
+
25
+ exports.Scalar = Scalar;
26
+ exports.isScalarValue = isScalarValue;
@@ -0,0 +1,41 @@
1
+ import type { BlockMap, FlowCollection } from '../parse/cst.js';
2
+ import type { Schema } from '../schema/Schema.js';
3
+ import type { StringifyContext } from '../stringify/stringify.js';
4
+ import { Collection } from './Collection.js';
5
+ import { ParsedNode, Range } from './Node.js';
6
+ import { Pair } from './Pair.js';
7
+ import type { ToJSContext } from './toJS.js';
8
+ export declare function findPair<K = unknown, V = unknown>(items: Iterable<Pair<K, V>>, key: unknown): Pair<K, V> | undefined;
9
+ export declare namespace YAMLMap {
10
+ interface Parsed<K extends ParsedNode = ParsedNode, V extends ParsedNode | null = ParsedNode | null> extends YAMLMap<K, V> {
11
+ items: Pair<K, V>[];
12
+ range: Range;
13
+ srcToken?: BlockMap | FlowCollection;
14
+ }
15
+ }
16
+ export declare class YAMLMap<K = unknown, V = unknown> extends Collection {
17
+ static get tagName(): 'tag:yaml.org,2002:map';
18
+ items: Pair<K, V>[];
19
+ constructor(schema?: Schema);
20
+ /**
21
+ * Adds a value to the collection.
22
+ *
23
+ * @param overwrite - If not set `true`, using a key that is already in the
24
+ * collection will throw. Otherwise, overwrites the previous value.
25
+ */
26
+ add(pair: Pair<K, V> | {
27
+ key: K;
28
+ value: V;
29
+ }, overwrite?: boolean): void;
30
+ delete(key: K): boolean;
31
+ get(key: K, keepScalar?: boolean): unknown;
32
+ has(key: K): boolean;
33
+ set(key: K, value: V): void;
34
+ /**
35
+ * @param ctx - Conversion context, originally set in Document#toJS()
36
+ * @param {Class} Type - If set, forces the returned collection type
37
+ * @returns Instance of Type, Map, or Object
38
+ */
39
+ toJSON(_?: unknown, ctx?: ToJSContext, Type?: any): any;
40
+ toString(ctx?: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string;
41
+ }
@@ -0,0 +1,119 @@
1
+ 'use strict';
2
+
3
+ var stringifyCollection = require('../stringify/stringifyCollection.js');
4
+ var addPairToJSMap = require('./addPairToJSMap.js');
5
+ var Collection = require('./Collection.js');
6
+ var Node = require('./Node.js');
7
+ var Pair = require('./Pair.js');
8
+ var Scalar = require('./Scalar.js');
9
+
10
+ function findPair(items, key) {
11
+ const k = Node.isScalar(key) ? key.value : key;
12
+ for (const it of items) {
13
+ if (Node.isPair(it)) {
14
+ if (it.key === key || it.key === k)
15
+ return it;
16
+ if (Node.isScalar(it.key) && it.key.value === k)
17
+ return it;
18
+ }
19
+ }
20
+ return undefined;
21
+ }
22
+ class YAMLMap extends Collection.Collection {
23
+ constructor(schema) {
24
+ super(Node.MAP, schema);
25
+ this.items = [];
26
+ }
27
+ static get tagName() {
28
+ return 'tag:yaml.org,2002:map';
29
+ }
30
+ /**
31
+ * Adds a value to the collection.
32
+ *
33
+ * @param overwrite - If not set `true`, using a key that is already in the
34
+ * collection will throw. Otherwise, overwrites the previous value.
35
+ */
36
+ add(pair, overwrite) {
37
+ let _pair;
38
+ if (Node.isPair(pair))
39
+ _pair = pair;
40
+ else if (!pair || typeof pair !== 'object' || !('key' in pair)) {
41
+ // In TypeScript, this never happens.
42
+ _pair = new Pair.Pair(pair, pair.value);
43
+ }
44
+ else
45
+ _pair = new Pair.Pair(pair.key, pair.value);
46
+ const prev = findPair(this.items, _pair.key);
47
+ const sortEntries = this.schema && this.schema.sortMapEntries;
48
+ if (prev) {
49
+ if (!overwrite)
50
+ throw new Error(`Key ${_pair.key} already set`);
51
+ // For scalars, keep the old node & its comments and anchors
52
+ if (Node.isScalar(prev.value) && Scalar.isScalarValue(_pair.value))
53
+ prev.value.value = _pair.value;
54
+ else
55
+ prev.value = _pair.value;
56
+ }
57
+ else if (sortEntries) {
58
+ const i = this.items.findIndex(item => sortEntries(_pair, item) < 0);
59
+ if (i === -1)
60
+ this.items.push(_pair);
61
+ else
62
+ this.items.splice(i, 0, _pair);
63
+ }
64
+ else {
65
+ this.items.push(_pair);
66
+ }
67
+ }
68
+ delete(key) {
69
+ const it = findPair(this.items, key);
70
+ if (!it)
71
+ return false;
72
+ const del = this.items.splice(this.items.indexOf(it), 1);
73
+ return del.length > 0;
74
+ }
75
+ get(key, keepScalar) {
76
+ const it = findPair(this.items, key);
77
+ const node = it && it.value;
78
+ return !keepScalar && Node.isScalar(node) ? node.value : node;
79
+ }
80
+ has(key) {
81
+ return !!findPair(this.items, key);
82
+ }
83
+ set(key, value) {
84
+ this.add(new Pair.Pair(key, value), true);
85
+ }
86
+ /**
87
+ * @param ctx - Conversion context, originally set in Document#toJS()
88
+ * @param {Class} Type - If set, forces the returned collection type
89
+ * @returns Instance of Type, Map, or Object
90
+ */
91
+ toJSON(_, ctx, Type) {
92
+ const map = Type ? new Type() : ctx && ctx.mapAsMap ? new Map() : {};
93
+ if (ctx && ctx.onCreate)
94
+ ctx.onCreate(map);
95
+ for (const item of this.items)
96
+ addPairToJSMap.addPairToJSMap(ctx, map, item);
97
+ return map;
98
+ }
99
+ toString(ctx, onComment, onChompKeep) {
100
+ if (!ctx)
101
+ return JSON.stringify(this);
102
+ for (const item of this.items) {
103
+ if (!Node.isPair(item))
104
+ throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`);
105
+ }
106
+ if (!ctx.allNullValues && this.hasAllNullValues(false))
107
+ ctx = Object.assign({}, ctx, { allNullValues: true });
108
+ return stringifyCollection.stringifyCollection(this, ctx, {
109
+ blockItemPrefix: '',
110
+ flowChars: { start: '{', end: '}' },
111
+ itemIndent: ctx.indent || '',
112
+ onChompKeep,
113
+ onComment
114
+ });
115
+ }
116
+ }
117
+
118
+ exports.YAMLMap = YAMLMap;
119
+ exports.findPair = findPair;