projen 0.99.71 → 0.99.73

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 (534) hide show
  1. package/.jsii +3 -3
  2. package/lib/ai-instructions.js +2 -2
  3. package/lib/awscdk/auto-discover.js +6 -6
  4. package/lib/awscdk/awscdk-app-java.js +1 -1
  5. package/lib/awscdk/awscdk-app-py.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-py.js +1 -1
  11. package/lib/awscdk/awscdk-deps.js +1 -1
  12. package/lib/awscdk/cdk-config.js +4 -4
  13. package/lib/awscdk/cdk-tasks.js +1 -1
  14. package/lib/awscdk/integration-test.js +1 -1
  15. package/lib/awscdk/lambda-extension.js +1 -1
  16. package/lib/awscdk/lambda-function.js +2 -2
  17. package/lib/awscdk/private/feature-flags-v2.const.d.ts +1 -1
  18. package/lib/awscdk/private/feature-flags-v2.const.js +2 -2
  19. package/lib/build/build-workflow.js +1 -1
  20. package/lib/cdk/auto-discover-base.js +2 -2
  21. package/lib/cdk/construct-lib.js +1 -1
  22. package/lib/cdk/integration-test-base.js +1 -1
  23. package/lib/cdk/jsii-build.js +1 -1
  24. package/lib/cdk/jsii-docgen.js +1 -1
  25. package/lib/cdk/jsii-project.js +1 -1
  26. package/lib/cdk8s/auto-discover.js +2 -2
  27. package/lib/cdk8s/cdk8s-app-py.js +1 -1
  28. package/lib/cdk8s/cdk8s-app-ts.js +1 -1
  29. package/lib/cdk8s/cdk8s-construct.js +1 -1
  30. package/lib/cdk8s/cdk8s-deps-py.js +1 -1
  31. package/lib/cdk8s/cdk8s-deps.js +1 -1
  32. package/lib/cdk8s/integration-test.js +1 -1
  33. package/lib/cdktf/cdktf-construct.js +1 -1
  34. package/lib/circleci/circleci.js +1 -1
  35. package/lib/component.js +1 -1
  36. package/lib/dependencies.js +1 -1
  37. package/lib/dev-env.js +1 -1
  38. package/lib/docker-compose/docker-compose-service.js +1 -1
  39. package/lib/docker-compose/docker-compose.js +1 -1
  40. package/lib/file.js +1 -1
  41. package/lib/gitattributes.js +1 -1
  42. package/lib/github/actions-provider.js +1 -1
  43. package/lib/github/auto-approve.js +1 -1
  44. package/lib/github/auto-merge.js +1 -1
  45. package/lib/github/auto-queue.js +1 -1
  46. package/lib/github/dependabot.js +1 -1
  47. package/lib/github/dependency-review.js +1 -1
  48. package/lib/github/github-credentials.js +1 -1
  49. package/lib/github/github-project.js +1 -1
  50. package/lib/github/github.js +1 -1
  51. package/lib/github/merge-queue.js +1 -1
  52. package/lib/github/mergify.js +1 -1
  53. package/lib/github/pr-template.js +1 -1
  54. package/lib/github/pull-request-backport.js +1 -1
  55. package/lib/github/pull-request-lint.js +1 -1
  56. package/lib/github/stale.js +1 -1
  57. package/lib/github/task-workflow-job.js +1 -1
  58. package/lib/github/task-workflow.js +1 -1
  59. package/lib/github/workflow-actions.js +1 -1
  60. package/lib/github/workflow-jobs.js +1 -1
  61. package/lib/github/workflow-steps.js +1 -1
  62. package/lib/github/workflows.js +1 -1
  63. package/lib/gitlab/configuration.js +1 -1
  64. package/lib/gitlab/gitlab-configuration.js +1 -1
  65. package/lib/gitlab/nested-configuration.js +1 -1
  66. package/lib/gitpod.js +1 -1
  67. package/lib/ignore-file.js +1 -1
  68. package/lib/ini.js +1 -1
  69. package/lib/java/java-project.js +1 -1
  70. package/lib/java/junit.js +1 -1
  71. package/lib/java/maven-compile.js +1 -1
  72. package/lib/java/maven-packaging.js +1 -1
  73. package/lib/java/maven-sample.js +1 -1
  74. package/lib/java/pom.js +2 -2
  75. package/lib/java/projenrc.js +1 -1
  76. package/lib/javascript/biome/biome.js +1 -1
  77. package/lib/javascript/bundler.js +1 -1
  78. package/lib/javascript/eslint.js +1 -1
  79. package/lib/javascript/jest.js +4 -4
  80. package/lib/javascript/license-checker.js +1 -1
  81. package/lib/javascript/node-package.js +1 -1
  82. package/lib/javascript/node-project.js +1 -1
  83. package/lib/javascript/npm-config.js +1 -1
  84. package/lib/javascript/prettier.js +1 -1
  85. package/lib/javascript/projenrc.js +1 -1
  86. package/lib/javascript/typescript-config.js +2 -2
  87. package/lib/javascript/upgrade-dependencies.js +2 -2
  88. package/lib/javascript/yarnrc.js +1 -1
  89. package/lib/json-patch.js +1 -1
  90. package/lib/json.js +1 -1
  91. package/lib/license.js +1 -1
  92. package/lib/logger.js +1 -1
  93. package/lib/makefile.js +1 -1
  94. package/lib/object-file.js +1 -1
  95. package/lib/project-build.js +1 -1
  96. package/lib/project-tree.js +1 -1
  97. package/lib/project.js +1 -1
  98. package/lib/projects.js +1 -1
  99. package/lib/projenrc-json.js +2 -2
  100. package/lib/projenrc.js +1 -1
  101. package/lib/python/pip.js +1 -1
  102. package/lib/python/poetry.js +2 -2
  103. package/lib/python/projenrc.js +1 -1
  104. package/lib/python/pyproject-toml-file.js +1 -1
  105. package/lib/python/pytest-sample.js +1 -1
  106. package/lib/python/pytest.js +1 -1
  107. package/lib/python/python-project.js +1 -1
  108. package/lib/python/python-sample.js +1 -1
  109. package/lib/python/requirements-file.js +1 -1
  110. package/lib/python/setuppy.js +1 -1
  111. package/lib/python/setuptools.js +1 -1
  112. package/lib/python/uv.js +1 -1
  113. package/lib/python/venv.js +1 -1
  114. package/lib/readme.js +1 -1
  115. package/lib/release/publisher.js +1 -1
  116. package/lib/release/release-trigger.js +1 -1
  117. package/lib/release/release.js +1 -1
  118. package/lib/renovatebot.js +1 -1
  119. package/lib/sample-file.js +2 -2
  120. package/lib/semver.js +1 -1
  121. package/lib/source-code.js +1 -1
  122. package/lib/task-runtime.js +1 -1
  123. package/lib/task.js +1 -1
  124. package/lib/tasks.js +1 -1
  125. package/lib/testing.js +1 -1
  126. package/lib/textfile.js +1 -1
  127. package/lib/toml.js +1 -1
  128. package/lib/typescript/projenrc-ts.js +1 -1
  129. package/lib/typescript/projenrc.js +1 -1
  130. package/lib/typescript/typescript-typedoc.js +1 -1
  131. package/lib/typescript/typescript.js +6 -6
  132. package/lib/version.js +2 -2
  133. package/lib/vscode/devcontainer.js +1 -1
  134. package/lib/vscode/extensions.js +1 -1
  135. package/lib/vscode/launch-config.js +1 -1
  136. package/lib/vscode/settings.js +1 -1
  137. package/lib/vscode/vscode.js +1 -1
  138. package/lib/web/next.js +3 -3
  139. package/lib/web/postcss.js +1 -1
  140. package/lib/web/react.js +4 -4
  141. package/lib/web/tailwind.js +1 -1
  142. package/lib/xmlfile.js +1 -1
  143. package/lib/yaml.js +1 -1
  144. package/node_modules/{shelljs/node_modules/cross-spawn → cross-spawn}/README.md +10 -15
  145. package/node_modules/{shelljs/node_modules/cross-spawn → cross-spawn}/lib/enoent.js +1 -1
  146. package/node_modules/{shelljs/node_modules/cross-spawn → cross-spawn}/lib/parse.js +1 -35
  147. package/node_modules/{shelljs/node_modules/cross-spawn → cross-spawn}/lib/util/readShebang.js +1 -10
  148. package/node_modules/{shelljs/node_modules/cross-spawn → cross-spawn}/lib/util/resolveCommand.js +4 -3
  149. package/node_modules/{shelljs/node_modules/cross-spawn → cross-spawn}/package.json +23 -25
  150. package/node_modules/execa/index.d.ts +564 -0
  151. package/node_modules/execa/index.js +268 -0
  152. package/node_modules/execa/lib/command.js +52 -0
  153. package/node_modules/execa/lib/error.js +88 -0
  154. package/node_modules/execa/lib/kill.js +115 -0
  155. package/node_modules/execa/lib/promise.js +46 -0
  156. package/node_modules/execa/lib/stdio.js +52 -0
  157. package/node_modules/execa/lib/stream.js +97 -0
  158. package/node_modules/execa/license +9 -0
  159. package/node_modules/execa/package.json +74 -0
  160. package/node_modules/execa/readme.md +663 -0
  161. package/node_modules/fastq/README.md +0 -2
  162. package/node_modules/fastq/eslint.config.js +11 -0
  163. package/node_modules/fastq/example.mjs +0 -2
  164. package/node_modules/fastq/index.d.ts +2 -0
  165. package/node_modules/fastq/package.json +5 -9
  166. package/node_modules/fastq/queue.js +36 -1
  167. package/node_modules/fastq/test/promise.js +34 -0
  168. package/node_modules/fastq/test/test.js +80 -0
  169. package/node_modules/get-stream/buffer-stream.js +52 -0
  170. package/node_modules/get-stream/index.d.ts +105 -0
  171. package/node_modules/get-stream/index.js +61 -0
  172. package/node_modules/get-stream/license +9 -0
  173. package/node_modules/{shelljs/node_modules/get-stream → get-stream}/package.json +11 -10
  174. package/node_modules/{shelljs/node_modules/get-stream → get-stream}/readme.md +19 -18
  175. package/node_modules/human-signals/LICENSE +201 -0
  176. package/node_modules/human-signals/README.md +165 -0
  177. package/node_modules/human-signals/build/src/core.js +273 -0
  178. package/node_modules/human-signals/build/src/core.js.map +1 -0
  179. package/node_modules/human-signals/build/src/main.d.ts +52 -0
  180. package/node_modules/human-signals/build/src/main.js +71 -0
  181. package/node_modules/human-signals/build/src/main.js.map +1 -0
  182. package/node_modules/human-signals/build/src/realtime.js +19 -0
  183. package/node_modules/human-signals/build/src/realtime.js.map +1 -0
  184. package/node_modules/human-signals/build/src/signals.js +35 -0
  185. package/node_modules/human-signals/build/src/signals.js.map +1 -0
  186. package/node_modules/human-signals/package.json +64 -0
  187. package/node_modules/is-stream/index.d.ts +79 -0
  188. package/node_modules/is-stream/index.js +28 -0
  189. package/node_modules/is-stream/license +9 -0
  190. package/node_modules/is-stream/package.json +42 -0
  191. package/node_modules/is-stream/readme.md +60 -0
  192. package/node_modules/js-yaml/README.md +4 -20
  193. package/node_modules/js-yaml/bin/js-yaml.js +53 -62
  194. package/node_modules/js-yaml/dist/js-yaml.js +2404 -3880
  195. package/node_modules/js-yaml/dist/js-yaml.js.map +1 -0
  196. package/node_modules/js-yaml/dist/js-yaml.min.js +33 -2
  197. package/node_modules/js-yaml/dist/js-yaml.min.js.map +1 -0
  198. package/node_modules/js-yaml/dist/js-yaml.mjs +2381 -3855
  199. package/node_modules/js-yaml/dist/js-yaml.mjs.map +1 -0
  200. package/node_modules/js-yaml/index.js +32 -35
  201. package/node_modules/js-yaml/lib/common.js +28 -37
  202. package/node_modules/js-yaml/lib/dumper.js +450 -478
  203. package/node_modules/js-yaml/lib/exception.js +23 -27
  204. package/node_modules/js-yaml/lib/index_vite_proxy.tmp.mjs +37 -0
  205. package/node_modules/js-yaml/lib/loader.js +927 -866
  206. package/node_modules/js-yaml/lib/schema/core.js +2 -4
  207. package/node_modules/js-yaml/lib/schema/default.js +2 -4
  208. package/node_modules/js-yaml/lib/schema/failsafe.js +3 -6
  209. package/node_modules/js-yaml/lib/schema/json.js +2 -4
  210. package/node_modules/js-yaml/lib/schema.js +56 -68
  211. package/node_modules/js-yaml/lib/snippet.js +47 -52
  212. package/node_modules/js-yaml/lib/type/binary.js +61 -64
  213. package/node_modules/js-yaml/lib/type/bool.js +14 -14
  214. package/node_modules/js-yaml/lib/type/float.js +47 -45
  215. package/node_modules/js-yaml/lib/type/int.js +65 -79
  216. package/node_modules/js-yaml/lib/type/map.js +4 -4
  217. package/node_modules/js-yaml/lib/type/merge.js +5 -5
  218. package/node_modules/js-yaml/lib/type/null.js +16 -16
  219. package/node_modules/js-yaml/lib/type/omap.js +22 -21
  220. package/node_modules/js-yaml/lib/type/pairs.js +24 -27
  221. package/node_modules/js-yaml/lib/type/seq.js +4 -4
  222. package/node_modules/js-yaml/lib/type/set.js +12 -12
  223. package/node_modules/js-yaml/lib/type/str.js +4 -4
  224. package/node_modules/js-yaml/lib/type/timestamp.js +53 -53
  225. package/node_modules/js-yaml/lib/type.js +30 -30
  226. package/node_modules/js-yaml/package.json +32 -21
  227. package/node_modules/{nice-try → merge-stream}/LICENSE +1 -1
  228. package/node_modules/merge-stream/README.md +78 -0
  229. package/node_modules/merge-stream/index.js +41 -0
  230. package/node_modules/merge-stream/package.json +19 -0
  231. package/node_modules/mimic-fn/index.d.ts +54 -0
  232. package/node_modules/mimic-fn/index.js +13 -0
  233. package/node_modules/mimic-fn/package.json +42 -0
  234. package/node_modules/mimic-fn/readme.md +69 -0
  235. package/node_modules/npm-run-path/index.d.ts +89 -0
  236. package/node_modules/npm-run-path/index.js +47 -0
  237. package/node_modules/npm-run-path/package.json +44 -0
  238. package/node_modules/{shelljs/node_modules/npm-run-path → npm-run-path}/readme.md +39 -5
  239. package/node_modules/onetime/index.d.ts +64 -0
  240. package/node_modules/onetime/index.js +44 -0
  241. package/node_modules/onetime/license +9 -0
  242. package/node_modules/onetime/package.json +43 -0
  243. package/node_modules/onetime/readme.md +94 -0
  244. package/node_modules/path-key/index.d.ts +40 -0
  245. package/node_modules/path-key/index.js +16 -0
  246. package/node_modules/path-key/license +9 -0
  247. package/node_modules/path-key/package.json +39 -0
  248. package/node_modules/{shelljs/node_modules/path-key → path-key}/readme.md +15 -5
  249. package/node_modules/semver/classes/range.js +11 -2
  250. package/node_modules/semver/package.json +2 -2
  251. package/node_modules/shebang-command/index.js +19 -0
  252. package/node_modules/shebang-command/license +9 -0
  253. package/node_modules/shebang-command/package.json +34 -0
  254. package/node_modules/{shelljs/node_modules/shebang-command → shebang-command}/readme.md +1 -6
  255. package/node_modules/shebang-regex/index.d.ts +22 -0
  256. package/node_modules/shebang-regex/index.js +2 -0
  257. package/node_modules/shebang-regex/license +9 -0
  258. package/node_modules/shebang-regex/package.json +35 -0
  259. package/node_modules/shebang-regex/readme.md +33 -0
  260. package/node_modules/shelljs/README.md +7 -1
  261. package/node_modules/shelljs/global.js +4 -1
  262. package/node_modules/shelljs/package.json +8 -13
  263. package/node_modules/shelljs/shell.js +9 -7
  264. package/node_modules/shelljs/src/cat.js +1 -1
  265. package/node_modules/shelljs/src/chmod.js +1 -1
  266. package/node_modules/shelljs/src/cmd.js +25 -9
  267. package/node_modules/shelljs/src/common.js +11 -8
  268. package/node_modules/shelljs/src/dirs.js +1 -1
  269. package/node_modules/shelljs/src/exec.js +6 -6
  270. package/node_modules/shelljs/src/grep.js +121 -7
  271. package/node_modules/shelljs/src/head.js +1 -1
  272. package/node_modules/shelljs/src/ls.js +1 -1
  273. package/node_modules/shelljs/src/mkdir.js +1 -1
  274. package/node_modules/shelljs/src/rm.js +1 -1
  275. package/node_modules/shelljs/src/sed.js +1 -1
  276. package/node_modules/shelljs/src/sort.js +1 -1
  277. package/node_modules/shelljs/src/tail.js +1 -1
  278. package/node_modules/shelljs/src/tempdir.js +1 -1
  279. package/node_modules/shelljs/src/test.js +1 -1
  280. package/node_modules/shelljs/src/to.js +1 -1
  281. package/node_modules/shelljs/src/toEnd.js +1 -1
  282. package/node_modules/shelljs/src/touch.js +1 -1
  283. package/node_modules/shelljs/src/uniq.js +1 -1
  284. package/node_modules/shelljs/src/which.js +1 -1
  285. package/node_modules/strip-final-newline/index.js +16 -0
  286. package/node_modules/strip-final-newline/license +9 -0
  287. package/node_modules/strip-final-newline/package.json +40 -0
  288. package/node_modules/strip-final-newline/readme.md +30 -0
  289. package/node_modules/{shelljs/node_modules/which → which}/README.md +3 -0
  290. package/node_modules/which/package.json +43 -0
  291. package/node_modules/which/which.js +125 -0
  292. package/package.json +5 -2
  293. package/node_modules/end-of-stream/LICENSE +0 -21
  294. package/node_modules/end-of-stream/README.md +0 -54
  295. package/node_modules/end-of-stream/index.js +0 -96
  296. package/node_modules/end-of-stream/package.json +0 -37
  297. package/node_modules/fastq/.github/dependabot.yml +0 -11
  298. package/node_modules/fastq/.github/workflows/ci.yml +0 -75
  299. package/node_modules/function-bind/.eslintrc +0 -21
  300. package/node_modules/function-bind/.github/FUNDING.yml +0 -12
  301. package/node_modules/function-bind/.github/SECURITY.md +0 -3
  302. package/node_modules/function-bind/.nycrc +0 -13
  303. package/node_modules/function-bind/CHANGELOG.md +0 -136
  304. package/node_modules/function-bind/LICENSE +0 -20
  305. package/node_modules/function-bind/README.md +0 -46
  306. package/node_modules/function-bind/implementation.js +0 -84
  307. package/node_modules/function-bind/index.js +0 -5
  308. package/node_modules/function-bind/package.json +0 -87
  309. package/node_modules/function-bind/test/.eslintrc +0 -9
  310. package/node_modules/function-bind/test/index.js +0 -252
  311. package/node_modules/hasown/.eslintrc +0 -5
  312. package/node_modules/hasown/.github/FUNDING.yml +0 -12
  313. package/node_modules/hasown/.nycrc +0 -13
  314. package/node_modules/hasown/CHANGELOG.md +0 -40
  315. package/node_modules/hasown/LICENSE +0 -21
  316. package/node_modules/hasown/README.md +0 -40
  317. package/node_modules/hasown/index.d.ts +0 -3
  318. package/node_modules/hasown/index.js +0 -8
  319. package/node_modules/hasown/package.json +0 -92
  320. package/node_modules/hasown/tsconfig.json +0 -6
  321. package/node_modules/interpret/LICENSE +0 -22
  322. package/node_modules/interpret/README.md +0 -187
  323. package/node_modules/interpret/index.js +0 -168
  324. package/node_modules/interpret/mjs-stub.js +0 -1
  325. package/node_modules/interpret/package.json +0 -75
  326. package/node_modules/is-core-module/.eslintrc +0 -18
  327. package/node_modules/is-core-module/.nycrc +0 -9
  328. package/node_modules/is-core-module/CHANGELOG.md +0 -218
  329. package/node_modules/is-core-module/LICENSE +0 -20
  330. package/node_modules/is-core-module/README.md +0 -40
  331. package/node_modules/is-core-module/core.json +0 -162
  332. package/node_modules/is-core-module/index.js +0 -69
  333. package/node_modules/is-core-module/package.json +0 -76
  334. package/node_modules/is-core-module/test/index.js +0 -157
  335. package/node_modules/nice-try/README.md +0 -32
  336. package/node_modules/nice-try/package.json +0 -33
  337. package/node_modules/nice-try/src/index.js +0 -12
  338. package/node_modules/once/README.md +0 -79
  339. package/node_modules/once/once.js +0 -42
  340. package/node_modules/once/package.json +0 -33
  341. package/node_modules/p-finally/index.js +0 -15
  342. package/node_modules/p-finally/license +0 -21
  343. package/node_modules/p-finally/package.json +0 -42
  344. package/node_modules/p-finally/readme.md +0 -47
  345. package/node_modules/path-parse/LICENSE +0 -21
  346. package/node_modules/path-parse/README.md +0 -42
  347. package/node_modules/path-parse/index.js +0 -75
  348. package/node_modules/path-parse/package.json +0 -33
  349. package/node_modules/pump/.github/FUNDING.yml +0 -2
  350. package/node_modules/pump/.travis.yml +0 -5
  351. package/node_modules/pump/LICENSE +0 -21
  352. package/node_modules/pump/README.md +0 -74
  353. package/node_modules/pump/SECURITY.md +0 -5
  354. package/node_modules/pump/index.js +0 -86
  355. package/node_modules/pump/package.json +0 -24
  356. package/node_modules/pump/test-browser.js +0 -66
  357. package/node_modules/pump/test-node.js +0 -53
  358. package/node_modules/rechoir/.npmignore +0 -1
  359. package/node_modules/rechoir/.travis.yml +0 -24
  360. package/node_modules/rechoir/CHANGELOG +0 -38
  361. package/node_modules/rechoir/LICENSE +0 -22
  362. package/node_modules/rechoir/README.md +0 -42
  363. package/node_modules/rechoir/index.js +0 -59
  364. package/node_modules/rechoir/lib/extension.js +0 -11
  365. package/node_modules/rechoir/lib/normalize.js +0 -15
  366. package/node_modules/rechoir/lib/register.js +0 -15
  367. package/node_modules/rechoir/package.json +0 -88
  368. package/node_modules/resolve/.editorconfig +0 -37
  369. package/node_modules/resolve/.eslintrc +0 -65
  370. package/node_modules/resolve/.github/FUNDING.yml +0 -12
  371. package/node_modules/resolve/.github/INCIDENT_RESPONSE_PROCESS.md +0 -119
  372. package/node_modules/resolve/.github/THREAT_MODEL.md +0 -74
  373. package/node_modules/resolve/LICENSE +0 -21
  374. package/node_modules/resolve/SECURITY.md +0 -11
  375. package/node_modules/resolve/async.js +0 -3
  376. package/node_modules/resolve/bin/resolve +0 -50
  377. package/node_modules/resolve/example/async.js +0 -5
  378. package/node_modules/resolve/example/sync.js +0 -3
  379. package/node_modules/resolve/index.js +0 -6
  380. package/node_modules/resolve/lib/async.js +0 -333
  381. package/node_modules/resolve/lib/caller.js +0 -8
  382. package/node_modules/resolve/lib/core.js +0 -12
  383. package/node_modules/resolve/lib/core.json +0 -162
  384. package/node_modules/resolve/lib/homedir.js +0 -24
  385. package/node_modules/resolve/lib/is-core.js +0 -5
  386. package/node_modules/resolve/lib/node-modules-paths.js +0 -45
  387. package/node_modules/resolve/lib/normalize-options.js +0 -10
  388. package/node_modules/resolve/lib/sync.js +0 -212
  389. package/node_modules/resolve/package.json +0 -75
  390. package/node_modules/resolve/readme.markdown +0 -301
  391. package/node_modules/resolve/sync.js +0 -3
  392. package/node_modules/resolve/test/core.js +0 -88
  393. package/node_modules/resolve/test/dotdot/abc/index.js +0 -2
  394. package/node_modules/resolve/test/dotdot/index.js +0 -1
  395. package/node_modules/resolve/test/dotdot.js +0 -29
  396. package/node_modules/resolve/test/faulty_basedir.js +0 -29
  397. package/node_modules/resolve/test/filter.js +0 -34
  398. package/node_modules/resolve/test/filter_sync.js +0 -33
  399. package/node_modules/resolve/test/home_paths.js +0 -127
  400. package/node_modules/resolve/test/home_paths_sync.js +0 -114
  401. package/node_modules/resolve/test/mock.js +0 -315
  402. package/node_modules/resolve/test/mock_sync.js +0 -214
  403. package/node_modules/resolve/test/module_dir/xmodules/aaa/index.js +0 -1
  404. package/node_modules/resolve/test/module_dir/ymodules/aaa/index.js +0 -1
  405. package/node_modules/resolve/test/module_dir/zmodules/bbb/main.js +0 -1
  406. package/node_modules/resolve/test/module_dir/zmodules/bbb/package.json +0 -3
  407. package/node_modules/resolve/test/module_dir.js +0 -56
  408. package/node_modules/resolve/test/node-modules-paths.js +0 -143
  409. package/node_modules/resolve/test/node_path/x/aaa/index.js +0 -1
  410. package/node_modules/resolve/test/node_path/x/ccc/index.js +0 -1
  411. package/node_modules/resolve/test/node_path/y/bbb/index.js +0 -1
  412. package/node_modules/resolve/test/node_path/y/ccc/index.js +0 -1
  413. package/node_modules/resolve/test/node_path.js +0 -70
  414. package/node_modules/resolve/test/nonstring.js +0 -9
  415. package/node_modules/resolve/test/pathfilter/deep_ref/main.js +0 -0
  416. package/node_modules/resolve/test/pathfilter.js +0 -75
  417. package/node_modules/resolve/test/precedence/aaa/index.js +0 -1
  418. package/node_modules/resolve/test/precedence/aaa/main.js +0 -1
  419. package/node_modules/resolve/test/precedence/aaa.js +0 -1
  420. package/node_modules/resolve/test/precedence/bbb/main.js +0 -1
  421. package/node_modules/resolve/test/precedence/bbb.js +0 -1
  422. package/node_modules/resolve/test/precedence.js +0 -23
  423. package/node_modules/resolve/test/resolver/baz/doom.js +0 -0
  424. package/node_modules/resolve/test/resolver/baz/package.json +0 -4
  425. package/node_modules/resolve/test/resolver/baz/quux.js +0 -1
  426. package/node_modules/resolve/test/resolver/browser_field/a.js +0 -0
  427. package/node_modules/resolve/test/resolver/browser_field/b.js +0 -0
  428. package/node_modules/resolve/test/resolver/browser_field/package.json +0 -5
  429. package/node_modules/resolve/test/resolver/cup.coffee +0 -1
  430. package/node_modules/resolve/test/resolver/dot_main/index.js +0 -1
  431. package/node_modules/resolve/test/resolver/dot_main/package.json +0 -3
  432. package/node_modules/resolve/test/resolver/dot_slash_main/index.js +0 -1
  433. package/node_modules/resolve/test/resolver/dot_slash_main/package.json +0 -3
  434. package/node_modules/resolve/test/resolver/false_main/index.js +0 -0
  435. package/node_modules/resolve/test/resolver/false_main/package.json +0 -4
  436. package/node_modules/resolve/test/resolver/foo.js +0 -1
  437. package/node_modules/resolve/test/resolver/incorrect_main/index.js +0 -2
  438. package/node_modules/resolve/test/resolver/incorrect_main/package.json +0 -3
  439. package/node_modules/resolve/test/resolver/invalid_main/package.json +0 -7
  440. package/node_modules/resolve/test/resolver/mug.coffee +0 -0
  441. package/node_modules/resolve/test/resolver/mug.js +0 -0
  442. package/node_modules/resolve/test/resolver/multirepo/lerna.json +0 -6
  443. package/node_modules/resolve/test/resolver/multirepo/package.json +0 -20
  444. package/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js +0 -35
  445. package/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json +0 -14
  446. package/node_modules/resolve/test/resolver/multirepo/packages/package-b/index.js +0 -0
  447. package/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json +0 -14
  448. package/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js +0 -26
  449. package/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json +0 -15
  450. package/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js +0 -12
  451. package/node_modules/resolve/test/resolver/other_path/lib/other-lib.js +0 -0
  452. package/node_modules/resolve/test/resolver/other_path/root.js +0 -0
  453. package/node_modules/resolve/test/resolver/quux/foo/index.js +0 -1
  454. package/node_modules/resolve/test/resolver/same_names/foo/index.js +0 -1
  455. package/node_modules/resolve/test/resolver/same_names/foo.js +0 -1
  456. package/node_modules/resolve/test/resolver/symlinked/_/node_modules/foo.js +0 -0
  457. package/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep +0 -0
  458. package/node_modules/resolve/test/resolver/symlinked/package/bar.js +0 -1
  459. package/node_modules/resolve/test/resolver/symlinked/package/package.json +0 -3
  460. package/node_modules/resolve/test/resolver/without_basedir/main.js +0 -5
  461. package/node_modules/resolve/test/resolver.js +0 -597
  462. package/node_modules/resolve/test/resolver_sync.js +0 -730
  463. package/node_modules/resolve/test/shadowed_core/node_modules/util/index.js +0 -0
  464. package/node_modules/resolve/test/shadowed_core.js +0 -54
  465. package/node_modules/resolve/test/subdirs.js +0 -13
  466. package/node_modules/resolve/test/symlinks.js +0 -176
  467. package/node_modules/shelljs/bin/shjs +0 -48
  468. package/node_modules/shelljs/node_modules/execa/index.js +0 -361
  469. package/node_modules/shelljs/node_modules/execa/lib/errname.js +0 -39
  470. package/node_modules/shelljs/node_modules/execa/lib/stdio.js +0 -41
  471. package/node_modules/shelljs/node_modules/execa/package.json +0 -69
  472. package/node_modules/shelljs/node_modules/execa/readme.md +0 -327
  473. package/node_modules/shelljs/node_modules/get-stream/buffer-stream.js +0 -51
  474. package/node_modules/shelljs/node_modules/get-stream/index.js +0 -50
  475. package/node_modules/shelljs/node_modules/is-stream/index.js +0 -21
  476. package/node_modules/shelljs/node_modules/is-stream/license +0 -21
  477. package/node_modules/shelljs/node_modules/is-stream/package.json +0 -38
  478. package/node_modules/shelljs/node_modules/is-stream/readme.md +0 -42
  479. package/node_modules/shelljs/node_modules/npm-run-path/index.js +0 -39
  480. package/node_modules/shelljs/node_modules/npm-run-path/license +0 -21
  481. package/node_modules/shelljs/node_modules/npm-run-path/package.json +0 -45
  482. package/node_modules/shelljs/node_modules/path-key/index.js +0 -13
  483. package/node_modules/shelljs/node_modules/path-key/license +0 -21
  484. package/node_modules/shelljs/node_modules/path-key/package.json +0 -39
  485. package/node_modules/shelljs/node_modules/semver/LICENSE +0 -15
  486. package/node_modules/shelljs/node_modules/semver/README.md +0 -412
  487. package/node_modules/shelljs/node_modules/semver/bin/semver +0 -160
  488. package/node_modules/shelljs/node_modules/semver/package.json +0 -38
  489. package/node_modules/shelljs/node_modules/semver/range.bnf +0 -16
  490. package/node_modules/shelljs/node_modules/semver/semver.js +0 -1525
  491. package/node_modules/shelljs/node_modules/shebang-command/index.js +0 -19
  492. package/node_modules/shelljs/node_modules/shebang-command/license +0 -21
  493. package/node_modules/shelljs/node_modules/shebang-command/package.json +0 -39
  494. package/node_modules/shelljs/node_modules/shebang-regex/index.js +0 -2
  495. package/node_modules/shelljs/node_modules/shebang-regex/license +0 -21
  496. package/node_modules/shelljs/node_modules/shebang-regex/package.json +0 -32
  497. package/node_modules/shelljs/node_modules/shebang-regex/readme.md +0 -29
  498. package/node_modules/shelljs/node_modules/which/LICENSE +0 -15
  499. package/node_modules/shelljs/node_modules/which/package.json +0 -30
  500. package/node_modules/shelljs/node_modules/which/which.js +0 -135
  501. package/node_modules/strip-eof/index.js +0 -15
  502. package/node_modules/strip-eof/license +0 -21
  503. package/node_modules/strip-eof/package.json +0 -39
  504. package/node_modules/strip-eof/readme.md +0 -28
  505. package/node_modules/supports-preserve-symlinks-flag/.eslintrc +0 -14
  506. package/node_modules/supports-preserve-symlinks-flag/.github/FUNDING.yml +0 -12
  507. package/node_modules/supports-preserve-symlinks-flag/.nycrc +0 -9
  508. package/node_modules/supports-preserve-symlinks-flag/CHANGELOG.md +0 -22
  509. package/node_modules/supports-preserve-symlinks-flag/LICENSE +0 -21
  510. package/node_modules/supports-preserve-symlinks-flag/README.md +0 -42
  511. package/node_modules/supports-preserve-symlinks-flag/browser.js +0 -3
  512. package/node_modules/supports-preserve-symlinks-flag/index.js +0 -9
  513. package/node_modules/supports-preserve-symlinks-flag/package.json +0 -70
  514. package/node_modules/supports-preserve-symlinks-flag/test/index.js +0 -29
  515. package/node_modules/wrappy/LICENSE +0 -15
  516. package/node_modules/wrappy/README.md +0 -36
  517. package/node_modules/wrappy/package.json +0 -29
  518. package/node_modules/wrappy/wrappy.js +0 -33
  519. /package/node_modules/{shelljs/node_modules/cross-spawn → cross-spawn}/LICENSE +0 -0
  520. /package/node_modules/{shelljs/node_modules/cross-spawn → cross-spawn}/index.js +0 -0
  521. /package/node_modules/{shelljs/node_modules/cross-spawn → cross-spawn}/lib/util/escape.js +0 -0
  522. /package/node_modules/{picomatch → micromatch/node_modules/picomatch}/LICENSE +0 -0
  523. /package/node_modules/{picomatch → micromatch/node_modules/picomatch}/README.md +0 -0
  524. /package/node_modules/{picomatch → micromatch/node_modules/picomatch}/index.js +0 -0
  525. /package/node_modules/{picomatch → micromatch/node_modules/picomatch}/lib/constants.js +0 -0
  526. /package/node_modules/{picomatch → micromatch/node_modules/picomatch}/lib/parse.js +0 -0
  527. /package/node_modules/{picomatch → micromatch/node_modules/picomatch}/lib/picomatch.js +0 -0
  528. /package/node_modules/{picomatch → micromatch/node_modules/picomatch}/lib/scan.js +0 -0
  529. /package/node_modules/{picomatch → micromatch/node_modules/picomatch}/lib/utils.js +0 -0
  530. /package/node_modules/{picomatch → micromatch/node_modules/picomatch}/package.json +0 -0
  531. /package/node_modules/{shelljs/node_modules/execa → mimic-fn}/license +0 -0
  532. /package/node_modules/{shelljs/node_modules/get-stream → npm-run-path}/license +0 -0
  533. /package/node_modules/{once → which}/LICENSE +0 -0
  534. /package/node_modules/{shelljs/node_modules/which/bin/which → which/bin/node-which} +0 -0
