yaml 1.9.1 → 1.10.2
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.
- package/README.md +25 -25
- package/browser/dist/PlainValue-b8036b75.js +1275 -0
- package/browser/dist/Schema-e94716c8.js +682 -0
- package/browser/dist/index.js +860 -27
- package/browser/dist/legacy-exports.js +3 -0
- package/browser/dist/package.json +1 -0
- package/browser/dist/parse-cst.js +1904 -0
- package/browser/dist/resolveSeq-492ab440.js +2419 -0
- package/browser/dist/types.js +4 -0
- package/browser/dist/util.js +2 -0
- package/browser/dist/warnings-df54cb69.js +499 -0
- package/browser/index.js +1 -1
- package/browser/map.js +2 -4
- package/browser/pair.js +2 -4
- package/browser/parse-cst.js +1 -1
- package/browser/scalar.js +2 -4
- package/browser/schema.js +7 -10
- package/browser/seq.js +2 -4
- package/browser/types/binary.js +7 -5
- package/browser/types/omap.js +3 -4
- package/browser/types/pairs.js +3 -4
- package/browser/types/set.js +3 -4
- package/browser/types/timestamp.js +9 -5
- package/browser/types.js +1 -13
- package/browser/util.js +1 -18
- package/dist/Document-9b4560a1.js +757 -0
- package/dist/PlainValue-ec8e588e.js +876 -0
- package/dist/Schema-88e323a7.js +525 -0
- package/dist/index.js +20 -84
- package/dist/legacy-exports.js +16 -0
- package/dist/parse-cst.js +1753 -0
- package/dist/resolveSeq-d03cb037.js +2161 -0
- package/dist/test-events.js +11 -9
- package/dist/types.js +23 -0
- package/dist/util.js +19 -0
- package/dist/warnings-1000a372.js +416 -0
- package/index.d.ts +23 -9
- package/map.js +2 -2
- package/package.json +27 -42
- package/pair.js +2 -2
- package/parse-cst.d.ts +4 -0
- package/parse-cst.js +1 -1
- package/scalar.js +2 -2
- package/schema.js +8 -6
- package/seq.js +2 -2
- package/types/binary.js +3 -2
- package/types/omap.js +3 -2
- package/types/pairs.js +3 -2
- package/types/set.js +3 -2
- package/types/timestamp.js +6 -6
- package/types.d.ts +113 -98
- package/types.js +16 -11
- package/types.mjs +15 -19
- package/util.js +14 -14
- package/util.mjs +13 -20
- package/browser/dist/Anchors.js +0 -130
- package/browser/dist/Document.js +0 -824
- package/browser/dist/addComment.js +0 -8
- package/browser/dist/constants.js +0 -26
- package/browser/dist/cst/Alias.js +0 -46
- package/browser/dist/cst/BlankLine.js +0 -52
- package/browser/dist/cst/BlockValue.js +0 -251
- package/browser/dist/cst/Collection.js +0 -278
- package/browser/dist/cst/CollectionItem.js +0 -140
- package/browser/dist/cst/Comment.js +0 -44
- package/browser/dist/cst/Directive.js +0 -76
- package/browser/dist/cst/Document.js +0 -286
- package/browser/dist/cst/FlowCollection.js +0 -220
- package/browser/dist/cst/Node.js +0 -386
- package/browser/dist/cst/ParseContext.js +0 -246
- package/browser/dist/cst/PlainValue.js +0 -170
- package/browser/dist/cst/QuoteDouble.js +0 -245
- package/browser/dist/cst/QuoteSingle.js +0 -120
- package/browser/dist/cst/Range.js +0 -64
- package/browser/dist/cst/parse.js +0 -48
- package/browser/dist/cst/source-utils.js +0 -168
- package/browser/dist/errors.js +0 -127
- package/browser/dist/foldFlowLines.js +0 -138
- package/browser/dist/listTagNames.js +0 -28
- package/browser/dist/schema/Alias.js +0 -135
- package/browser/dist/schema/Collection.js +0 -260
- package/browser/dist/schema/Map.js +0 -161
- package/browser/dist/schema/Merge.js +0 -118
- package/browser/dist/schema/Node.js +0 -4
- package/browser/dist/schema/Pair.js +0 -194
- package/browser/dist/schema/Scalar.js +0 -42
- package/browser/dist/schema/Seq.js +0 -116
- package/browser/dist/schema/index.js +0 -368
- package/browser/dist/schema/parseMap.js +0 -312
- package/browser/dist/schema/parseSeq.js +0 -168
- package/browser/dist/schema/parseUtils.js +0 -106
- package/browser/dist/stringify.js +0 -332
- package/browser/dist/tags/core.js +0 -141
- package/browser/dist/tags/failsafe/index.js +0 -4
- package/browser/dist/tags/failsafe/map.js +0 -53
- package/browser/dist/tags/failsafe/seq.js +0 -39
- package/browser/dist/tags/failsafe/string.js +0 -28
- package/browser/dist/tags/index.js +0 -36
- package/browser/dist/tags/json.js +0 -77
- package/browser/dist/tags/options.js +0 -26
- package/browser/dist/tags/yaml-1.1/binary.js +0 -87
- package/browser/dist/tags/yaml-1.1/index.js +0 -189
- package/browser/dist/tags/yaml-1.1/omap.js +0 -137
- package/browser/dist/tags/yaml-1.1/pairs.js +0 -78
- package/browser/dist/tags/yaml-1.1/set.js +0 -118
- package/browser/dist/tags/yaml-1.1/timestamp.js +0 -97
- package/browser/dist/test-events.js +0 -163
- package/browser/dist/toJSON.js +0 -19
- package/browser/dist/warnings.js +0 -39
- package/dist/Anchors.js +0 -120
- package/dist/Document.js +0 -714
- package/dist/addComment.js +0 -14
- package/dist/constants.js +0 -31
- package/dist/cst/Alias.js +0 -33
- package/dist/cst/BlankLine.js +0 -40
- package/dist/cst/BlockValue.js +0 -243
- package/dist/cst/Collection.js +0 -266
- package/dist/cst/CollectionItem.js +0 -135
- package/dist/cst/Comment.js +0 -33
- package/dist/cst/Directive.js +0 -59
- package/dist/cst/Document.js +0 -276
- package/dist/cst/FlowCollection.js +0 -213
- package/dist/cst/Node.js +0 -360
- package/dist/cst/ParseContext.js +0 -253
- package/dist/cst/PlainValue.js +0 -156
- package/dist/cst/QuoteDouble.js +0 -232
- package/dist/cst/QuoteSingle.js +0 -108
- package/dist/cst/Range.js +0 -60
- package/dist/cst/parse.js +0 -50
- package/dist/cst/source-utils.js +0 -175
- package/dist/errors.js +0 -97
- package/dist/foldFlowLines.js +0 -143
- package/dist/listTagNames.js +0 -33
- package/dist/schema/Alias.js +0 -105
- package/dist/schema/Collection.js +0 -184
- package/dist/schema/Map.js +0 -98
- package/dist/schema/Merge.js +0 -75
- package/dist/schema/Node.js +0 -7
- package/dist/schema/Pair.js +0 -174
- package/dist/schema/Scalar.js +0 -26
- package/dist/schema/Seq.js +0 -73
- package/dist/schema/index.js +0 -310
- package/dist/schema/parseMap.js +0 -334
- package/dist/schema/parseSeq.js +0 -175
- package/dist/schema/parseUtils.js +0 -101
- package/dist/stringify.js +0 -352
- package/dist/tags/core.js +0 -121
- package/dist/tags/failsafe/index.js +0 -12
- package/dist/tags/failsafe/map.js +0 -32
- package/dist/tags/failsafe/seq.js +0 -29
- package/dist/tags/failsafe/string.js +0 -37
- package/dist/tags/index.js +0 -53
- package/dist/tags/json.js +0 -64
- package/dist/tags/options.js +0 -36
- package/dist/tags/yaml-1.1/binary.js +0 -94
- package/dist/tags/yaml-1.1/index.js +0 -162
- package/dist/tags/yaml-1.1/omap.js +0 -100
- package/dist/tags/yaml-1.1/pairs.js +0 -75
- package/dist/tags/yaml-1.1/set.js +0 -82
- package/dist/tags/yaml-1.1/timestamp.js +0 -90
- package/dist/toJSON.js +0 -21
- package/dist/warnings.js +0 -48
package/README.md
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
# YAML <a href="https://www.npmjs.com/package/yaml"><img align="right" src="https://badge.fury.io/js/yaml.svg" title="npm package" /></a
|
|
1
|
+
# YAML <a href="https://www.npmjs.com/package/yaml"><img align="right" src="https://badge.fury.io/js/yaml.svg" title="npm package" /></a>
|
|
2
2
|
|
|
3
3
|
`yaml` is a JavaScript parser and stringifier for [YAML](http://yaml.org/), a human friendly data serialization standard. It supports both parsing and stringifying data using all versions of YAML, along with all common data schemas. As a particularly distinguishing feature, `yaml` fully supports reading and writing comments and blank lines in YAML documents.
|
|
4
4
|
|
|
5
|
-
The library is released under the ISC open source license, and the code is [available on GitHub](https://github.com/eemeli/yaml/). It runs on Node.js 6 and later
|
|
5
|
+
The library is released under the ISC open source license, and the code is [available on GitHub](https://github.com/eemeli/yaml/). It has no external dependencies and runs on Node.js 6 and later, and in browsers from IE 11 upwards.
|
|
6
6
|
|
|
7
|
-
For
|
|
7
|
+
For the purposes of versioning, any changes that break any of the endpoints or APIs documented here will be considered semver-major breaking changes. Undocumented library internals may change between minor versions, and previous APIs may be deprecated (but not removed).
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
For more information, see the project's documentation site: [**eemeli.org/yaml/v1**](https://eemeli.org/yaml/v1/)
|
|
10
|
+
|
|
11
|
+
To install:
|
|
10
12
|
|
|
11
13
|
```sh
|
|
12
14
|
npm install yaml
|
|
13
|
-
# or
|
|
14
|
-
yarn add yaml
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
Note
|
|
17
|
+
**Note:** This is `yaml@1`. You may also be interested in the next version, currently available as [`yaml@next`](https://www.npmjs.com/package/yaml/v/next).
|
|
18
18
|
|
|
19
19
|
## API Overview
|
|
20
20
|
|
|
21
|
-
The API provided by `yaml` has three layers, depending on how deep you need to go: [Parse & Stringify](https://eemeli.org/yaml/#parse-amp-stringify), [Documents](https://eemeli.org/yaml/#documents), and the [CST Parser](https://eemeli.org/yaml/#cst-parser). The first has the simplest API and "just works", the second gets you all the bells and whistles supported by the library along with a decent [AST](https://eemeli.org/yaml/#content-nodes), and the third is the closest to YAML source, making it fast, raw, and crude.
|
|
21
|
+
The API provided by `yaml` has three layers, depending on how deep you need to go: [Parse & Stringify](https://eemeli.org/yaml/v1/#parse-amp-stringify), [Documents](https://eemeli.org/yaml/#documents), and the [CST Parser](https://eemeli.org/yaml/#cst-parser). The first has the simplest API and "just works", the second gets you all the bells and whistles supported by the library along with a decent [AST](https://eemeli.org/yaml/#content-nodes), and the third is the closest to YAML source, making it fast, raw, and crude.
|
|
22
22
|
|
|
23
23
|
```js
|
|
24
24
|
import YAML from 'yaml'
|
|
@@ -28,29 +28,29 @@ const YAML = require('yaml')
|
|
|
28
28
|
|
|
29
29
|
### Parse & Stringify
|
|
30
30
|
|
|
31
|
-
- [`YAML.parse(str, options): value`](https://eemeli.org/yaml/#yaml-parse)
|
|
32
|
-
- [`YAML.stringify(value, options): string`](https://eemeli.org/yaml/#yaml-stringify)
|
|
31
|
+
- [`YAML.parse(str, options): value`](https://eemeli.org/yaml/v1/#yaml-parse)
|
|
32
|
+
- [`YAML.stringify(value, options): string`](https://eemeli.org/yaml/v1/#yaml-stringify)
|
|
33
33
|
|
|
34
34
|
### YAML Documents
|
|
35
35
|
|
|
36
|
-
- [`YAML.createNode(value, wrapScalars, tag): Node`](https://eemeli.org/yaml/#creating-nodes)
|
|
37
|
-
- [`YAML.defaultOptions`](https://eemeli.org/yaml/#options)
|
|
38
|
-
- [`YAML.Document`](https://eemeli.org/yaml/#yaml-documents)
|
|
39
|
-
- [`constructor(options)`](https://eemeli.org/yaml/#creating-documents)
|
|
40
|
-
- [`defaults`](https://eemeli.org/yaml/#options)
|
|
41
|
-
- [`#anchors`](https://eemeli.org/yaml/#working-with-anchors)
|
|
42
|
-
- [`#contents`](https://eemeli.org/yaml/#content-nodes)
|
|
43
|
-
- [`#errors`](https://eemeli.org/yaml/#errors)
|
|
44
|
-
- [`YAML.parseAllDocuments(str, options): YAML.Document[]`](https://eemeli.org/yaml/#parsing-documents)
|
|
45
|
-
- [`YAML.parseDocument(str, options): YAML.Document`](https://eemeli.org/yaml/#parsing-documents)
|
|
36
|
+
- [`YAML.createNode(value, wrapScalars, tag): Node`](https://eemeli.org/yaml/v1/#creating-nodes)
|
|
37
|
+
- [`YAML.defaultOptions`](https://eemeli.org/yaml/v1/#options)
|
|
38
|
+
- [`YAML.Document`](https://eemeli.org/yaml/v1/#yaml-documents)
|
|
39
|
+
- [`constructor(options)`](https://eemeli.org/yaml/v1/#creating-documents)
|
|
40
|
+
- [`defaults`](https://eemeli.org/yaml/v1/#options)
|
|
41
|
+
- [`#anchors`](https://eemeli.org/yaml/v1/#working-with-anchors)
|
|
42
|
+
- [`#contents`](https://eemeli.org/yaml/v1/#content-nodes)
|
|
43
|
+
- [`#errors`](https://eemeli.org/yaml/v1/#errors)
|
|
44
|
+
- [`YAML.parseAllDocuments(str, options): YAML.Document[]`](https://eemeli.org/yaml/v1/#parsing-documents)
|
|
45
|
+
- [`YAML.parseDocument(str, options): YAML.Document`](https://eemeli.org/yaml/v1/#parsing-documents)
|
|
46
46
|
|
|
47
47
|
```js
|
|
48
48
|
import { Pair, YAMLMap, YAMLSeq } from 'yaml/types'
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
- [`new Pair(key, value)`](https://eemeli.org/yaml/#creating-nodes)
|
|
52
|
-
- [`new YAMLMap()`](https://eemeli.org/yaml/#creating-nodes)
|
|
53
|
-
- [`new YAMLSeq()`](https://eemeli.org/yaml/#creating-nodes)
|
|
51
|
+
- [`new Pair(key, value)`](https://eemeli.org/yaml/v1/#creating-nodes)
|
|
52
|
+
- [`new YAMLMap()`](https://eemeli.org/yaml/v1/#creating-nodes)
|
|
53
|
+
- [`new YAMLSeq()`](https://eemeli.org/yaml/v1/#creating-nodes)
|
|
54
54
|
|
|
55
55
|
### CST Parser
|
|
56
56
|
|
|
@@ -58,8 +58,8 @@ import { Pair, YAMLMap, YAMLSeq } from 'yaml/types'
|
|
|
58
58
|
import parseCST from 'yaml/parse-cst'
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
- [`parseCST(str): CSTDocument[]`](https://eemeli.org/yaml/#parsecst)
|
|
62
|
-
- [`YAML.parseCST(str): CSTDocument[]`](https://eemeli.org/yaml/#parsecst)
|
|
61
|
+
- [`parseCST(str): CSTDocument[]`](https://eemeli.org/yaml/v1/#parsecst)
|
|
62
|
+
- [`YAML.parseCST(str): CSTDocument[]`](https://eemeli.org/yaml/v1/#parsecst)
|
|
63
63
|
|
|
64
64
|
## YAML.parse
|
|
65
65
|
|