Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: eemeli/yaml
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4cdcde632ece71155f3108ec0120c1a0329a6914
Choose a base ref
...
head repository: eemeli/yaml
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: f21fa455b8bb08aa3b20f07968aa923544635c2d
Choose a head ref
Loading
Showing with 27,085 additions and 20,709 deletions.
  1. +2 −0 .eslintignore
  2. +34 −12 .eslintrc.yaml
  3. +24 −0 .github/ISSUE_TEMPLATE/bug_report.md
  4. +11 −0 .github/ISSUE_TEMPLATE/config.yml
  5. +19 −0 .github/ISSUE_TEMPLATE/feature_request.md
  6. +5 −9 .github/workflows/browsers.yml
  7. +25 −0 .github/workflows/codeql-analysis.yml
  8. +11 −10 .github/workflows/nodejs.yml
  9. +32 −0 .github/workflows/typescript.yml
  10. +1 −0 .gitignore
  11. +4 −0 .gitmodules
  12. +1 −0 .prettierignore
  13. +0 −47 CONTRIBUTING.md
  14. +1 −1 LICENSE
  15. +51 −35 README.md
  16. +0 −9 babel.config.js
  17. +5 −1 browser/index.js
  18. +0 −2 browser/map.js
  19. +3 −0 browser/package.json
  20. +0 −2 browser/pair.js
  21. +0 −1 browser/parse-cst.js
  22. +0 −2 browser/scalar.js
  23. +0 −9 browser/schema.js
  24. +0 −2 browser/seq.js
  25. +0 −1 browser/types.js
  26. +0 −8 browser/types/binary.js
  27. +0 −3 browser/types/omap.js
  28. +0 −3 browser/types/pairs.js
  29. +0 −3 browser/types/set.js
  30. +0 −10 browser/types/timestamp.js
  31. +0 −1 browser/util.js
  32. +22 −0 config/babel.config.js
  33. +42 −0 config/jest.config.js
  34. +25 −0 config/rollup.browser-config.mjs
  35. +17 −0 config/rollup.node-config.mjs
  36. +1 −1 docs-slate
  37. +63 −27 docs/01_intro.md
  38. +4 −4 docs/02_parse_stringify.md
  39. +133 −78 docs/03_options.md
  40. +86 −116 docs/04_documents.md
  41. +294 −130 docs/05_content_nodes.md
  42. +60 −51 docs/06_custom_tags.md
  43. +0 −257 docs/07_cst_parser.md
  44. +418 −0 docs/07_parsing_yaml.md
  45. +54 −31 docs/08_errors.md
  46. +13 −23 docs/09_yaml_syntax.md
  47. +69 −0 docs/CONTRIBUTING.md
  48. +12 −0 docs/SECURITY.md
  49. +2 −2 docs/index.html.md
  50. +0 −372 index.d.ts
  51. +0 −1 index.js
  52. +0 −39 jest.config.js
  53. +0 −2 map.js
  54. +10,562 −5,638 package-lock.json
  55. +50 −63 package.json
  56. +0 −2 pair.js
  57. +0 −187 parse-cst.d.ts
  58. +0 −1 parse-cst.js
  59. +1 −1 playground
  60. +0 −18 rollup.browser-config.js
  61. +0 −19 rollup.node-config.js
  62. +0 −2 scalar.js
  63. +0 −9 schema.js
  64. +0 −2 seq.js
  65. +0 −83 src/ast/Alias.js
  66. +0 −196 src/ast/Collection.js
  67. +0 −58 src/ast/Merge.js
  68. +0 −1 src/ast/Node.js
  69. +0 −163 src/ast/Pair.js
  70. +0 −17 src/ast/Scalar.js
  71. +0 −89 src/ast/YAMLMap.js
  72. +0 −64 src/ast/YAMLSeq.js
  73. +0 −10 src/ast/index.js
  74. +0 −17 src/ast/toJSON.js
  75. +87 −0 src/compose/compose-collection.ts
  76. +61 −0 src/compose/compose-doc.ts
  77. +140 −0 src/compose/compose-node.ts
  78. +113 −0 src/compose/compose-scalar.ts
  79. +262 −0 src/compose/composer.ts
  80. +136 −0 src/compose/resolve-block-map.ts
  81. +208 −0 src/compose/resolve-block-scalar.ts
  82. +52 −0 src/compose/resolve-block-seq.ts
  83. +44 −0 src/compose/resolve-end.ts
  84. +218 −0 src/compose/resolve-flow-collection.ts
  85. +244 −0 src/compose/resolve-flow-scalar.ts
  86. +173 −0 src/compose/resolve-props.ts
  87. +25 −0 src/compose/util-contains-newline.ts
  88. +31 −0 src/compose/util-empty-scalar-position.ts
  89. +21 −0 src/compose/util-flow-indent-check.ts
  90. +22 −0 src/compose/util-map-includes.ts
  91. +0 −34 src/constants.js
  92. +0 −24 src/cst/Alias.js
  93. +0 −30 src/cst/BlankLine.js
  94. +0 −209 src/cst/BlockValue.js
  95. +0 −224 src/cst/Collection.js
  96. +0 −117 src/cst/CollectionItem.js
  97. +0 −24 src/cst/Comment.js
  98. +0 −43 src/cst/Directive.js
  99. +0 −227 src/cst/Document.js
  100. +0 −175 src/cst/FlowCollection.js
  101. +0 −300 src/cst/Node.js
  102. +0 −228 src/cst/ParseContext.js
  103. +0 −146 src/cst/PlainValue.js
  104. +0 −182 src/cst/QuoteDouble.js
  105. +0 −95 src/cst/QuoteSingle.js
  106. +0 −3 src/cst/README.md
  107. +0 −45 src/cst/Range.js
  108. +0 −34 src/cst/parse.js
  109. +0 −132 src/cst/source-utils.js
  110. +0 −97 src/doc/Anchors.js
  111. +0 −270 src/doc/Document.js
  112. +465 −0 src/doc/Document.ts
  113. +0 −52 src/doc/Schema.js
  114. +81 −0 src/doc/anchors.ts
  115. +49 −0 src/doc/applyReviver.ts
  116. +0 −64 src/doc/createNode.js
  117. +106 −0 src/doc/createNode.ts
  118. +191 −0 src/doc/directives.ts
  119. +0 −31 src/doc/getSchemaTags.js
  120. +0 −19 src/doc/listTagNames.js
  121. +0 −55 src/doc/parseContents.js
  122. +0 −79 src/doc/parseDirectives.js
  123. +0 −63 src/errors.js
  124. +99 −0 src/errors.ts
  125. +0 −74 src/index.js
  126. +61 −0 src/index.ts
  127. +0 −7 src/legacy-exports.js
  128. +13 −0 src/log.ts
  129. +124 −0 src/nodes/Alias.ts
  130. +213 −0 src/nodes/Collection.ts
  131. +144 −0 src/nodes/Node.ts
  132. +59 −0 src/nodes/Pair.ts
  133. +64 −0 src/nodes/Scalar.ts
  134. +146 −0 src/nodes/YAMLMap.ts
  135. +126 −0 src/nodes/YAMLSeq.ts
  136. +110 −0 src/nodes/addPairToJSMap.ts
  137. +52 −0 src/nodes/toJS.ts
  138. +0 −83 src/options.js
  139. +383 −0 src/options.ts
  140. +289 −0 src/parse/cst-scalar.ts
  141. +52 −0 src/parse/cst-stringify.ts
  142. +113 −0 src/parse/cst-visit.ts
  143. +243 −0 src/parse/cst.ts
  144. +702 −0 src/parse/lexer.ts
  145. +33 −0 src/parse/line-counter.ts
  146. +942 −0 src/parse/parser.ts
  147. +209 −0 src/public-api.ts
  148. +0 −76 src/resolve/collection-utils.js
  149. +0 −270 src/resolve/resolveMap.js
  150. +0 −142 src/resolve/resolveNode.js
  151. +0 −18 src/resolve/resolveScalar.js
  152. +0 −153 src/resolve/resolveSeq.js
  153. +0 −11 src/resolve/resolveString.js
  154. +0 −69 src/resolve/resolveTag.js
  155. +0 −75 src/resolve/resolveTagName.js
  156. +68 −0 src/schema/Schema.ts
  157. +38 −0 src/schema/common/map.ts
  158. +15 −0 src/schema/common/null.ts
  159. +33 −0 src/schema/common/seq.ts
  160. +4 −6 src/{tags/failsafe/string.js → schema/common/string.ts}
  161. +17 −0 src/schema/core/bool.ts
  162. +45 −0 src/schema/core/float.ts
  163. +49 −0 src/schema/core/int.ts
  164. +21 −0 src/schema/core/schema.ts
  165. +98 −0 src/schema/json-schema.ts
  166. +26 −19 src/{tags/json.js → schema/json/schema.ts}
  167. +92 −0 src/schema/tags.ts
  168. +107 −0 src/schema/types.ts
  169. +30 −30 src/{tags/yaml-1.1/binary.js → schema/yaml-1.1/binary.ts}
  170. +27 −0 src/schema/yaml-1.1/bool.ts
  171. +47 −0 src/schema/yaml-1.1/float.ts
  172. +87 −0 src/schema/yaml-1.1/int.ts
  173. +74 −0 src/schema/yaml-1.1/omap.ts
  174. +82 −0 src/schema/yaml-1.1/pairs.ts
  175. +35 −0 src/schema/yaml-1.1/schema.ts
  176. +117 −0 src/schema/yaml-1.1/set.ts
  177. +120 −0 src/schema/yaml-1.1/timestamp.ts
  178. +0 −13 src/stringify/addComment.js
  179. +76 −40 src/stringify/{foldFlowLines.js → foldFlowLines.ts}
  180. +0 −92 src/stringify/stringify.js
  181. +174 −0 src/stringify/stringify.ts
  182. +181 −0 src/stringify/stringifyCollection.ts
  183. +21 −0 src/stringify/stringifyComment.ts
  184. +90 −0 src/stringify/stringifyDocument.ts
  185. +10 −3 src/stringify/{stringifyNumber.js → stringifyNumber.ts}
  186. +168 −0 src/stringify/stringifyPair.ts
  187. +0 −313 src/stringify/stringifyString.js
  188. +372 −0 src/stringify/stringifyString.ts
  189. +0 −28 src/stringify/stringifyTag.js
  190. +0 −122 src/tags/core.js
  191. +0 −5 src/tags/failsafe/index.js
  192. +0 −25 src/tags/failsafe/map.js
  193. +0 −21 src/tags/failsafe/seq.js
  194. +0 −43 src/tags/index.js
  195. +0 −24 src/tags/options.js
  196. +0 −160 src/tags/yaml-1.1/index.js
  197. +0 −72 src/tags/yaml-1.1/omap.js
  198. +0 −63 src/tags/yaml-1.1/pairs.js
  199. +0 −76 src/tags/yaml-1.1/set.js
  200. +0 −94 src/tags/yaml-1.1/timestamp.js
  201. +0 −132 src/test-events.js
  202. +141 −0 src/test-events.ts
  203. +0 −19 src/types.js
  204. +0 −15 src/util.js
  205. +9 −0 src/util.ts
  206. +328 −0 src/visit.ts
  207. +0 −51 src/warnings.js
  208. +18 −0 tests/_utils.ts
  209. +74 −0 tests/clone.ts
  210. +234 −92 tests/{doc/collection-access.js → collection-access.ts}
  211. +87 −0 tests/compat.ts
  212. +197 −0 tests/cst.ts
  213. +0 −32 tests/cst/Node.js
  214. +0 −3,608 tests/cst/YAML-1.2.spec.js
  215. +0 −51 tests/cst/common.js
  216. +0 −585 tests/cst/corner-cases.js
  217. +0 −307 tests/cst/parse.js
  218. +0 −53 tests/cst/set-value.js
  219. +0 −49 tests/cst/source-utils.js
  220. +66 −0 tests/directives.ts
  221. +32 −35 tests/doc/YAML-1.1.spec.js
  222. +137 −194 tests/doc/YAML-1.2.spec.js
  223. +212 −74 tests/doc/anchors.js
  224. +671 −278 tests/doc/comments.js
  225. +206 −144 tests/doc/createNode.js
  226. +305 −224 tests/doc/errors.js
  227. +142 −54 tests/doc/foldFlowLines.js
  228. +444 −241 tests/doc/parse.js
  229. +918 −257 tests/doc/stringify.js
  230. +663 −236 tests/doc/types.js
  231. +176 −0 tests/is-node.ts
  232. +1 −0 tests/json-test-suite
  233. +70 −0 tests/json-test-suite.ts
  234. +30 −0 tests/lexer.ts
  235. +49 −0 tests/line-counter.ts
  236. +5 −8 tests/{properties.js → properties.ts}
  237. +77 −0 tests/stream.ts
  238. +13 −0 tests/tsconfig.json
  239. +0 −93 tests/typings.ts
  240. +242 −0 tests/visit.ts
  241. +1 −1 tests/yaml-test-suite
  242. +0 −114 tests/yaml-test-suite.js
  243. +131 −0 tests/yaml-test-suite.ts
  244. +14 −0 tsconfig.json
  245. +0 −407 types.d.ts
  246. +0 −17 types.js
  247. +0 −17 types.mjs
  248. +0 −8 types/binary.js
  249. +0 −3 types/omap.js
  250. +0 −3 types/pairs.js
  251. +0 −3 types/set.js
  252. +0 −10 types/timestamp.js
  253. +3 −86 util.d.ts
  254. +2 −16 util.js
  255. +0 −18 util.mjs
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/browser/
/dist/
/docs-slate/
/lib/
/package-lock.json
/playground/dist/
/tests/json-test-suite/
/tests/yaml-test-suite/
46 changes: 34 additions & 12 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,57 @@
root: true
parser: babel-eslint
parser: '@typescript-eslint/parser'
parserOptions:
project:
- ./tsconfig.json
- ./tests/tsconfig.json
env:
node: true