@@ -1,128 +1,124 @@
1
- 'use strict';
2
-
3
- /*eslint-disable max-len,no-use-before-define*/
4
-
5
- var common = require('./common');
6
- var YAMLException = require('./exception');
7
- var makeSnippet = require('./snippet');
8
- var DEFAULT_SCHEMA = require('./schema/default');
9
-
10
-
11
- var _hasOwnProperty = Object.prototype.hasOwnProperty;
12
-
13
-
14
- var CONTEXT_FLOW_IN = 1;
15
- var CONTEXT_FLOW_OUT = 2;
16
- var CONTEXT_BLOCK_IN = 3;
17
- var CONTEXT_BLOCK_OUT = 4;
18
-
19
-
20
- var CHOMPING_CLIP = 1;
21
- var CHOMPING_STRIP = 2;
22
- var CHOMPING_KEEP = 3;
23
-
24
-
25
- var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
26
- var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
27
- var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
28
- var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
29
- var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
30
-
31
-
32
- function _class(obj) { return Object.prototype.toString.call(obj); }
33
-
34
- function is_EOL(c) {
35
- return (c === 0x0A/* LF */) || (c === 0x0D/* CR */);
1
+ 'use strict'
2
+
3
+ const common = require('./common')
4
+ const YAMLException = require('./exception')
5
+ const makeSnippet = require('./snippet')
6
+ const DEFAULT_SCHEMA = require('./schema/default')
7
+
8
+ const _hasOwnProperty = Object.prototype.hasOwnProperty
9
+
10
+ const CONTEXT_FLOW_IN = 1
11
+ const CONTEXT_FLOW_OUT = 2
12
+ const CONTEXT_BLOCK_IN = 3
13
+ const CONTEXT_BLOCK_OUT = 4
14
+
15
+ const CHOMPING_CLIP = 1
16
+ const CHOMPING_STRIP = 2
17
+ const CHOMPING_KEEP = 3
18
+
19
+ // eslint-disable-next-line no-control-regex
20
+ const PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/
21
+ const PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/
22
+ // eslint-disable-next-line no-useless-escape
23
+ const PATTERN_FLOW_INDICATORS = /[,\[\]{}]/
24
+ // eslint-disable-next-line no-useless-escape
25
+ const PATTERN_TAG_HANDLE = /^(?:!|!!|![0-9A-Za-z-]+!)$/
26
+ // eslint-disable-next-line no-useless-escape
27
+ const PATTERN_TAG_URI = /^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i
28
+
29
+ function _class (obj) { return Object.prototype.toString.call(obj) }
30
+
31
+ function isEol (c) {
32
+ return (c === 0x0A/* LF */) || (c === 0x0D/* CR */)
36
33
  }
37
34
 
38
- function is_WHITE_SPACE(c) {
39
- return (c === 0x09/* Tab */) || (c === 0x20/* Space */);
35
+ function isWhiteSpace (c) {
36
+ return (c === 0x09/* Tab */) || (c === 0x20/* Space */)
40
37
  }
41
38
 
42
- function is_WS_OR_EOL(c) {
39
+ function isWsOrEol (c) {
43
40
  return (c === 0x09/* Tab */) ||
44
41
  (c === 0x20/* Space */) ||
45
42
  (c === 0x0A/* LF */) ||
46
- (c === 0x0D/* CR */);
43
+ (c === 0x0D/* CR */)
47
44
  }
48
45
 
49
- function is_FLOW_INDICATOR(c) {
46
+ function isFlowIndicator (c) {
50
47
  return c === 0x2C/* , */ ||
51
48
  c === 0x5B/* [ */ ||
52
49
  c === 0x5D/* ] */ ||
53
50
  c === 0x7B/* { */ ||
54
- c === 0x7D/* } */;
51
+ c === 0x7D/* } */
55
52
  }
56
53
 
57
- function fromHexCode(c) {
58
- var lc;
59
-
60
- if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
61
- return c - 0x30;
54
+ function fromHexCode (c) {
55
+ if ((c >= 0x30/* 0 */) && (c <= 0x39/* 9 */)) {
56
+ return c - 0x30
62
57
  }
63
58
 
64
- /*eslint-disable no-bitwise*/
65
- lc = c | 0x20;
59
+ const lc = c | 0x20
66
60
 
67
- if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) {
68
- return lc - 0x61 + 10;
61
+ if ((lc >= 0x61/* a */) && (lc <= 0x66/* f */)) {
62
+ return lc - 0x61 + 10
69
63
  }
70
64
 
71
- return -1;
65
+ return -1
72
66
  }
73
67
 
74
- function escapedHexLen(c) {
75
- if (c === 0x78/* x */) { return 2; }
76
- if (c === 0x75/* u */) { return 4; }
77
- if (c === 0x55/* U */) { return 8; }
78
- return 0;
68
+ function escapedHexLen (c) {
69
+ if (c === 0x78/* x */) { return 2 }
70
+ if (c === 0x75/* u */) { return 4 }
71
+ if (c === 0x55/* U */) { return 8 }
72
+ return 0
79
73
  }
80
74
 
81
- function fromDecimalCode(c) {
82
- if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
83
- return c - 0x30;
75
+ function fromDecimalCode (c) {
76
+ if ((c >= 0x30/* 0 */) && (c <= 0x39/* 9 */)) {
77
+ return c - 0x30
84
78
  }
85
79
 
86
- return -1;
80
+ return -1
87
81
  }
88
82
 
89
- function simpleEscapeSequence(c) {
90
- /* eslint-disable indent */
91
- return (c === 0x30/* 0 */) ? '\x00' :
92
- (c === 0x61/* a */) ? '\x07' :
93
- (c === 0x62/* b */) ? '\x08' :
94
- (c === 0x74/* t */) ? '\x09' :
95
- (c === 0x09/* Tab */) ? '\x09' :
96
- (c === 0x6E/* n */) ? '\x0A' :
97
- (c === 0x76/* v */) ? '\x0B' :
98
- (c === 0x66/* f */) ? '\x0C' :
99
- (c === 0x72/* r */) ? '\x0D' :
100
- (c === 0x65/* e */) ? '\x1B' :
101
- (c === 0x20/* Space */) ? ' ' :
102
- (c === 0x22/* " */) ? '\x22' :
103
- (c === 0x2F/* / */) ? '/' :
104
- (c === 0x5C/* \ */) ? '\x5C' :
105
- (c === 0x4E/* N */) ? '\x85' :
106
- (c === 0x5F/* _ */) ? '\xA0' :
107
- (c === 0x4C/* L */) ? '\u2028' :
108
- (c === 0x50/* P */) ? '\u2029' : '';
83
+ function simpleEscapeSequence (c) {
84
+ switch (c) {
85
+ case 0x30/* 0 */: return '\x00'
86
+ case 0x61/* a */: return '\x07'
87
+ case 0x62/* b */: return '\x08'
88
+ case 0x74/* t */: return '\x09'
89
+ case 0x09/* Tab */: return '\x09'
90
+ case 0x6E/* n */: return '\x0A'
91
+ case 0x76/* v */: return '\x0B'
92
+ case 0x66/* f */: return '\x0C'
93
+ case 0x72/* r */: return '\x0D'
94
+ case 0x65/* e */: return '\x1B'
95
+ case 0x20/* Space */: return ' '
96
+ case 0x22/* " */: return '\x22'
97
+ case 0x2F/* / */: return '/'
98
+ case 0x5C/* \ */: return '\x5C'
99
+ case 0x4E/* N */: return '\x85'
100
+ case 0x5F/* _ */: return '\xA0'
101
+ case 0x4C/* L */: return '\u2028'
102
+ case 0x50/* P */: return '\u2029'
103
+ default: return ''
104
+ }
109
105
  }
110
106
 
111
- function charFromCodepoint(c) {
107
+ function charFromCodepoint (c) {
112
108
  if (c <= 0xFFFF) {
113
- return String.fromCharCode(c);
109
+ return String.fromCharCode(c)
114
110
  }
115
111
  // Encode UTF-16 surrogate pair
116
112
  // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF
117
113
  return String.fromCharCode(
118
114
  ((c - 0x010000) >> 10) + 0xD800,
119
115
  ((c - 0x010000) & 0x03FF) + 0xDC00
120
- );
116
+ )
121
117
  }
122
118
 
123
119
  // set a property of a literal object, while protecting against prototype pollution,
124
120
  // see https://github.com/nodeca/js-yaml/issues/164 for more details
125
- function setProperty(object, key, value) {
121
+ function setProperty (object, key, value) {
126
122
  // used for this specific key only because Object.defineProperty is slow
127
123
  if (key === '__proto__') {
128
124
  Object.defineProperty(object, key, {
@@ -130,47 +126,50 @@ function setProperty(object, key, value) {
130
126
  enumerable: true,
131
127
  writable: true,
132
128
  value: value
133
- });
129
+ })
134
130
  } else {
135
- object[key] = value;
131
+ object[key] = value
136
132
  }
137
133
  }
138
134
 
139
- var simpleEscapeCheck = new Array(256); // integer, for fast access
140
- var simpleEscapeMap = new Array(256);
141
- for (var i = 0; i < 256; i++) {
142
- simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
143
- simpleEscapeMap[i] = simpleEscapeSequence(i);
135
+ const simpleEscapeCheck = new Array(256) // integer, for fast access
136
+ const simpleEscapeMap = new Array(256)
137
+ for (let i = 0; i < 256; i++) {
138
+ simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0
139
+ simpleEscapeMap[i] = simpleEscapeSequence(i)
144
140
  }
145
141
 
142
+ function State (input, options) {
143
+ this.input = input
146
144
 
147
- function State(input, options) {
148
- this.input = input;
149
-
150
- this.filename = options['filename'] || null;
151
- this.schema = options['schema'] || DEFAULT_SCHEMA;
152
- this.onWarning = options['onWarning'] || null;
145
+ this.filename = options['filename'] || null
146
+ this.schema = options['schema'] || DEFAULT_SCHEMA
147
+ this.onWarning = options['onWarning'] || null
153
148
  // (Hidden) Remove? makes the loader to expect YAML 1.1 documents
154
149
  // if such documents have no explicit %YAML directive
155
- this.legacy = options['legacy'] || false;
150
+ this.legacy = options['legacy'] || false
156
151
 
157
- this.json = options['json'] || false;
158
- this.listener = options['listener'] || null;
152
+ this.json = options['json'] || false
153
+ this.listener = options['listener'] || null
154
+ this.maxDepth = typeof options['maxDepth'] === 'number' ? options['maxDepth'] : 100
155
+ this.maxMergeSeqLength = typeof options['maxMergeSeqLength'] === 'number' ? options['maxMergeSeqLength'] : 20
159
156
 
160
- this.implicitTypes = this.schema.compiledImplicit;
161
- this.typeMap = this.schema.compiledTypeMap;
157
+ this.implicitTypes = this.schema.compiledImplicit
158
+ this.typeMap = this.schema.compiledTypeMap
162
159
 
163
- this.length = input.length;
164
- this.position = 0;
165
- this.line = 0;
166
- this.lineStart = 0;
167
- this.lineIndent = 0;
160
+ this.length = input.length
161
+ this.position = 0
162
+ this.line = 0
163
+ this.lineStart = 0
164
+ this.lineIndent = 0
165
+ this.depth = 0
168
166
 
169
167
  // position of first leading tab in the current line,
170
168
  // used to make sure there are no tabs in the indentation
171
- this.firstTabInLine = -1;
169
+ this.firstTabInLine = -1
172
170
 
173
- this.documents = [];
171
+ this.documents = []
172
+ this.anchorMapTransactions = []
174
173
 
175
174
  /*
176
175
  this.version;
@@ -180,164 +179,229 @@ function State(input, options) {
180
179
  this.tag;
181
180
  this.anchor;
182
181
  this.kind;
183
- this.result;*/
184
-
182
+ this.result; */
185
183
  }
186
184
 
187
-
188
- function generateError(state, message) {
189
- var mark = {
190
- name: state.filename,
191
- buffer: state.input.slice(0, -1), // omit trailing \0
185
+ function generateError (state, message) {
186
+ const mark = {
187
+ name: state.filename,
188
+ buffer: state.input.slice(0, -1), // omit trailing \0
192
189
  position: state.position,
193
- line: state.line,
194
- column: state.position - state.lineStart
195
- };
190
+ line: state.line,
191
+ column: state.position - state.lineStart
192
+ }
196
193
 
197
- mark.snippet = makeSnippet(mark);
194
+ mark.snippet = makeSnippet(mark)
198
195
 
199
- return new YAMLException(message, mark);
196
+ return new YAMLException(message, mark)
200
197
  }
201
198
 
202
- function throwError(state, message) {
203
- throw generateError(state, message);
199
+ function throwError (state, message) {
200
+ throw generateError(state, message)
204
201
  }
205
202
 
206
- function throwWarning(state, message) {
203
+ function throwWarning (state, message) {
207
204
  if (state.onWarning) {
208
- state.onWarning.call(null, generateError(state, message));
205
+ state.onWarning.call(null, generateError(state, message))
206
+ }
207
+ }
208
+
209
+ function storeAnchor (state, name, value) {
210
+ const transactions = state.anchorMapTransactions
211
+
212
+ if (transactions.length !== 0) {
213
+ const transaction = transactions[transactions.length - 1]
214
+
215
+ if (!_hasOwnProperty.call(transaction, name)) {
216
+ transaction[name] = {
217
+ existed: _hasOwnProperty.call(state.anchorMap, name),
218
+ value: state.anchorMap[name]
219
+ }
220
+ }
209
221
  }
222
+
223
+ state.anchorMap[name] = value
224
+ }
225
+
226
+ function beginAnchorTransaction (state) {
227
+ state.anchorMapTransactions.push(Object.create(null))
210
228
  }
211
229
 
230
+ function commitAnchorTransaction (state) {
231
+ const transaction = state.anchorMapTransactions.pop()
232
+ const transactions = state.anchorMapTransactions
212
233
 
213
- var directiveHandlers = {
234
+ if (transactions.length === 0) return
214
235
 
215
- YAML: function handleYamlDirective(state, name, args) {
236
+ const parent = transactions[transactions.length - 1]
237
+ const names = Object.keys(transaction)
216
238
 
217
- var match, major, minor;
239
+ for (let index = 0, length = names.length; index < length; index += 1) {
240
+ const name = names[index]
218
241
 
242
+ if (!_hasOwnProperty.call(parent, name)) {
243
+ parent[name] = transaction[name]
244
+ }
245
+ }
246
+ }
247
+
248
+ function rollbackAnchorTransaction (state) {
249
+ const transaction = state.anchorMapTransactions.pop()
250
+ const names = Object.keys(transaction)
251
+
252
+ for (let index = names.length - 1; index >= 0; index -= 1) {
253
+ const entry = transaction[names[index]]
254
+
255
+ if (entry.existed) {
256
+ state.anchorMap[names[index]] = entry.value
257
+ } else {
258
+ delete state.anchorMap[names[index]]
259
+ }
260
+ }
261
+ }
262
+
263
+ function snapshotState (state) {
264
+ return {
265
+ position: state.position,
266
+ line: state.line,
267
+ lineStart: state.lineStart,
268
+ lineIndent: state.lineIndent,
269
+ firstTabInLine: state.firstTabInLine,
270
+ tag: state.tag,
271
+ anchor: state.anchor,
272
+ kind: state.kind,
273
+ result: state.result
274
+ }
275
+ }
276
+
277
+ function restoreState (state, snapshot) {
278
+ state.position = snapshot.position
279
+ state.line = snapshot.line
280
+ state.lineStart = snapshot.lineStart
281
+ state.lineIndent = snapshot.lineIndent
282
+ state.firstTabInLine = snapshot.firstTabInLine
283
+ state.tag = snapshot.tag
284
+ state.anchor = snapshot.anchor
285
+ state.kind = snapshot.kind
286
+ state.result = snapshot.result
287
+ }
288
+
289
+ const directiveHandlers = {
290
+
291
+ YAML: function handleYamlDirective (state, name, args) {
219
292
  if (state.version !== null) {
220
- throwError(state, 'duplication of %YAML directive');
293
+ throwError(state, 'duplication of %YAML directive')
221
294
  }
222
295
 
223
296
  if (args.length !== 1) {
224
- throwError(state, 'YAML directive accepts exactly one argument');
297
+ throwError(state, 'YAML directive accepts exactly one argument')
225
298
  }
226
299
 
227
- match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
300
+ const match = /^([0-9]+)\.([0-9]+)$/.exec(args[0])
228
301
 
229
302
  if (match === null) {
230
- throwError(state, 'ill-formed argument of the YAML directive');
303
+ throwError(state, 'ill-formed argument of the YAML directive')
231
304
  }
232
305
 
233
- major = parseInt(match[1], 10);
234
- minor = parseInt(match[2], 10);
306
+ const major = parseInt(match[1], 10)
307
+ const minor = parseInt(match[2], 10)
235
308
 
236
309
  if (major !== 1) {
237
- throwError(state, 'unacceptable YAML version of the document');
310
+ throwError(state, 'unacceptable YAML version of the document')
238
311
  }
239
312
 
240
- state.version = args[0];
241
- state.checkLineBreaks = (minor < 2);
313
+ state.version = args[0]
314
+ state.checkLineBreaks = (minor < 2)
242
315
 
243
316
  if (minor !== 1 && minor !== 2) {
244
- throwWarning(state, 'unsupported YAML version of the document');
317
+ throwWarning(state, 'unsupported YAML version of the document')
245
318
  }
246
319
  },
247
320
 
248
- TAG: function handleTagDirective(state, name, args) {
249
-
250
- var handle, prefix;
321
+ TAG: function handleTagDirective (state, name, args) {
322
+ let prefix
251
323
 
252
324
  if (args.length !== 2) {
253
- throwError(state, 'TAG directive accepts exactly two arguments');
325
+ throwError(state, 'TAG directive accepts exactly two arguments')
254
326
  }
255
327
 
256
- handle = args[0];
257
- prefix = args[1];
328
+ const handle = args[0]
329
+ prefix = args[1]
258
330
 
259
331
  if (!PATTERN_TAG_HANDLE.test(handle)) {
260
- throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');
332
+ throwError(state, 'ill-formed tag handle (first argument) of the TAG directive')
261
333
  }
262
334
 
263
335
  if (_hasOwnProperty.call(state.tagMap, handle)) {
264
- throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
336
+ throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle')
265
337
  }
266
338
 
267
339
  if (!PATTERN_TAG_URI.test(prefix)) {
268
- throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');
340
+ throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive')
269
341
  }
270
342
 
271
343
  try {
272
- prefix = decodeURIComponent(prefix);
344
+ prefix = decodeURIComponent(prefix)
273
345
  } catch (err) {
274
- throwError(state, 'tag prefix is malformed: ' + prefix);
346
+ throwError(state, 'tag prefix is malformed: ' + prefix)
275
347
  }
276
348
 
277
- state.tagMap[handle] = prefix;
349
+ state.tagMap[handle] = prefix
278
350
  }
279
- };
280
-
281
-
282
- function captureSegment(state, start, end, checkJson) {
283
- var _position, _length, _character, _result;
351
+ }
284
352
 
353
+ function captureSegment (state, start, end, checkJson) {
285
354
  if (start < end) {
286
- _result = state.input.slice(start, end);
355
+ const _result = state.input.slice(start, end)
287
356
 
288
357
  if (checkJson) {
289
- for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
290
- _character = _result.charCodeAt(_position);
358
+ for (let _position = 0, _length = _result.length; _position < _length; _position += 1) {
359
+ const _character = _result.charCodeAt(_position)
291
360
  if (!(_character === 0x09 ||
292
- (0x20 <= _character && _character <= 0x10FFFF))) {
293
- throwError(state, 'expected valid JSON character');
361
+ (_character >= 0x20 && _character <= 0x10FFFF))) {
362
+ throwError(state, 'expected valid JSON character')
294
363
  }
295
364
  }
296
365
  } else if (PATTERN_NON_PRINTABLE.test(_result)) {
297
- throwError(state, 'the stream contains non-printable characters');
366
+ throwError(state, 'the stream contains non-printable characters')
298
367
  }
299
368
 
300
- state.result += _result;
369
+ state.result += _result
301
370
  }
302
371
  }
303
372
 
304
- function mergeMappings(state, destination, source, overridableKeys) {
305
- var sourceKeys, key, index, quantity;
306
-
373
+ function mergeMappings (state, destination, source, overridableKeys) {
307
374
  if (!common.isObject(source)) {
308
- throwError(state, 'cannot merge mappings; the provided source object is unacceptable');
375
+ throwError(state, 'cannot merge mappings; the provided source object is unacceptable')
309
376
  }
310
377
 
311
- sourceKeys = Object.keys(source);
378
+ const sourceKeys = Object.keys(source)
312
379
 
313
- for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
314
- key = sourceKeys[index];
380
+ for (let index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
381
+ const key = sourceKeys[index]
315
382
 
316
383
  if (!_hasOwnProperty.call(destination, key)) {
317
- setProperty(destination, key, source[key]);
318
- overridableKeys[key] = true;
384
+ setProperty(destination, key, source[key])
385
+ overridableKeys[key] = true
319
386
  }
320
387
  }
321
388
  }
322
389
 
323
- function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode,
390
+ function storeMappingPair (state, _result, overridableKeys, keyTag, keyNode, valueNode,
324
391
  startLine, startLineStart, startPos) {
325
-
326
- var index, quantity;
327
-
328
392
  // The output is a plain object here, so keys can only be strings.
329
393
  // We need to convert keyNode to a string, but doing so can hang the process
330
394
  // (deeply nested arrays that explode exponentially using aliases).
331
395
  if (Array.isArray(keyNode)) {
332
- keyNode = Array.prototype.slice.call(keyNode);
396
+ keyNode = Array.prototype.slice.call(keyNode)
333
397
 
334
- for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
398
+ for (let index = 0, quantity = keyNode.length; index < quantity; index += 1) {
335
399
  if (Array.isArray(keyNode[index])) {
336
- throwError(state, 'nested arrays are not supported inside keys');
400
+ throwError(state, 'nested arrays are not supported inside keys')
337
401
  }
338
402
 
339
403
  if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') {
340
- keyNode[index] = '[object Object]';
404
+ keyNode[index] = '[object Object]'
341
405
  }
342
406
  }
343
407
  }
@@ -346,814 +410,785 @@ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valu
346
410
  // (still use its own toString for arrays, timestamps,
347
411
  // and whatever user schema extensions happen to have @@toStringTag)
348
412
  if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') {
349
- keyNode = '[object Object]';
413
+ keyNode = '[object Object]'
350
414
  }
351
415
 
352
-
353
- keyNode = String(keyNode);
416
+ keyNode = String(keyNode)
354
417
 
355
418
  if (_result === null) {
356
- _result = {};
419
+ _result = {}
357
420
  }
358
421
 
359
422
  if (keyTag === 'tag:yaml.org,2002:merge') {
360
423
  if (Array.isArray(valueNode)) {
361
- for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
362
- mergeMappings(state, _result, valueNode[index], overridableKeys);
424
+ if (valueNode.length > state.maxMergeSeqLength) {
425
+ throwError(state, 'merge sequence length exceeded maxMergeSeqLength (' + state.maxMergeSeqLength + ')')
426
+ }
427
+ const seen = new Set()
428
+ for (let index = 0, quantity = valueNode.length; index < quantity; index += 1) {
429
+ const src = valueNode[index]
430
+ // Existing keys are not overridden on merge, so dedupe sources to
431
+ // avoid redundant work on repeated aliases.
432
+ if (seen.has(src)) continue
433
+ seen.add(src)
434
+ mergeMappings(state, _result, src, overridableKeys)
363
435
  }
364
436
  } else {
365
- mergeMappings(state, _result, valueNode, overridableKeys);
437
+ mergeMappings(state, _result, valueNode, overridableKeys)
366
438
  }
367
439
  } else {
368
440
  if (!state.json &&
369
441
  !_hasOwnProperty.call(overridableKeys, keyNode) &&
370
442
  _hasOwnProperty.call(_result, keyNode)) {
371
- state.line = startLine || state.line;
372
- state.lineStart = startLineStart || state.lineStart;
373
- state.position = startPos || state.position;
374
- throwError(state, 'duplicated mapping key');
443
+ state.line = startLine || state.line
444
+ state.lineStart = startLineStart || state.lineStart
445
+ state.position = startPos || state.position
446
+ throwError(state, 'duplicated mapping key')
375
447
  }
376
448
 
377
- setProperty(_result, keyNode, valueNode);
378
- delete overridableKeys[keyNode];
449
+ setProperty(_result, keyNode, valueNode)
450
+ delete overridableKeys[keyNode]
379
451
  }
380
452
 
381
- return _result;
453
+ return _result
382
454
  }
383
455
 
384
- function readLineBreak(state) {
385
- var ch;
386
-
387
- ch = state.input.charCodeAt(state.position);
456
+ function readLineBreak (state) {
457
+ const ch = state.input.charCodeAt(state.position)
388
458
 
389
459
  if (ch === 0x0A/* LF */) {
390
- state.position++;
460
+ state.position++
391
461
  } else if (ch === 0x0D/* CR */) {
392
- state.position++;
462
+ state.position++
393
463
  if (state.input.charCodeAt(state.position) === 0x0A/* LF */) {
394
- state.position++;
464
+ state.position++
395
465
  }
396
466
  } else {
397
- throwError(state, 'a line break is expected');
467
+ throwError(state, 'a line break is expected')
398
468
  }
399
469
 
400
- state.line += 1;
401
- state.lineStart = state.position;
402
- state.firstTabInLine = -1;
470
+ state.line += 1
471
+ state.lineStart = state.position
472
+ state.firstTabInLine = -1
403
473
  }
404
474
 
405
- function skipSeparationSpace(state, allowComments, checkIndent) {
406
- var lineBreaks = 0,
407
- ch = state.input.charCodeAt(state.position);
475
+ function skipSeparationSpace (state, allowComments, checkIndent) {
476
+ let lineBreaks = 0
477
+ let ch = state.input.charCodeAt(state.position)
408
478
 
409
479
  while (ch !== 0) {
410
- while (is_WHITE_SPACE(ch)) {
480
+ while (isWhiteSpace(ch)) {
411
481
  if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) {
412
- state.firstTabInLine = state.position;
482
+ state.firstTabInLine = state.position
413
483
  }
414
- ch = state.input.charCodeAt(++state.position);
484
+ ch = state.input.charCodeAt(++state.position)
415
485
  }
416
486
 
417
487
  if (allowComments && ch === 0x23/* # */) {
418
488
  do {
419
- ch = state.input.charCodeAt(++state.position);
420
- } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0);
489
+ ch = state.input.charCodeAt(++state.position)
490
+ } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0)
421
491
  }
422
492
 
423
- if (is_EOL(ch)) {
424
- readLineBreak(state);
493
+ if (isEol(ch)) {
494
+ readLineBreak(state)
425
495
 
426
- ch = state.input.charCodeAt(state.position);
427
- lineBreaks++;
428
- state.lineIndent = 0;
496
+ ch = state.input.charCodeAt(state.position)
497
+ lineBreaks++
498
+ state.lineIndent = 0
429
499
 
430
500
  while (ch === 0x20/* Space */) {
431
- state.lineIndent++;
432
- ch = state.input.charCodeAt(++state.position);
501
+ state.lineIndent++
502
+ ch = state.input.charCodeAt(++state.position)
433
503
  }
434
504
  } else {
435
- break;
505
+ break
436
506
  }
437
507
  }
438
508
 
439
509
  if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
440
- throwWarning(state, 'deficient indentation');
510
+ throwWarning(state, 'deficient indentation')
441
511
  }
442
512
 
443
- return lineBreaks;
513
+ return lineBreaks
444
514
  }
445
515
 
446
- function testDocumentSeparator(state) {
447
- var _position = state.position,
448
- ch;
449
-
450
- ch = state.input.charCodeAt(_position);
516
+ function testDocumentSeparator (state) {
517
+ let _position = state.position
518
+ let ch = state.input.charCodeAt(_position)
451
519
 
452
520
  // Condition state.position === state.lineStart is tested
453
521
  // in parent on each call, for efficiency. No needs to test here again.
454
522
  if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) &&
455
523
  ch === state.input.charCodeAt(_position + 1) &&
456
524
  ch === state.input.charCodeAt(_position + 2)) {
525
+ _position += 3
457
526
 
458
- _position += 3;
527
+ ch = state.input.charCodeAt(_position)
459
528
 
460
- ch = state.input.charCodeAt(_position);
461
-
462
- if (ch === 0 || is_WS_OR_EOL(ch)) {
463
- return true;
529
+ if (ch === 0 || isWsOrEol(ch)) {
530
+ return true
464
531
  }
465
532
  }
466
533
 
467
- return false;
534
+ return false
468
535
  }
469
536
 
470
- function writeFoldedLines(state, count) {
537
+ function writeFoldedLines (state, count) {
471
538
  if (count === 1) {
472
- state.result += ' ';
539
+ state.result += ' '
473
540
  } else if (count > 1) {
474
- state.result += common.repeat('\n', count - 1);
541
+ state.result += common.repeat('\n', count - 1)
475
542
  }
476
543
  }
477
544
 
478
-
479
- function readPlainScalar(state, nodeIndent, withinFlowCollection) {
480
- var preceding,
481
- following,
482
- captureStart,
483
- captureEnd,
484
- hasPendingContent,
485
- _line,
486
- _lineStart,
487
- _lineIndent,
488
- _kind = state.kind,
489
- _result = state.result,
490
- ch;
491
-
492
- ch = state.input.charCodeAt(state.position);
493
-
494
- if (is_WS_OR_EOL(ch) ||
495
- is_FLOW_INDICATOR(ch) ||
496
- ch === 0x23/* # */ ||
497
- ch === 0x26/* & */ ||
498
- ch === 0x2A/* * */ ||
499
- ch === 0x21/* ! */ ||
500
- ch === 0x7C/* | */ ||
501
- ch === 0x3E/* > */ ||
502
- ch === 0x27/* ' */ ||
503
- ch === 0x22/* " */ ||
504
- ch === 0x25/* % */ ||
505
- ch === 0x40/* @ */ ||
545
+ function readPlainScalar (state, nodeIndent, withinFlowCollection) {
546
+ let captureStart
547
+ let captureEnd
548
+ let hasPendingContent
549
+ let _line
550
+ let _lineStart
551
+ let _lineIndent
552
+ const _kind = state.kind
553
+ const _result = state.result
554
+
555
+ let ch = state.input.charCodeAt(state.position)
556
+
557
+ if (isWsOrEol(ch) ||
558
+ isFlowIndicator(ch) ||
559
+ ch === 0x23/* # */ ||
560
+ ch === 0x26/* & */ ||
561
+ ch === 0x2A/* * */ ||
562
+ ch === 0x21/* ! */ ||
563
+ ch === 0x7C/* | */ ||
564
+ ch === 0x3E/* > */ ||
565
+ ch === 0x27/* ' */ ||
566
+ ch === 0x22/* " */ ||
567
+ ch === 0x25/* % */ ||
568
+ ch === 0x40/* @ */ ||
506
569
  ch === 0x60/* ` */) {
507
- return false;
570
+ return false
508
571
  }
509
572
 
510
573
  if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) {
511
- following = state.input.charCodeAt(state.position + 1);
574
+ const following = state.input.charCodeAt(state.position + 1)
512
575
 
513
- if (is_WS_OR_EOL(following) ||
514
- withinFlowCollection && is_FLOW_INDICATOR(following)) {
515
- return false;
576
+ if (isWsOrEol(following) ||
577
+ (withinFlowCollection && isFlowIndicator(following))) {
578
+ return false
516
579
  }
517
580
  }
518
581
 
519
- state.kind = 'scalar';
520
- state.result = '';
521
- captureStart = captureEnd = state.position;
522
- hasPendingContent = false;
582
+ state.kind = 'scalar'
583
+ state.result = ''
584
+ captureStart = captureEnd = state.position
585
+ hasPendingContent = false
523
586
 
524
587
  while (ch !== 0) {
525
588
  if (ch === 0x3A/* : */) {
526
- following = state.input.charCodeAt(state.position + 1);
589
+ const following = state.input.charCodeAt(state.position + 1)
527
590
 
528
- if (is_WS_OR_EOL(following) ||
529
- withinFlowCollection && is_FLOW_INDICATOR(following)) {
530
- break;
591
+ if (isWsOrEol(following) ||
592
+ (withinFlowCollection && isFlowIndicator(following))) {
593
+ break
531
594
  }
532
-
533
595
  } else if (ch === 0x23/* # */) {
534
- preceding = state.input.charCodeAt(state.position - 1);
596
+ const preceding = state.input.charCodeAt(state.position - 1)
535
597
 
536
- if (is_WS_OR_EOL(preceding)) {
537
- break;
598
+ if (isWsOrEol(preceding)) {
599
+ break
538
600
  }
539
-
540
601
  } else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||
541
- withinFlowCollection && is_FLOW_INDICATOR(ch)) {
542
- break;
543
-
544
- } else if (is_EOL(ch)) {
545
- _line = state.line;
546
- _lineStart = state.lineStart;
547
- _lineIndent = state.lineIndent;
548
- skipSeparationSpace(state, false, -1);
602
+ (withinFlowCollection && isFlowIndicator(ch))) {
603
+ break
604
+ } else if (isEol(ch)) {
605
+ _line = state.line
606
+ _lineStart = state.lineStart
607
+ _lineIndent = state.lineIndent
608
+ skipSeparationSpace(state, false, -1)
549
609
 
550
610
  if (state.lineIndent >= nodeIndent) {
551
- hasPendingContent = true;
552
- ch = state.input.charCodeAt(state.position);
553
- continue;
611
+ hasPendingContent = true
612
+ ch = state.input.charCodeAt(state.position)
613
+ continue
554
614
  } else {
555
- state.position = captureEnd;
556
- state.line = _line;
557
- state.lineStart = _lineStart;
558
- state.lineIndent = _lineIndent;
559
- break;
615
+ state.position = captureEnd
616
+ state.line = _line
617
+ state.lineStart = _lineStart
618
+ state.lineIndent = _lineIndent
619
+ break
560
620
  }
561
621
  }
562
622
 
563
623
  if (hasPendingContent) {
564
- captureSegment(state, captureStart, captureEnd, false);
565
- writeFoldedLines(state, state.line - _line);
566
- captureStart = captureEnd = state.position;
567
- hasPendingContent = false;
624
+ captureSegment(state, captureStart, captureEnd, false)
625
+ writeFoldedLines(state, state.line - _line)
626
+ captureStart = captureEnd = state.position
627
+ hasPendingContent = false
568
628
  }
569
629
 
570
- if (!is_WHITE_SPACE(ch)) {
571
- captureEnd = state.position + 1;
630
+ if (!isWhiteSpace(ch)) {
631
+ captureEnd = state.position + 1
572
632
  }
573
633
 
574
- ch = state.input.charCodeAt(++state.position);
634
+ ch = state.input.charCodeAt(++state.position)
575
635
  }
576
636
 
577
- captureSegment(state, captureStart, captureEnd, false);
637
+ captureSegment(state, captureStart, captureEnd, false)
578
638
 
579
639
  if (state.result) {
580
- return true;
640
+ return true
581
641
  }
582
642
 
583
- state.kind = _kind;
584
- state.result = _result;
585
- return false;
643
+ state.kind = _kind
644
+ state.result = _result
645
+ return false
586
646
  }
587
647
 
588
- function readSingleQuotedScalar(state, nodeIndent) {
589
- var ch,
590
- captureStart, captureEnd;
648
+ function readSingleQuotedScalar (state, nodeIndent) {
649
+ let captureStart
650
+ let captureEnd
591
651
 
592
- ch = state.input.charCodeAt(state.position);
652
+ let ch = state.input.charCodeAt(state.position)
593
653
 
594
654
  if (ch !== 0x27/* ' */) {
595
- return false;
655
+ return false
596
656
  }
597
657
 
598
- state.kind = 'scalar';
599
- state.result = '';
600
- state.position++;
601
- captureStart = captureEnd = state.position;
658
+ state.kind = 'scalar'
659
+ state.result = ''
660
+ state.position++
661
+ captureStart = captureEnd = state.position
602
662
 
603
663
  while ((ch = state.input.charCodeAt(state.position)) !== 0) {
604
664
  if (ch === 0x27/* ' */) {
605
- captureSegment(state, captureStart, state.position, true);
606
- ch = state.input.charCodeAt(++state.position);
665
+ captureSegment(state, captureStart, state.position, true)
666
+ ch = state.input.charCodeAt(++state.position)
607
667
 
608
668
  if (ch === 0x27/* ' */) {
609
- captureStart = state.position;
610
- state.position++;
611
- captureEnd = state.position;
669
+ captureStart = state.position
670
+ state.position++
671
+ captureEnd = state.position
612
672
  } else {
613
- return true;
673
+ return true
614
674
  }
615
-
616
- } else if (is_EOL(ch)) {
617
- captureSegment(state, captureStart, captureEnd, true);
618
- writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
619
- captureStart = captureEnd = state.position;
620
-
675
+ } else if (isEol(ch)) {
676
+ captureSegment(state, captureStart, captureEnd, true)
677
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent))
678
+ captureStart = captureEnd = state.position
621
679
  } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
622
- throwError(state, 'unexpected end of the document within a single quoted scalar');
623
-
680
+ throwError(state, 'unexpected end of the document within a single quoted scalar')
624
681
  } else {
625
- state.position++;
626
- captureEnd = state.position;
682
+ state.position++
683
+ if (!isWhiteSpace(ch)) {
684
+ captureEnd = state.position
685
+ }
627
686
  }
628
687
  }
629
688
 
630
- throwError(state, 'unexpected end of the stream within a single quoted scalar');
689
+ throwError(state, 'unexpected end of the stream within a single quoted scalar')
631
690
  }
632
691
 
633
- function readDoubleQuotedScalar(state, nodeIndent) {
634
- var captureStart,
635
- captureEnd,
636
- hexLength,
637
- hexResult,
638
- tmp,
639
- ch;
692
+ function readDoubleQuotedScalar (state, nodeIndent) {
693
+ let captureStart
694
+ let captureEnd
695
+ let tmp
640
696
 
641
- ch = state.input.charCodeAt(state.position);
697
+ let ch = state.input.charCodeAt(state.position)
642
698
 
643
699
  if (ch !== 0x22/* " */) {
644
- return false;
700
+ return false
645
701
  }
646
702
 
647
- state.kind = 'scalar';
648
- state.result = '';
649
- state.position++;
650
- captureStart = captureEnd = state.position;
703
+ state.kind = 'scalar'
704
+ state.result = ''
705
+ state.position++
706
+ captureStart = captureEnd = state.position
651
707
 
652
708
  while ((ch = state.input.charCodeAt(state.position)) !== 0) {
653
709
  if (ch === 0x22/* " */) {
654
- captureSegment(state, captureStart, state.position, true);
655
- state.position++;
656
- return true;
657
-
710
+ captureSegment(state, captureStart, state.position, true)
711
+ state.position++
712
+ return true
658
713
  } else if (ch === 0x5C/* \ */) {
659
- captureSegment(state, captureStart, state.position, true);
660
- ch = state.input.charCodeAt(++state.position);
714
+ captureSegment(state, captureStart, state.position, true)
715
+ ch = state.input.charCodeAt(++state.position)
661
716
 
662
- if (is_EOL(ch)) {
663
- skipSeparationSpace(state, false, nodeIndent);
717
+ if (isEol(ch)) {
718
+ skipSeparationSpace(state, false, nodeIndent)
664
719
 
665
720
  // TODO: rework to inline fn with no type cast?
666
721
  } else if (ch < 256 && simpleEscapeCheck[ch]) {
667
- state.result += simpleEscapeMap[ch];
668
- state.position++;
669
-
722
+ state.result += simpleEscapeMap[ch]
723
+ state.position++
670
724
  } else if ((tmp = escapedHexLen(ch)) > 0) {
671
- hexLength = tmp;
672
- hexResult = 0;
725
+ let hexLength = tmp
726
+ let hexResult = 0
673
727
 
674
728
  for (; hexLength > 0; hexLength--) {
675
- ch = state.input.charCodeAt(++state.position);
729
+ ch = state.input.charCodeAt(++state.position)
676
730
 
677
731
  if ((tmp = fromHexCode(ch)) >= 0) {
678
- hexResult = (hexResult << 4) + tmp;
679
-
732
+ hexResult = (hexResult << 4) + tmp
680
733
  } else {
681
- throwError(state, 'expected hexadecimal character');
734
+ throwError(state, 'expected hexadecimal character')
682
735
  }
683
736
  }
684
737
 
685
- state.result += charFromCodepoint(hexResult);
686
-
687
- state.position++;
738
+ state.result += charFromCodepoint(hexResult)
688
739
 
740
+ state.position++
689
741
  } else {
690
- throwError(state, 'unknown escape sequence');
742
+ throwError(state, 'unknown escape sequence')
691
743
  }
692
744
 
693
- captureStart = captureEnd = state.position;
694
-
695
- } else if (is_EOL(ch)) {
696
- captureSegment(state, captureStart, captureEnd, true);
697
- writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
698
- captureStart = captureEnd = state.position;
699
-
745
+ captureStart = captureEnd = state.position
746
+ } else if (isEol(ch)) {
747
+ captureSegment(state, captureStart, captureEnd, true)
748
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent))
749
+ captureStart = captureEnd = state.position
700
750
  } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
701
- throwError(state, 'unexpected end of the document within a double quoted scalar');
702
-
751
+ throwError(state, 'unexpected end of the document within a double quoted scalar')
703
752
  } else {
704
- state.position++;
705
- captureEnd = state.position;
753
+ state.position++
754
+ if (!isWhiteSpace(ch)) {
755
+ captureEnd = state.position
756
+ }
706
757
  }
707
758
  }
708
759
 
709
- throwError(state, 'unexpected end of the stream within a double quoted scalar');
760
+ throwError(state, 'unexpected end of the stream within a double quoted scalar')
710
761
  }
711
762
 
712
- function readFlowCollection(state, nodeIndent) {
713
- var readNext = true,
714
- _line,
715
- _lineStart,
716
- _pos,
717
- _tag = state.tag,
718
- _result,
719
- _anchor = state.anchor,
720
- following,
721
- terminator,
722
- isPair,
723
- isExplicitPair,
724
- isMapping,
725
- overridableKeys = Object.create(null),
726
- keyNode,
727
- keyTag,
728
- valueNode,
729
- ch;
730
-
731
- ch = state.input.charCodeAt(state.position);
763
+ function readFlowCollection (state, nodeIndent) {
764
+ let readNext = true
765
+ let _line
766
+ let _lineStart
767
+ let _pos
768
+ const _tag = state.tag
769
+ let _result
770
+ const _anchor = state.anchor
771
+ let terminator
772
+ let isPair
773
+ let isExplicitPair
774
+ let isMapping
775
+ const overridableKeys = Object.create(null)
776
+ let keyNode
777
+ let keyTag
778
+ let valueNode
779
+
780
+ let ch = state.input.charCodeAt(state.position)
732
781
 
733
782
  if (ch === 0x5B/* [ */) {
734
- terminator = 0x5D;/* ] */
735
- isMapping = false;
736
- _result = [];
783
+ terminator = 0x5D/* ] */
784
+ isMapping = false
785
+ _result = []
737
786
  } else if (ch === 0x7B/* { */) {
738
- terminator = 0x7D;/* } */
739
- isMapping = true;
740
- _result = {};
787
+ terminator = 0x7D/* } */
788
+ isMapping = true
789
+ _result = {}
741
790
  } else {
742
- return false;
791
+ return false
743
792
  }
744
793
 
745
794
  if (state.anchor !== null) {
746
- state.anchorMap[state.anchor] = _result;
795
+ storeAnchor(state, state.anchor, _result)
747
796
  }
748
797
 
749
- ch = state.input.charCodeAt(++state.position);
798
+ ch = state.input.charCodeAt(++state.position)
750
799
 
751
800
  while (ch !== 0) {
752
- skipSeparationSpace(state, true, nodeIndent);
801
+ skipSeparationSpace(state, true, nodeIndent)
753
802
 
754
- ch = state.input.charCodeAt(state.position);
803
+ ch = state.input.charCodeAt(state.position)
755
804
 
756
805
  if (ch === terminator) {
757
- state.position++;
758
- state.tag = _tag;
759
- state.anchor = _anchor;
760
- state.kind = isMapping ? 'mapping' : 'sequence';
761
- state.result = _result;
762
- return true;
806
+ state.position++
807
+ state.tag = _tag
808
+ state.anchor = _anchor
809
+ state.kind = isMapping ? 'mapping' : 'sequence'
810
+ state.result = _result
811
+ return true
763
812
  } else if (!readNext) {
764
- throwError(state, 'missed comma between flow collection entries');
813
+ throwError(state, 'missed comma between flow collection entries')
765
814
  } else if (ch === 0x2C/* , */) {
766
815
  // "flow collection entries can never be completely empty", as per YAML 1.2, section 7.4
767
- throwError(state, "expected the node content, but found ','");
816
+ throwError(state, "expected the node content, but found ','")
768
817
  }
769
818
 
770
- keyTag = keyNode = valueNode = null;
771
- isPair = isExplicitPair = false;
819
+ keyTag = keyNode = valueNode = null
820
+ isPair = isExplicitPair = false
772
821
 
773
822
  if (ch === 0x3F/* ? */) {
774
- following = state.input.charCodeAt(state.position + 1);
823
+ const following = state.input.charCodeAt(state.position + 1)
775
824
 
776
- if (is_WS_OR_EOL(following)) {
777
- isPair = isExplicitPair = true;
778
- state.position++;
779
- skipSeparationSpace(state, true, nodeIndent);
825
+ if (isWsOrEol(following)) {
826
+ isPair = isExplicitPair = true
827
+ state.position++
828
+ skipSeparationSpace(state, true, nodeIndent)
780
829
  }
781
830
  }
782
831
 
783
- _line = state.line; // Save the current line.
784
- _lineStart = state.lineStart;
785
- _pos = state.position;
786
- composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
787
- keyTag = state.tag;
788
- keyNode = state.result;
789
- skipSeparationSpace(state, true, nodeIndent);
832
+ _line = state.line // Save the current line.
833
+ _lineStart = state.lineStart
834
+ _pos = state.position
835
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true)
836
+ keyTag = state.tag
837
+ keyNode = state.result
838
+ skipSeparationSpace(state, true, nodeIndent)
790
839
 
791
- ch = state.input.charCodeAt(state.position);
840
+ ch = state.input.charCodeAt(state.position)
792
841
 
793
842
  if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) {
794
- isPair = true;
795
- ch = state.input.charCodeAt(++state.position);
796
- skipSeparationSpace(state, true, nodeIndent);
797
- composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
798
- valueNode = state.result;
843
+ isPair = true
844
+ ch = state.input.charCodeAt(++state.position)
845
+ skipSeparationSpace(state, true, nodeIndent)
846
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true)
847
+ valueNode = state.result
799
848
  }
800
849
 
801
850
  if (isMapping) {
802
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
851
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos)
803
852
  } else if (isPair) {
804
- _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
853
+ _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos))
805
854
  } else {
806
- _result.push(keyNode);
855
+ _result.push(keyNode)
807
856
  }
808
857
 
809
- skipSeparationSpace(state, true, nodeIndent);
858
+ skipSeparationSpace(state, true, nodeIndent)
810
859
 
811
- ch = state.input.charCodeAt(state.position);
860
+ ch = state.input.charCodeAt(state.position)
812
861
 
813
862
  if (ch === 0x2C/* , */) {
814
- readNext = true;
815
- ch = state.input.charCodeAt(++state.position);
863
+ readNext = true
864
+ ch = state.input.charCodeAt(++state.position)
816
865
  } else {
817
- readNext = false;
866
+ readNext = false
818
867
  }
819
868
  }
820
869
 
821
- throwError(state, 'unexpected end of the stream within a flow collection');
870
+ throwError(state, 'unexpected end of the stream within a flow collection')
822
871
  }
823
872
 
824
- function readBlockScalar(state, nodeIndent) {
825
- var captureStart,
826
- folding,
827
- chomping = CHOMPING_CLIP,
828
- didReadContent = false,
829
- detectedIndent = false,
830
- textIndent = nodeIndent,
831
- emptyLines = 0,
832
- atMoreIndented = false,
833
- tmp,
834
- ch;
873
+ function readBlockScalar (state, nodeIndent) {
874
+ let folding
875
+ let chomping = CHOMPING_CLIP
876
+ let didReadContent = false
877
+ let detectedIndent = false
878
+ let textIndent = nodeIndent
879
+ let emptyLines = 0
880
+ let atMoreIndented = false
881
+ let tmp
835
882
 
836
- ch = state.input.charCodeAt(state.position);
883
+ let ch = state.input.charCodeAt(state.position)
837
884
 
838
885
  if (ch === 0x7C/* | */) {
839
- folding = false;
886
+ folding = false
840
887
  } else if (ch === 0x3E/* > */) {
841
- folding = true;
888
+ folding = true
842
889
  } else {
843
- return false;
890
+ return false
844
891
  }
845
892
 
846
- state.kind = 'scalar';
847
- state.result = '';
893
+ state.kind = 'scalar'
894
+ state.result = ''
848
895
 
849
896
  while (ch !== 0) {
850
- ch = state.input.charCodeAt(++state.position);
897
+ ch = state.input.charCodeAt(++state.position)
851
898
 
852
899
  if (ch === 0x2B/* + */ || ch === 0x2D/* - */) {
853
900
  if (CHOMPING_CLIP === chomping) {
854
- chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP;
901
+ chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP
855
902
  } else {
856
- throwError(state, 'repeat of a chomping mode identifier');
903
+ throwError(state, 'repeat of a chomping mode identifier')
857
904
  }
858
-
859
905
  } else if ((tmp = fromDecimalCode(ch)) >= 0) {
860
906
  if (tmp === 0) {
861
- throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');
907
+ throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one')
862
908
  } else if (!detectedIndent) {
863
- textIndent = nodeIndent + tmp - 1;
864
- detectedIndent = true;
909
+ textIndent = nodeIndent + tmp - 1
910
+ detectedIndent = true
865
911
  } else {
866
- throwError(state, 'repeat of an indentation width identifier');
912
+ throwError(state, 'repeat of an indentation width identifier')
867
913
  }
868
-
869
914
  } else {
870
- break;
915
+ break
871
916
  }
872
917
  }
873
918
 
874
- if (is_WHITE_SPACE(ch)) {
875
- do { ch = state.input.charCodeAt(++state.position); }
876
- while (is_WHITE_SPACE(ch));
919
+ if (isWhiteSpace(ch)) {
920
+ do { ch = state.input.charCodeAt(++state.position) }
921
+ while (isWhiteSpace(ch))
877
922
 
878
923
  if (ch === 0x23/* # */) {
879
- do { ch = state.input.charCodeAt(++state.position); }
880
- while (!is_EOL(ch) && (ch !== 0));
924
+ do { ch = state.input.charCodeAt(++state.position) }
925
+ while (!isEol(ch) && (ch !== 0))
881
926
  }
882
927
  }
883
928
 
884
929
  while (ch !== 0) {
885
- readLineBreak(state);
886
- state.lineIndent = 0;
930
+ readLineBreak(state)
931
+ state.lineIndent = 0
887
932
 
888
- ch = state.input.charCodeAt(state.position);
933
+ ch = state.input.charCodeAt(state.position)
889
934
 
935
+ // eslint-disable-next-line no-unmodified-loop-condition
890
936
  while ((!detectedIndent || state.lineIndent < textIndent) &&
891
937
  (ch === 0x20/* Space */)) {
892
- state.lineIndent++;
893
- ch = state.input.charCodeAt(++state.position);
938
+ state.lineIndent++
939
+ ch = state.input.charCodeAt(++state.position)
894
940
  }
895
941
 
896
942
  if (!detectedIndent && state.lineIndent > textIndent) {
897
- textIndent = state.lineIndent;
943
+ textIndent = state.lineIndent
944
+ }
945
+
946
+ if (isEol(ch)) {
947
+ emptyLines++
948
+ continue
898
949
  }
899
950
 
900
- if (is_EOL(ch)) {
901
- emptyLines++;
902
- continue;
951
+ if (!detectedIndent && textIndent === 0) {
952
+ throwError(state, 'missing indentation for block scalar')
903
953
  }
904
954
 
905
955
  // End of the scalar.
906
956
  if (state.lineIndent < textIndent) {
907
-
908
957
  // Perform the chomping.
909
958
  if (chomping === CHOMPING_KEEP) {
910
- state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
959
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines)
911
960
  } else if (chomping === CHOMPING_CLIP) {
912
961
  if (didReadContent) { // i.e. only if the scalar is not empty.
913
- state.result += '\n';
962
+ state.result += '\n'
914
963
  }
915
964
  }
916
965
 
917
966
  // Break this `while` cycle and go to the funciton's epilogue.
918
- break;
967
+ break
919
968
  }
920
969
 
921
970
  // Folded style: use fancy rules to handle line breaks.
922
971
  if (folding) {
923
-
924
972
  // Lines starting with white space characters (more-indented lines) are not folded.
925
- if (is_WHITE_SPACE(ch)) {
926
- atMoreIndented = true;
973
+ if (isWhiteSpace(ch)) {
974
+ atMoreIndented = true
927
975
  // except for the first content line (cf. Example 8.1)
928
- state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
976
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines)
929
977
 
930
978
  // End of more-indented block.
931
979
  } else if (atMoreIndented) {
932
- atMoreIndented = false;
933
- state.result += common.repeat('\n', emptyLines + 1);
980
+ atMoreIndented = false
981
+ state.result += common.repeat('\n', emptyLines + 1)
934
982
 
935
983
  // Just one line break - perceive as the same line.
936
984
  } else if (emptyLines === 0) {
937
985
  if (didReadContent) { // i.e. only if we have already read some scalar content.
938
- state.result += ' ';
986
+ state.result += ' '
939
987
  }
940
988
 
941
989
  // Several line breaks - perceive as different lines.
942
990
  } else {
943
- state.result += common.repeat('\n', emptyLines);
991
+ state.result += common.repeat('\n', emptyLines)
944
992
  }
945
993
 
946
994
  // Literal style: just add exact number of line breaks between content lines.
947
995
  } else {
948
996
  // Keep all line breaks except the header line break.
949
- state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
997
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines)
950
998
  }
951
999
 
952
- didReadContent = true;
953
- detectedIndent = true;
954
- emptyLines = 0;
955
- captureStart = state.position;
1000
+ didReadContent = true
1001
+ detectedIndent = true
1002
+ emptyLines = 0
1003
+ const captureStart = state.position
956
1004
 
957
- while (!is_EOL(ch) && (ch !== 0)) {
958
- ch = state.input.charCodeAt(++state.position);
1005
+ while (!isEol(ch) && (ch !== 0)) {
1006
+ ch = state.input.charCodeAt(++state.position)
959
1007
  }
960
1008
 
961
- captureSegment(state, captureStart, state.position, false);
1009
+ captureSegment(state, captureStart, state.position, false)
962
1010
  }
963
1011
 
964
- return true;
1012
+ return true
965
1013
  }
966
1014
 
967
- function readBlockSequence(state, nodeIndent) {
968
- var _line,
969
- _tag = state.tag,
970
- _anchor = state.anchor,
971
- _result = [],
972
- following,
973
- detected = false,
974
- ch;
1015
+ function readBlockSequence (state, nodeIndent) {
1016
+ const _tag = state.tag
1017
+ const _anchor = state.anchor
1018
+ const _result = []
1019
+ let detected = false
975
1020
 
976
1021
  // there is a leading tab before this token, so it can't be a block sequence/mapping;
977
1022
  // it can still be flow sequence/mapping or a scalar
978
- if (state.firstTabInLine !== -1) return false;
1023
+ if (state.firstTabInLine !== -1) return false
979
1024
 
980
1025
  if (state.anchor !== null) {
981
- state.anchorMap[state.anchor] = _result;
1026
+ storeAnchor(state, state.anchor, _result)
982
1027
  }
983
1028
 
984
- ch = state.input.charCodeAt(state.position);
1029
+ let ch = state.input.charCodeAt(state.position)
985
1030
 
986
1031
  while (ch !== 0) {
987
1032
  if (state.firstTabInLine !== -1) {
988
- state.position = state.firstTabInLine;
989
- throwError(state, 'tab characters must not be used in indentation');
1033
+ state.position = state.firstTabInLine
1034
+ throwError(state, 'tab characters must not be used in indentation')
990
1035
  }
991
1036
 
992
1037
  if (ch !== 0x2D/* - */) {
993
- break;
1038
+ break
994
1039
  }
995
1040
 
996
- following = state.input.charCodeAt(state.position + 1);
1041
+ const following = state.input.charCodeAt(state.position + 1)
997
1042
 
998
- if (!is_WS_OR_EOL(following)) {
999
- break;
1043
+ if (!isWsOrEol(following)) {
1044
+ break
1000
1045
  }
1001
1046
 
1002
- detected = true;
1003
- state.position++;
1047
+ detected = true
1048
+ state.position++
1004
1049
 
1005
1050
  if (skipSeparationSpace(state, true, -1)) {
1006
1051
  if (state.lineIndent <= nodeIndent) {
1007
- _result.push(null);
1008
- ch = state.input.charCodeAt(state.position);
1009
- continue;
1052
+ _result.push(null)
1053
+ ch = state.input.charCodeAt(state.position)
1054
+ continue
1010
1055
  }
1011
1056
  }
1012
1057
 
1013
- _line = state.line;
1014
- composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
1015
- _result.push(state.result);
1016
- skipSeparationSpace(state, true, -1);
1058
+ const _line = state.line
1059
+ composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true)
1060
+ _result.push(state.result)
1061
+ skipSeparationSpace(state, true, -1)
1017
1062
 
1018
- ch = state.input.charCodeAt(state.position);
1063
+ ch = state.input.charCodeAt(state.position)
1019
1064
 
1020
1065
  if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
1021
- throwError(state, 'bad indentation of a sequence entry');
1066
+ throwError(state, 'bad indentation of a sequence entry')
1022
1067
  } else if (state.lineIndent < nodeIndent) {
1023
- break;
1068
+ break
1024
1069
  }
1025
1070
  }
1026
1071
 
1027
1072
  if (detected) {
1028
- state.tag = _tag;
1029
- state.anchor = _anchor;
1030
- state.kind = 'sequence';
1031
- state.result = _result;
1032
- return true;
1073
+ state.tag = _tag
1074
+ state.anchor = _anchor
1075
+ state.kind = 'sequence'
1076
+ state.result = _result
1077
+ return true
1033
1078
  }
1034
- return false;
1079
+ return false
1035
1080
  }
1036
1081
 
1037
- function readBlockMapping(state, nodeIndent, flowIndent) {
1038
- var following,
1039
- allowCompact,
1040
- _line,
1041
- _keyLine,
1042
- _keyLineStart,
1043
- _keyPos,
1044
- _tag = state.tag,
1045
- _anchor = state.anchor,
1046
- _result = {},
1047
- overridableKeys = Object.create(null),
1048
- keyTag = null,
1049
- keyNode = null,
1050
- valueNode = null,
1051
- atExplicitKey = false,
1052
- detected = false,
1053
- ch;
1082
+ function readBlockMapping (state, nodeIndent, flowIndent) {
1083
+ let allowCompact
1084
+ let _keyLine
1085
+ let _keyLineStart
1086
+ let _keyPos
1087
+ const _tag = state.tag
1088
+ const _anchor = state.anchor
1089
+ const _result = {}
1090
+ const overridableKeys = Object.create(null)
1091
+ let keyTag = null
1092
+ let keyNode = null
1093
+ let valueNode = null
1094
+ let atExplicitKey = false
1095
+ let detected = false
1054
1096
 
1055
1097
  // there is a leading tab before this token, so it can't be a block sequence/mapping;
1056
1098
  // it can still be flow sequence/mapping or a scalar
1057
- if (state.firstTabInLine !== -1) return false;
1099
+ if (state.firstTabInLine !== -1) return false
1058
1100
 
1059
1101
  if (state.anchor !== null) {
1060
- state.anchorMap[state.anchor] = _result;
1102
+ storeAnchor(state, state.anchor, _result)
1061
1103
  }
1062
1104
 
1063
- ch = state.input.charCodeAt(state.position);
1105
+ let ch = state.input.charCodeAt(state.position)
1064
1106
 
1065
1107
  while (ch !== 0) {
1066
1108
  if (!atExplicitKey && state.firstTabInLine !== -1) {
1067
- state.position = state.firstTabInLine;
1068
- throwError(state, 'tab characters must not be used in indentation');
1109
+ state.position = state.firstTabInLine
1110
+ throwError(state, 'tab characters must not be used in indentation')
1069
1111
  }
1070
1112
 
1071
- following = state.input.charCodeAt(state.position + 1);
1072
- _line = state.line; // Save the current line.
1113
+ const following = state.input.charCodeAt(state.position + 1)
1114
+ const _line = state.line // Save the current line.
1073
1115
 
1074
1116
  //
1075
1117
  // Explicit notation case. There are two separate blocks:
1076
1118
  // first for the key (denoted by "?") and second for the value (denoted by ":")
1077
1119
  //
1078
- if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) {
1079
-
1120
+ if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && isWsOrEol(following)) {
1080
1121
  if (ch === 0x3F/* ? */) {
1081
1122
  if (atExplicitKey) {
1082
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
1083
- keyTag = keyNode = valueNode = null;
1123
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos)
1124
+ keyTag = keyNode = valueNode = null
1084
1125
  }
1085
1126
 
1086
- detected = true;
1087
- atExplicitKey = true;
1088
- allowCompact = true;
1089
-
1127
+ detected = true
1128
+ atExplicitKey = true
1129
+ allowCompact = true
1090
1130
  } else if (atExplicitKey) {
1091
1131
  // i.e. 0x3A/* : */ === character after the explicit key.
1092
- atExplicitKey = false;
1093
- allowCompact = true;
1094
-
1132
+ atExplicitKey = false
1133
+ allowCompact = true
1095
1134
  } else {
1096
- throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line');
1135
+ throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line')
1097
1136
  }
1098
1137
 
1099
- state.position += 1;
1100
- ch = following;
1138
+ state.position += 1
1139
+ ch = following
1101
1140
 
1102
1141
  //
1103
1142
  // Implicit notation case. Flow-style node as the key first, then ":", and the value.
1104
1143
  //
1105
1144
  } else {
1106
- _keyLine = state.line;
1107
- _keyLineStart = state.lineStart;
1108
- _keyPos = state.position;
1145
+ _keyLine = state.line
1146
+ _keyLineStart = state.lineStart
1147
+ _keyPos = state.position
1109
1148
 
1110
1149
  if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
1111
1150
  // Neither implicit nor explicit notation.
1112
1151
  // Reading is done. Go to the epilogue.
1113
- break;
1152
+ break
1114
1153
  }
1115
1154
 
1116
1155
  if (state.line === _line) {
1117
- ch = state.input.charCodeAt(state.position);
1156
+ ch = state.input.charCodeAt(state.position)
1118
1157
 
1119
- while (is_WHITE_SPACE(ch)) {
1120
- ch = state.input.charCodeAt(++state.position);
1158
+ while (isWhiteSpace(ch)) {
1159
+ ch = state.input.charCodeAt(++state.position)
1121
1160
  }
1122
1161
 
1123
1162
  if (ch === 0x3A/* : */) {
1124
- ch = state.input.charCodeAt(++state.position);
1163
+ ch = state.input.charCodeAt(++state.position)
1125
1164
 
1126
- if (!is_WS_OR_EOL(ch)) {
1127
- throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');
1165
+ if (!isWsOrEol(ch)) {
1166
+ throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping')
1128
1167
  }
1129
1168
 
1130
1169
  if (atExplicitKey) {
1131
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
1132
- keyTag = keyNode = valueNode = null;
1170
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos)
1171
+ keyTag = keyNode = valueNode = null
1133
1172
  }
1134
1173
 
1135
- detected = true;
1136
- atExplicitKey = false;
1137
- allowCompact = false;
1138
- keyTag = state.tag;
1139
- keyNode = state.result;
1140
-
1174
+ detected = true
1175
+ atExplicitKey = false
1176
+ allowCompact = false
1177
+ keyTag = state.tag
1178
+ keyNode = state.result
1141
1179
  } else if (detected) {
1142
- throwError(state, 'can not read an implicit mapping pair; a colon is missed');
1143
-
1180
+ throwError(state, 'can not read an implicit mapping pair; a colon is missed')
1144
1181
  } else {
1145
- state.tag = _tag;
1146
- state.anchor = _anchor;
1147
- return true; // Keep the result of `composeNode`.
1182
+ state.tag = _tag
1183
+ state.anchor = _anchor
1184
+ return true // Keep the result of `composeNode`.
1148
1185
  }
1149
-
1150
1186
  } else if (detected) {
1151
- throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');
1152
-
1187
+ throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key')
1153
1188
  } else {
1154
- state.tag = _tag;
1155
- state.anchor = _anchor;
1156
- return true; // Keep the result of `composeNode`.
1189
+ state.tag = _tag
1190
+ state.anchor = _anchor
1191
+ return true // Keep the result of `composeNode`.
1157
1192
  }
1158
1193
  }
1159
1194
 
@@ -1162,32 +1197,32 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
1162
1197
  //
1163
1198
  if (state.line === _line || state.lineIndent > nodeIndent) {
1164
1199
  if (atExplicitKey) {
1165
- _keyLine = state.line;
1166
- _keyLineStart = state.lineStart;
1167
- _keyPos = state.position;
1200
+ _keyLine = state.line
1201
+ _keyLineStart = state.lineStart
1202
+ _keyPos = state.position
1168
1203
  }
1169
1204
 
1170
1205
  if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
1171
1206
  if (atExplicitKey) {
1172
- keyNode = state.result;
1207
+ keyNode = state.result
1173
1208
  } else {
1174
- valueNode = state.result;
1209
+ valueNode = state.result
1175
1210
  }
1176
1211
  }
1177
1212
 
1178
1213
  if (!atExplicitKey) {
1179
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
1180
- keyTag = keyNode = valueNode = null;
1214
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos)
1215
+ keyTag = keyNode = valueNode = null
1181
1216
  }
1182
1217
 
1183
- skipSeparationSpace(state, true, -1);
1184
- ch = state.input.charCodeAt(state.position);
1218
+ skipSeparationSpace(state, true, -1)
1219
+ ch = state.input.charCodeAt(state.position)
1185
1220
  }
1186
1221
 
1187
1222
  if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
1188
- throwError(state, 'bad indentation of a mapping entry');
1223
+ throwError(state, 'bad indentation of a mapping entry')
1189
1224
  } else if (state.lineIndent < nodeIndent) {
1190
- break;
1225
+ break
1191
1226
  }
1192
1227
  }
1193
1228
 
@@ -1197,293 +1232,330 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
1197
1232
 
1198
1233
  // Special case: last mapping's node contains only the key in explicit notation.
1199
1234
  if (atExplicitKey) {
1200
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
1235
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos)
1201
1236
  }
1202
1237
 
1203
1238
  // Expose the resulting mapping.
1204
1239
  if (detected) {
1205
- state.tag = _tag;
1206
- state.anchor = _anchor;
1207
- state.kind = 'mapping';
1208
- state.result = _result;
1240
+ state.tag = _tag
1241
+ state.anchor = _anchor
1242
+ state.kind = 'mapping'
1243
+ state.result = _result
1209
1244
  }
1210
1245
 
1211
- return detected;
1246
+ return detected
1212
1247
  }
1213
1248
 
1214
- function readTagProperty(state) {
1215
- var _position,
1216
- isVerbatim = false,
1217
- isNamed = false,
1218
- tagHandle,
1219
- tagName,
1220
- ch;
1249
+ function readTagProperty (state) {
1250
+ let isVerbatim = false
1251
+ let isNamed = false
1252
+ let tagHandle
1253
+ let tagName
1221
1254
 
1222
- ch = state.input.charCodeAt(state.position);
1255
+ let ch = state.input.charCodeAt(state.position)
1223
1256
 
1224
- if (ch !== 0x21/* ! */) return false;
1257
+ if (ch !== 0x21/* ! */) return false
1225
1258
 
1226
1259
  if (state.tag !== null) {
1227
- throwError(state, 'duplication of a tag property');
1260
+ throwError(state, 'duplication of a tag property')
1228
1261
  }
1229
1262
 
1230
- ch = state.input.charCodeAt(++state.position);
1263
+ ch = state.input.charCodeAt(++state.position)
1231
1264
 
1232
1265
  if (ch === 0x3C/* < */) {
1233
- isVerbatim = true;
1234
- ch = state.input.charCodeAt(++state.position);
1235
-
1266
+ isVerbatim = true
1267
+ ch = state.input.charCodeAt(++state.position)
1236
1268
  } else if (ch === 0x21/* ! */) {
1237
- isNamed = true;
1238
- tagHandle = '!!';
1239
- ch = state.input.charCodeAt(++state.position);
1240
-
1269
+ isNamed = true
1270
+ tagHandle = '!!'
1271
+ ch = state.input.charCodeAt(++state.position)
1241
1272
  } else {
1242
- tagHandle = '!';
1273
+ tagHandle = '!'
1243
1274
  }
1244
1275
 
1245
- _position = state.position;
1276
+ let _position = state.position
1246
1277
 
1247
1278
  if (isVerbatim) {
1248
- do { ch = state.input.charCodeAt(++state.position); }
1249
- while (ch !== 0 && ch !== 0x3E/* > */);
1279
+ do { ch = state.input.charCodeAt(++state.position) }
1280
+ while (ch !== 0 && ch !== 0x3E/* > */)
1250
1281
 
1251
1282
  if (state.position < state.length) {
1252
- tagName = state.input.slice(_position, state.position);
1253
- ch = state.input.charCodeAt(++state.position);
1283
+ tagName = state.input.slice(_position, state.position)
1284
+ ch = state.input.charCodeAt(++state.position)
1254
1285
  } else {
1255
- throwError(state, 'unexpected end of the stream within a verbatim tag');
1286
+ throwError(state, 'unexpected end of the stream within a verbatim tag')
1256
1287
  }
1257
1288
  } else {
1258
- while (ch !== 0 && !is_WS_OR_EOL(ch)) {
1259
-
1289
+ while (ch !== 0 && !isWsOrEol(ch)) {
1260
1290
  if (ch === 0x21/* ! */) {
1261
1291
  if (!isNamed) {
1262
- tagHandle = state.input.slice(_position - 1, state.position + 1);
1292
+ tagHandle = state.input.slice(_position - 1, state.position + 1)
1263
1293
 
1264
1294
  if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
1265
- throwError(state, 'named tag handle cannot contain such characters');
1295
+ throwError(state, 'named tag handle cannot contain such characters')
1266
1296
  }
1267
1297
 
1268
- isNamed = true;
1269
- _position = state.position + 1;
1298
+ isNamed = true
1299
+ _position = state.position + 1
1270
1300
  } else {
1271
- throwError(state, 'tag suffix cannot contain exclamation marks');
1301
+ throwError(state, 'tag suffix cannot contain exclamation marks')
1272
1302
  }
1273
1303
  }
1274
1304
 
1275
- ch = state.input.charCodeAt(++state.position);
1305
+ ch = state.input.charCodeAt(++state.position)
1276
1306
  }
1277
1307
 
1278
- tagName = state.input.slice(_position, state.position);
1308
+ tagName = state.input.slice(_position, state.position)
1279
1309
 
1280
1310
  if (PATTERN_FLOW_INDICATORS.test(tagName)) {
1281
- throwError(state, 'tag suffix cannot contain flow indicator characters');
1311
+ throwError(state, 'tag suffix cannot contain flow indicator characters')
1282
1312
  }
1283
1313
  }
1284
1314
 
1285
1315
  if (tagName && !PATTERN_TAG_URI.test(tagName)) {
1286
- throwError(state, 'tag name cannot contain such characters: ' + tagName);
1316
+ throwError(state, 'tag name cannot contain such characters: ' + tagName)
1287
1317
  }
1288
1318
 
1289
1319
  try {
1290
- tagName = decodeURIComponent(tagName);
1320
+ tagName = decodeURIComponent(tagName)
1291
1321
  } catch (err) {
1292
- throwError(state, 'tag name is malformed: ' + tagName);
1322
+ throwError(state, 'tag name is malformed: ' + tagName)
1293
1323
  }
1294
1324
 
1295
1325
  if (isVerbatim) {
1296
- state.tag = tagName;
1297
-
1326
+ state.tag = tagName
1298
1327
  } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
1299
- state.tag = state.tagMap[tagHandle] + tagName;
1300
-
1328
+ state.tag = state.tagMap[tagHandle] + tagName
1301
1329
  } else if (tagHandle === '!') {
1302
- state.tag = '!' + tagName;
1303
-
1330
+ state.tag = '!' + tagName
1304
1331
  } else if (tagHandle === '!!') {
1305
- state.tag = 'tag:yaml.org,2002:' + tagName;
1306
-
1332
+ state.tag = 'tag:yaml.org,2002:' + tagName
1307
1333
  } else {
1308
- throwError(state, 'undeclared tag handle "' + tagHandle + '"');
1334
+ throwError(state, 'undeclared tag handle "' + tagHandle + '"')
1309
1335
  }
1310
1336
 
1311
- return true;
1337
+ return true
1312
1338
  }
1313
1339
 
1314
- function readAnchorProperty(state) {
1315
- var _position,
1316
- ch;
1317
-
1318
- ch = state.input.charCodeAt(state.position);
1340
+ function readAnchorProperty (state) {
1341
+ let ch = state.input.charCodeAt(state.position)
1319
1342
 
1320
- if (ch !== 0x26/* & */) return false;
1343
+ if (ch !== 0x26/* & */) return false
1321
1344
 
1322
1345
  if (state.anchor !== null) {
1323
- throwError(state, 'duplication of an anchor property');
1346
+ throwError(state, 'duplication of an anchor property')
1324
1347
  }
1325
1348
 
1326
- ch = state.input.charCodeAt(++state.position);
1327
- _position = state.position;
1349
+ ch = state.input.charCodeAt(++state.position)
1350
+ const _position = state.position
1328
1351
 
1329
- while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
1330
- ch = state.input.charCodeAt(++state.position);
1352
+ while (ch !== 0 && !isWsOrEol(ch) && !isFlowIndicator(ch)) {
1353
+ ch = state.input.charCodeAt(++state.position)
1331
1354
  }
1332
1355
 
1333
1356
  if (state.position === _position) {
1334
- throwError(state, 'name of an anchor node must contain at least one character');
1357
+ throwError(state, 'name of an anchor node must contain at least one character')
1335
1358
  }
1336
1359
 
1337
- state.anchor = state.input.slice(_position, state.position);
1338
- return true;
1360
+ state.anchor = state.input.slice(_position, state.position)
1361
+ return true
1339
1362
  }
1340
1363
 
1341
- function readAlias(state) {
1342
- var _position, alias,
1343
- ch;
1364
+ function readAlias (state) {
1365
+ let ch = state.input.charCodeAt(state.position)
1344
1366
 
1345
- ch = state.input.charCodeAt(state.position);
1367
+ if (ch !== 0x2A/* * */) return false
1346
1368
 
1347
- if (ch !== 0x2A/* * */) return false;
1369
+ ch = state.input.charCodeAt(++state.position)
1370
+ const _position = state.position
1348
1371
 
1349
- ch = state.input.charCodeAt(++state.position);
1350
- _position = state.position;
1351
-
1352
- while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
1353
- ch = state.input.charCodeAt(++state.position);
1372
+ while (ch !== 0 && !isWsOrEol(ch) && !isFlowIndicator(ch)) {
1373
+ ch = state.input.charCodeAt(++state.position)
1354
1374
  }
1355
1375
 
1356
1376
  if (state.position === _position) {
1357
- throwError(state, 'name of an alias node must contain at least one character');
1377
+ throwError(state, 'name of an alias node must contain at least one character')
1358
1378
  }
1359
1379
 
1360
- alias = state.input.slice(_position, state.position);
1380
+ const alias = state.input.slice(_position, state.position)
1361
1381
 
1362
1382
  if (!_hasOwnProperty.call(state.anchorMap, alias)) {
1363
- throwError(state, 'unidentified alias "' + alias + '"');
1383
+ throwError(state, 'unidentified alias "' + alias + '"')
1384
+ }
1385
+
1386
+ state.result = state.anchorMap[alias]
1387
+ skipSeparationSpace(state, true, -1)
1388
+ return true
1389
+ }
1390
+
1391
+ function tryReadBlockMappingFromProperty (state, propertyStart, nodeIndent, flowIndent) {
1392
+ const fallbackState = snapshotState(state)
1393
+
1394
+ beginAnchorTransaction(state)
1395
+ restoreState(state, propertyStart)
1396
+
1397
+ // Re-read the leading properties as part of the first implicit key, not as
1398
+ // properties of the current node.
1399
+ state.tag = null
1400
+ state.anchor = null
1401
+ state.kind = null
1402
+ state.result = null
1403
+
1404
+ if (readBlockMapping(state, nodeIndent, flowIndent) && state.kind === 'mapping') {
1405
+ commitAnchorTransaction(state)
1406
+ return true
1364
1407
  }
1365
1408
 
1366
- state.result = state.anchorMap[alias];
1367
- skipSeparationSpace(state, true, -1);
1368
- return true;
1409
+ rollbackAnchorTransaction(state)
1410
+ restoreState(state, fallbackState)
1411
+ return false
1369
1412
  }
1370
1413
 
1371
- function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
1372
- var allowBlockStyles,
1373
- allowBlockScalars,
1374
- allowBlockCollections,
1375
- indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this<parent
1376
- atNewLine = false,
1377
- hasContent = false,
1378
- typeIndex,
1379
- typeQuantity,
1380
- typeList,
1381
- type,
1382
- flowIndent,
1383
- blockIndent;
1414
+ function composeNode (state, parentIndent, nodeContext, allowToSeek, allowCompact) {
1415
+ let allowBlockScalars
1416
+ let allowBlockCollections
1417
+ let indentStatus = 1 // 1: this>parent, 0: this=parent, -1: this<parent
1418
+ let atNewLine = false
1419
+ let hasContent = false
1420
+ let propertyStart = null
1421
+ let type
1422
+ let flowIndent
1423
+ let blockIndent
1424
+
1425
+ if (state.depth >= state.maxDepth) {
1426
+ throwError(state, 'nesting exceeded maxDepth (' + state.maxDepth + ')')
1427
+ }
1428
+
1429
+ state.depth += 1
1384
1430
 
1385
1431
  if (state.listener !== null) {
1386
- state.listener('open', state);
1432
+ state.listener('open', state)
1387
1433
  }
1388
1434
 
1389
- state.tag = null;
1390
- state.anchor = null;
1391
- state.kind = null;
1392
- state.result = null;
1435
+ state.tag = null
1436
+ state.anchor = null
1437
+ state.kind = null
1438
+ state.result = null
1393
1439
 
1394
- allowBlockStyles = allowBlockScalars = allowBlockCollections =
1440
+ const allowBlockStyles = allowBlockScalars = allowBlockCollections =
1395
1441
  CONTEXT_BLOCK_OUT === nodeContext ||
1396
- CONTEXT_BLOCK_IN === nodeContext;
1442
+ CONTEXT_BLOCK_IN === nodeContext
1397
1443
 
1398
1444
  if (allowToSeek) {
1399
1445
  if (skipSeparationSpace(state, true, -1)) {
1400
- atNewLine = true;
1446
+ atNewLine = true
1401
1447
 
1402
1448
  if (state.lineIndent > parentIndent) {
1403
- indentStatus = 1;
1449
+ indentStatus = 1
1404
1450
  } else if (state.lineIndent === parentIndent) {
1405
- indentStatus = 0;
1451
+ indentStatus = 0
1406
1452
  } else if (state.lineIndent < parentIndent) {
1407
- indentStatus = -1;
1453
+ indentStatus = -1
1408
1454
  }
1409
1455
  }
1410
1456
  }
1411
1457
 
1412
1458
  if (indentStatus === 1) {
1413
- while (readTagProperty(state) || readAnchorProperty(state)) {
1459
+ while (true) {
1460
+ const ch = state.input.charCodeAt(state.position)
1461
+ const propertyState = snapshotState(state)
1462
+
1463
+ // A duplicate property token after a line break can be the first key of
1464
+ // a nested block mapping, e.g. `!!map\n !!str key: value`.
1465
+ if (atNewLine &&
1466
+ ((ch === 0x21/* ! */ && state.tag !== null) ||
1467
+ (ch === 0x26/* & */ && state.anchor !== null))) {
1468
+ break
1469
+ }
1470
+
1471
+ if (!readTagProperty(state) && !readAnchorProperty(state)) {
1472
+ break
1473
+ }
1474
+
1475
+ if (propertyStart === null) {
1476
+ propertyStart = propertyState
1477
+ }
1478
+
1414
1479
  if (skipSeparationSpace(state, true, -1)) {
1415
- atNewLine = true;
1416
- allowBlockCollections = allowBlockStyles;
1480
+ atNewLine = true
1481
+ allowBlockCollections = allowBlockStyles
1417
1482
 
1418
1483
  if (state.lineIndent > parentIndent) {
1419
- indentStatus = 1;
1484
+ indentStatus = 1
1420
1485
  } else if (state.lineIndent === parentIndent) {
1421
- indentStatus = 0;
1486
+ indentStatus = 0
1422
1487
  } else if (state.lineIndent < parentIndent) {
1423
- indentStatus = -1;
1488
+ indentStatus = -1
1424
1489
  }
1425
1490
  } else {
1426
- allowBlockCollections = false;
1491
+ allowBlockCollections = false
1427
1492
  }
1428
1493
  }
1429
1494
  }
1430
1495
 
1431
1496
  if (allowBlockCollections) {
1432
- allowBlockCollections = atNewLine || allowCompact;
1497
+ allowBlockCollections = atNewLine || allowCompact
1433
1498
  }
1434
1499
 
1435
1500
  if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
1436
1501
  if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
1437
- flowIndent = parentIndent;
1502
+ flowIndent = parentIndent
1438
1503
  } else {
1439
- flowIndent = parentIndent + 1;
1504
+ flowIndent = parentIndent + 1
1440
1505
  }
1441
1506
 
1442
- blockIndent = state.position - state.lineStart;
1507
+ blockIndent = state.position - state.lineStart
1443
1508
 
1444
1509
  if (indentStatus === 1) {
1445
- if (allowBlockCollections &&
1446
- (readBlockSequence(state, blockIndent) ||
1447
- readBlockMapping(state, blockIndent, flowIndent)) ||
1510
+ if ((allowBlockCollections &&
1511
+ (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent))) ||
1448
1512
  readFlowCollection(state, flowIndent)) {
1449
- hasContent = true;
1513
+ hasContent = true
1450
1514
  } else {
1451
- if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||
1515
+ const ch = state.input.charCodeAt(state.position)
1516
+
1517
+ if (propertyStart !== null && allowBlockStyles && !allowBlockCollections &&
1518
+ ch !== 0x7C/* | */ && ch !== 0x3E/* > */ &&
1519
+ tryReadBlockMappingFromProperty(
1520
+ state,
1521
+ propertyStart,
1522
+ propertyStart.position - propertyStart.lineStart,
1523
+ flowIndent
1524
+ )) {
1525
+ hasContent = true
1526
+ } else if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||
1452
1527
  readSingleQuotedScalar(state, flowIndent) ||
1453
1528
  readDoubleQuotedScalar(state, flowIndent)) {
1454
- hasContent = true;
1455
-
1529
+ hasContent = true
1456
1530
  } else if (readAlias(state)) {
1457
- hasContent = true;
1531
+ hasContent = true
1458
1532
 
1459
1533
  if (state.tag !== null || state.anchor !== null) {
1460
- throwError(state, 'alias node should not have any properties');
1534
+ throwError(state, 'alias node should not have any properties')
1461
1535
  }
1462
-
1463
1536
  } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
1464
- hasContent = true;
1537
+ hasContent = true
1465
1538
 
1466
1539
  if (state.tag === null) {
1467
- state.tag = '?';
1540
+ state.tag = '?'
1468
1541
  }
1469
1542
  }
1470
1543
 
1471
1544
  if (state.anchor !== null) {
1472
- state.anchorMap[state.anchor] = state.result;
1545
+ storeAnchor(state, state.anchor, state.result)
1473
1546
  }
1474
1547
  }
1475
1548
  } else if (indentStatus === 0) {
1476
1549
  // Special case: block sequences are allowed to have same indentation level as the parent.
1477
1550
  // http://www.yaml.org/spec/1.2/spec.html#id2799784
1478
- hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
1551
+ hasContent = allowBlockCollections && readBlockSequence(state, blockIndent)
1479
1552
  }
1480
1553
  }
1481
1554
 
1482
1555
  if (state.tag === null) {
1483
1556
  if (state.anchor !== null) {
1484
- state.anchorMap[state.anchor] = state.result;
1557
+ storeAnchor(state, state.anchor, state.result)
1485
1558
  }
1486
-
1487
1559
  } else if (state.tag === '?') {
1488
1560
  // Implicit resolving is not allowed for non-scalar types, and '?'
1489
1561
  // non-specific tag is only automatically assigned to plain scalars.
@@ -1492,242 +1564,231 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
1492
1564
  // tag, for example like this: "!<?> [0]"
1493
1565
  //
1494
1566
  if (state.result !== null && state.kind !== 'scalar') {
1495
- throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
1567
+ throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"')
1496
1568
  }
1497
1569
 
1498
- for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
1499
- type = state.implicitTypes[typeIndex];
1570
+ for (let typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
1571
+ type = state.implicitTypes[typeIndex]
1500
1572
 
1501
1573
  if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
1502
- state.result = type.construct(state.result);
1503
- state.tag = type.tag;
1574
+ state.result = type.construct(state.result)
1575
+ state.tag = type.tag
1504
1576
  if (state.anchor !== null) {
1505
- state.anchorMap[state.anchor] = state.result;
1577
+ storeAnchor(state, state.anchor, state.result)
1506
1578
  }
1507
- break;
1579
+ break
1508
1580
  }
1509
1581
  }
1510
1582
  } else if (state.tag !== '!') {
1511
1583
  if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) {
1512
- type = state.typeMap[state.kind || 'fallback'][state.tag];
1584
+ type = state.typeMap[state.kind || 'fallback'][state.tag]
1513
1585
  } else {
1514
1586
  // looking for multi type
1515
- type = null;
1516
- typeList = state.typeMap.multi[state.kind || 'fallback'];
1587
+ type = null
1588
+ const typeList = state.typeMap.multi[state.kind || 'fallback']
1517
1589
 
1518
- for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
1590
+ for (let typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
1519
1591
  if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
1520
- type = typeList[typeIndex];
1521
- break;
1592
+ type = typeList[typeIndex]
1593
+ break
1522
1594
  }
1523
1595
  }
1524
1596
  }
1525
1597
 
1526
1598
  if (!type) {
1527
- throwError(state, 'unknown tag !<' + state.tag + '>');
1599
+ throwError(state, 'unknown tag !<' + state.tag + '>')
1528
1600
  }
1529
1601
 
1530
1602
  if (state.result !== null && type.kind !== state.kind) {
1531
- throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
1603
+ throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"')
1532
1604
  }
1533
1605
 
1534
1606
  if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched
1535
- throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');
1607
+ throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag')
1536
1608
  } else {
1537
- state.result = type.construct(state.result, state.tag);
1609
+ state.result = type.construct(state.result, state.tag)
1538
1610
  if (state.anchor !== null) {
1539
- state.anchorMap[state.anchor] = state.result;
1611
+ storeAnchor(state, state.anchor, state.result)
1540
1612
  }
1541
1613
  }
1542
1614
  }
1543
1615
 
1544
1616
  if (state.listener !== null) {
1545
- state.listener('close', state);
1617
+ state.listener('close', state)
1546
1618
  }
1547
- return state.tag !== null || state.anchor !== null || hasContent;
1619
+
1620
+ state.depth -= 1
1621
+ return state.tag !== null || state.anchor !== null || hasContent
1548
1622
  }
1549
1623
 
1550
- function readDocument(state) {
1551
- var documentStart = state.position,
1552
- _position,
1553
- directiveName,
1554
- directiveArgs,
1555
- hasDirectives = false,
1556
- ch;
1624
+ function readDocument (state) {
1625
+ const documentStart = state.position
1626
+ let hasDirectives = false
1627
+ let ch
1557
1628
 
1558
- state.version = null;
1559
- state.checkLineBreaks = state.legacy;
1560
- state.tagMap = Object.create(null);
1561
- state.anchorMap = Object.create(null);
1629
+ state.version = null
1630
+ state.checkLineBreaks = state.legacy
1631
+ state.tagMap = Object.create(null)
1632
+ state.anchorMap = Object.create(null)
1562
1633
 
1563
1634
  while ((ch = state.input.charCodeAt(state.position)) !== 0) {
1564
- skipSeparationSpace(state, true, -1);
1635
+ skipSeparationSpace(state, true, -1)
1565
1636
 
1566
- ch = state.input.charCodeAt(state.position);
1637
+ ch = state.input.charCodeAt(state.position)
1567
1638
 
1568
1639
  if (state.lineIndent > 0 || ch !== 0x25/* % */) {
1569
- break;
1640
+ break
1570
1641
  }
1571
1642
 
1572
- hasDirectives = true;
1573
- ch = state.input.charCodeAt(++state.position);
1574
- _position = state.position;
1643
+ hasDirectives = true
1644
+ ch = state.input.charCodeAt(++state.position)
1645
+ let _position = state.position
1575
1646
 
1576
- while (ch !== 0 && !is_WS_OR_EOL(ch)) {
1577
- ch = state.input.charCodeAt(++state.position);
1647
+ while (ch !== 0 && !isWsOrEol(ch)) {
1648
+ ch = state.input.charCodeAt(++state.position)
1578
1649
  }
1579
1650
 
1580
- directiveName = state.input.slice(_position, state.position);
1581
- directiveArgs = [];
1651
+ const directiveName = state.input.slice(_position, state.position)
1652
+ const directiveArgs = []
1582
1653
 
1583
1654
  if (directiveName.length < 1) {
1584
- throwError(state, 'directive name must not be less than one character in length');
1655
+ throwError(state, 'directive name must not be less than one character in length')
1585
1656
  }
1586
1657
 
1587
1658
  while (ch !== 0) {
1588
- while (is_WHITE_SPACE(ch)) {
1589
- ch = state.input.charCodeAt(++state.position);
1659
+ while (isWhiteSpace(ch)) {
1660
+ ch = state.input.charCodeAt(++state.position)
1590
1661
  }
1591
1662
 
1592
1663
  if (ch === 0x23/* # */) {
1593
- do { ch = state.input.charCodeAt(++state.position); }
1594
- while (ch !== 0 && !is_EOL(ch));
1595
- break;
1664
+ do { ch = state.input.charCodeAt(++state.position) }
1665
+ while (ch !== 0 && !isEol(ch))
1666
+ break
1596
1667
  }
1597
1668
 
1598
- if (is_EOL(ch)) break;
1669
+ if (isEol(ch)) break
1599
1670
 
1600
- _position = state.position;
1671
+ _position = state.position
1601
1672
 
1602
- while (ch !== 0 && !is_WS_OR_EOL(ch)) {
1603
- ch = state.input.charCodeAt(++state.position);
1673
+ while (ch !== 0 && !isWsOrEol(ch)) {
1674
+ ch = state.input.charCodeAt(++state.position)
1604
1675
  }
1605
1676
 
1606
- directiveArgs.push(state.input.slice(_position, state.position));
1677
+ directiveArgs.push(state.input.slice(_position, state.position))
1607
1678
  }
1608
1679
 
1609
- if (ch !== 0) readLineBreak(state);
1680
+ if (ch !== 0) readLineBreak(state)
1610
1681
 
1611
1682
  if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
1612
- directiveHandlers[directiveName](state, directiveName, directiveArgs);
1683
+ directiveHandlers[directiveName](state, directiveName, directiveArgs)
1613
1684
  } else {
1614
- throwWarning(state, 'unknown document directive "' + directiveName + '"');
1685
+ throwWarning(state, 'unknown document directive "' + directiveName + '"')
1615
1686
  }
1616
1687
  }
1617
1688
 
1618
- skipSeparationSpace(state, true, -1);
1689
+ skipSeparationSpace(state, true, -1)
1619
1690
 
1620
1691
  if (state.lineIndent === 0 &&
1621
- state.input.charCodeAt(state.position) === 0x2D/* - */ &&
1692
+ state.input.charCodeAt(state.position) === 0x2D/* - */ &&
1622
1693
  state.input.charCodeAt(state.position + 1) === 0x2D/* - */ &&
1623
1694
  state.input.charCodeAt(state.position + 2) === 0x2D/* - */) {
1624
- state.position += 3;
1625
- skipSeparationSpace(state, true, -1);
1626
-
1695
+ state.position += 3
1696
+ skipSeparationSpace(state, true, -1)
1627
1697
  } else if (hasDirectives) {
1628
- throwError(state, 'directives end mark is expected');
1698
+ throwError(state, 'directives end mark is expected')
1629
1699
  }
1630
1700
 
1631
- composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
1632
- skipSeparationSpace(state, true, -1);
1701
+ composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true)
1702
+ skipSeparationSpace(state, true, -1)
1633
1703
 
1634
1704
  if (state.checkLineBreaks &&
1635
1705
  PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
1636
- throwWarning(state, 'non-ASCII line breaks are interpreted as content');
1706
+ throwWarning(state, 'non-ASCII line breaks are interpreted as content')
1637
1707
  }
1638
1708
 
1639
- state.documents.push(state.result);
1709
+ state.documents.push(state.result)
1640
1710
 
1641
1711
  if (state.position === state.lineStart && testDocumentSeparator(state)) {
1642
-
1643
1712
  if (state.input.charCodeAt(state.position) === 0x2E/* . */) {
1644
- state.position += 3;
1645
- skipSeparationSpace(state, true, -1);
1713
+ state.position += 3
1714
+ skipSeparationSpace(state, true, -1)
1646
1715
  }
1647
- return;
1716
+ return
1648
1717
  }
1649
1718
 
1650
1719
  if (state.position < (state.length - 1)) {
1651
- throwError(state, 'end of the stream or a document separator is expected');
1652
- } else {
1653
- return;
1720
+ throwError(state, 'end of the stream or a document separator is expected')
1654
1721
  }
1655
1722
  }
1656
1723
 
1657
-
1658
- function loadDocuments(input, options) {
1659
- input = String(input);
1660
- options = options || {};
1724
+ function loadDocuments (input, options) {
1725
+ input = String(input)
1726
+ options = options || {}
1661
1727
 
1662
1728
  if (input.length !== 0) {
1663
-
1664
1729
  // Add tailing `\n` if not exists
1665
1730
  if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ &&
1666
1731
  input.charCodeAt(input.length - 1) !== 0x0D/* CR */) {
1667
- input += '\n';
1732
+ input += '\n'
1668
1733
  }
1669
1734
 
1670
1735
  // Strip BOM
1671
1736
  if (input.charCodeAt(0) === 0xFEFF) {
1672
- input = input.slice(1);
1737
+ input = input.slice(1)
1673
1738
  }
1674
1739
  }
1675
1740
 
1676
- var state = new State(input, options);
1741
+ const state = new State(input, options)
1677
1742
 
1678
- var nullpos = input.indexOf('\0');
1743
+ const nullpos = input.indexOf('\0')
1679
1744
 
1680
1745
  if (nullpos !== -1) {
1681
- state.position = nullpos;
1682
- throwError(state, 'null byte is not allowed in input');
1746
+ state.position = nullpos
1747
+ throwError(state, 'null byte is not allowed in input')
1683
1748
  }
1684
1749
 
1685
1750
  // Use 0 as string terminator. That significantly simplifies bounds check.
1686
- state.input += '\0';
1751
+ state.input += '\0'
1687
1752
 
1688
1753
  while (state.input.charCodeAt(state.position) === 0x20/* Space */) {
1689
- state.lineIndent += 1;
1690
- state.position += 1;
1754
+ state.lineIndent += 1
1755
+ state.position += 1
1691
1756
  }
1692
1757
 
1693
1758
  while (state.position < (state.length - 1)) {
1694
- readDocument(state);
1759
+ readDocument(state)
1695
1760
  }
1696
1761
 
1697
- return state.documents;
1762
+ return state.documents
1698
1763
  }
1699
1764
 
1700
-
1701
- function loadAll(input, iterator, options) {
1765
+ function loadAll (input, iterator, options) {
1702
1766
  if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') {
1703
- options = iterator;
1704
- iterator = null;
1767
+ options = iterator
1768
+ iterator = null
1705
1769
  }
1706
1770
 
1707
- var documents = loadDocuments(input, options);
1771
+ const documents = loadDocuments(input, options)
1708
1772
 
1709
1773
  if (typeof iterator !== 'function') {
1710
- return documents;
1774
+ return documents
1711
1775
  }
1712
1776
 
1713
- for (var index = 0, length = documents.length; index < length; index += 1) {
1714
- iterator(documents[index]);
1777
+ for (let index = 0, length = documents.length; index < length; index += 1) {
1778
+ iterator(documents[index])
1715
1779
  }
1716
1780
  }
1717
1781
 
1718
-
1719
- function load(input, options) {
1720
- var documents = loadDocuments(input, options);
1782
+ function load (input, options) {
1783
+ const documents = loadDocuments(input, options)
1721
1784
 
1722
1785
  if (documents.length === 0) {
1723
- /*eslint-disable no-undefined*/
1724
- return undefined;
1786
+ return undefined
1725
1787
  } else if (documents.length === 1) {
1726
- return documents[0];
1788
+ return documents[0]
1727
1789
  }
1728
- throw new YAMLException('expected a single document in the stream, but found more');
1790
+ throw new YAMLException('expected a single document in the stream, but found more')
1729
1791
  }
1730
1792
 
1731
-
1732
- module.exports.loadAll = loadAll;
1733
- module.exports.load = load;
1793
+ module.exports.loadAll = loadAll
1794
+ module.exports.load = load