plugins:
- '@typescript-eslint'

extends:
- eslint:recommended
- plugin:prettier/recommended
- plugin:@typescript-eslint/recommended
- plugin:@typescript-eslint/recommended-requiring-type-checking
- prettier

rules:
array-callback-return: error
camelcase: error
consistent-return: error
eqeqeq: [error, always, 'null': ignore]
no-constant-condition: [error, checkLoops: false]
no-control-regex: 0
no-fallthrough: [error, commentPattern: fallthrough]
no-implicit-globals: error
no-template-curly-in-string: warn
no-unused-labels: 0
no-var: error
prefer-const: [warn, destructuring: all]
prettier/prettier: error
'@typescript-eslint/no-explicit-any': off
'@typescript-eslint/no-namespace': off
'@typescript-eslint/no-unsafe-argument': off
'@typescript-eslint/no-unsafe-assignment': off
'@typescript-eslint/no-unsafe-member-access': off
'@typescript-eslint/no-unused-vars': [warn, argsIgnorePattern: '^_']
'@typescript-eslint/prefer-includes': warn
'@typescript-eslint/prefer-nullish-coalescing': warn
'@typescript-eslint/prefer-optional-chain': warn
'@typescript-eslint/restrict-template-expressions': off

overrides:
- files: src/**/*.js
env:
es6: true
node: false
- files:
- tests/**/*.js
- files: [config/**]
parser: espree
parserOptions:
ecmaVersion: latest

- files: [tests/**]
env:
es6: true
jest: true
rules:
camelcase: 0
'@typescript-eslint/no-unsafe-return': off

- files: [tests/doc/**]
rules:
'@typescript-eslint/no-unsafe-call': off
'@typescript-eslint/unbound-method': off
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Bug report
about: Report an issue to help us improve the library
title: ''
labels: bug
assignees: ''
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behaviour.

**Expected behaviour**
A clear and concise description of what you expected to happen.

**Versions (please complete the following information):**

- Environment: [e.g. Node.js 14.7.0 or Chrome 87.0]
- `yaml`: [e.g. 1.10.0 or 2.0.0-2]

**Additional context**
Add any other context about the problem here.
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
blank_issues_enabled: false
contact_links:
- name: Discussions
url: https://github.com/eemeli/yaml/discussions
about: Please ask and answer questions here.
- name: Documentation (v1)
url: https://eemeli.org/yaml/v1
about: Documentation for yaml@1
- name: Documentation (v2)
url: https://eemeli.org/yaml/
about: Documentation for yaml@2
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature request
about: Suggest an idea for this library
title: ''
labels: enhancement
assignees: ''
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
14 changes: 5 additions & 9 deletions .github/workflows/browsers.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
name: Browsers

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
- push
- workflow_dispatch

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Checkout submodules
uses: textbook/git-checkout-submodule-action@master
- name: Use Node.js
uses: actions/setup-node@v1
with: { submodules: true }
- uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: '16'
- name: Cache BrowserStackLocal
uses: actions/cache@v1
with:
25 changes: 25 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CodeQL

on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: javascript

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
21 changes: 11 additions & 10 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
name: Node.js

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
branches: [master]
push:
branches: [master]
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}

strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [14.x, 16.x]

steps:
- uses: actions/checkout@v2
- name: Checkout submodules
uses: textbook/git-checkout-submodule-action@master
with: { submodules: true }
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm test
- run: npm run test:types
- run: npm run test:dist
- run: npm run test:dist:types

lint:
runs-on: ubuntu-latest
@@ -33,8 +36,6 @@ jobs:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 14.x
with: { node-version: 16.x }
- run: npm ci
- run: npm run lint
- run: npm run test:types
32 changes: 32 additions & 0 deletions .github/workflows/typescript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: TypeScript

on:
pull_request:
branches: [master]
push:
branches: [master]
workflow_dispatch:

jobs:
typescript:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with: { node-version: 16.x }
- run: npm ci
- run: npm run build:node

- run: npm install --no-save typescript@4.2
- run: for d in node_modules/@types/*; do [[ $d == *node ]] || rm -r $d; done
- run: npm run test:dist:types

- run: npm install --no-save typescript@4.0
- run: for d in node_modules/@types/*; do [[ $d == *node ]] || rm -r $d; done
- run: npm run test:dist:types

- run: npm install --no-save typescript@3.8
- run: for d in node_modules/@types/*; do [[ $d == *node ]] || rm -r $d; done
- run: npm run test:dist:types
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.*
coverage/
dist/
lib/
node_modules/
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -8,3 +8,7 @@
[submodule "playground"]
path = playground
url = https://github.com/eemeli/yaml-playground.git
[submodule "tests/json-test-suite"]
path = tests/json-test-suite
url = https://github.com/nst/JSONTestSuite.git
branch = master
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -2,4 +2,5 @@ coverage/
dist/
node_modules/
/docs-slate/
/tests/json-test-suite/
/tests/yaml-test-suite/
47 changes: 0 additions & 47 deletions CONTRIBUTING.md

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2018 Eemeli Aro <eemeli@gmail.com>
Copyright Eemeli Aro <eemeli@gmail.com>

Permission to use, copy, modify, and/or distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice
Loading