decidim 0.27.3 → 0.27.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of decidim might be problematic. Click here for more details.

Files changed (223) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +16 -2
  3. data/babel.config.json +1 -4
  4. data/lib/decidim/release_manager.rb.new +43 -0
  5. data/lib/decidim/version.rb +1 -1
  6. data/package-lock.json +343 -255
  7. data/packages/browserslist-config/package.json +1 -1
  8. data/packages/core/node_modules/diff/CONTRIBUTING.md +39 -0
  9. data/packages/core/node_modules/diff/LICENSE +31 -0
  10. data/packages/core/node_modules/diff/README.md +211 -0
  11. data/packages/core/node_modules/diff/dist/diff.js +1627 -0
  12. data/packages/core/node_modules/diff/dist/diff.min.js +38 -0
  13. data/packages/core/node_modules/diff/lib/convert/dmp.js +32 -0
  14. data/packages/core/node_modules/diff/lib/convert/xml.js +42 -0
  15. data/packages/core/node_modules/diff/lib/diff/array.js +45 -0
  16. data/packages/core/node_modules/diff/lib/diff/base.js +307 -0
  17. data/packages/core/node_modules/diff/lib/diff/character.js +37 -0
  18. data/packages/core/node_modules/diff/lib/diff/css.js +41 -0
  19. data/packages/core/node_modules/diff/lib/diff/json.js +163 -0
  20. data/packages/core/node_modules/diff/lib/diff/line.js +89 -0
  21. data/packages/core/node_modules/diff/lib/diff/sentence.js +41 -0
  22. data/packages/core/node_modules/diff/lib/diff/word.js +108 -0
  23. data/packages/core/node_modules/diff/lib/index.es6.js +1561 -0
  24. data/packages/core/node_modules/diff/lib/index.js +216 -0
  25. data/packages/core/node_modules/diff/lib/index.mjs +1561 -0
  26. data/packages/core/node_modules/diff/lib/patch/apply.js +238 -0
  27. data/packages/core/node_modules/diff/lib/patch/create.js +272 -0
  28. data/packages/core/node_modules/diff/lib/patch/merge.js +613 -0
  29. data/packages/core/node_modules/diff/lib/patch/parse.js +167 -0
  30. data/packages/core/node_modules/diff/lib/util/array.js +32 -0
  31. data/packages/core/node_modules/diff/lib/util/distance-iterator.js +57 -0
  32. data/packages/core/node_modules/diff/lib/util/params.js +24 -0
  33. data/packages/core/node_modules/diff/package.json +87 -0
  34. data/packages/core/node_modules/diff/release-notes.md +309 -0
  35. data/packages/core/node_modules/diff/runtime.js +3 -0
  36. data/packages/core/package-lock.json +4889 -0
  37. data/packages/core/package.json +1 -1
  38. data/packages/dev/package.json +1 -1
  39. data/packages/elections/package.json +1 -1
  40. data/packages/eslint-config/package.json +1 -1
  41. data/packages/stylelint-config/package.json +1 -1
  42. data/packages/webpacker/node_modules/argparse/CHANGELOG.md +216 -0
  43. data/packages/webpacker/node_modules/argparse/LICENSE +254 -0
  44. data/packages/webpacker/node_modules/argparse/README.md +84 -0
  45. data/packages/webpacker/node_modules/argparse/argparse.js +3707 -0
  46. data/packages/webpacker/node_modules/argparse/lib/sub.js +67 -0
  47. data/packages/webpacker/node_modules/argparse/lib/textwrap.js +440 -0
  48. data/packages/webpacker/node_modules/argparse/package.json +31 -0
  49. data/packages/{core/node_modules/uuid/LICENSE.md → webpacker/node_modules/brace-expansion/LICENSE} +2 -2
  50. data/packages/webpacker/node_modules/brace-expansion/README.md +135 -0
  51. data/packages/webpacker/node_modules/brace-expansion/index.js +203 -0
  52. data/packages/webpacker/node_modules/brace-expansion/package.json +46 -0
  53. data/packages/webpacker/node_modules/glob/LICENSE +15 -0
  54. data/packages/webpacker/node_modules/glob/README.md +1214 -0
  55. data/packages/webpacker/node_modules/glob/dist/cjs/package.json +4 -0
  56. data/packages/webpacker/node_modules/glob/dist/cjs/src/bin.d.ts +3 -0
  57. data/packages/webpacker/node_modules/glob/dist/cjs/src/bin.d.ts.map +1 -0
  58. data/packages/webpacker/node_modules/glob/dist/cjs/src/bin.js +270 -0
  59. data/packages/webpacker/node_modules/glob/dist/cjs/src/bin.js.map +1 -0
  60. data/packages/webpacker/node_modules/glob/dist/cjs/src/glob.d.ts +344 -0
  61. data/packages/webpacker/node_modules/glob/dist/cjs/src/glob.d.ts.map +1 -0
  62. data/packages/webpacker/node_modules/glob/dist/cjs/src/glob.js +238 -0
  63. data/packages/webpacker/node_modules/glob/dist/cjs/src/glob.js.map +1 -0
  64. data/packages/webpacker/node_modules/glob/dist/cjs/src/has-magic.d.ts +14 -0
  65. data/packages/webpacker/node_modules/glob/dist/cjs/src/has-magic.d.ts.map +1 -0
  66. data/packages/webpacker/node_modules/glob/dist/cjs/src/has-magic.js +27 -0
  67. data/packages/webpacker/node_modules/glob/dist/cjs/src/has-magic.js.map +1 -0
  68. data/packages/webpacker/node_modules/glob/dist/cjs/src/ignore.d.ts +20 -0
  69. data/packages/webpacker/node_modules/glob/dist/cjs/src/ignore.d.ts.map +1 -0
  70. data/packages/webpacker/node_modules/glob/dist/cjs/src/ignore.js +103 -0
  71. data/packages/webpacker/node_modules/glob/dist/cjs/src/ignore.js.map +1 -0
  72. data/packages/webpacker/node_modules/glob/dist/cjs/src/index.d.ts +95 -0
  73. data/packages/webpacker/node_modules/glob/dist/cjs/src/index.d.ts.map +1 -0
  74. data/packages/webpacker/node_modules/glob/dist/cjs/src/index.js +68 -0
  75. data/packages/webpacker/node_modules/glob/dist/cjs/src/index.js.map +1 -0
  76. data/packages/webpacker/node_modules/glob/dist/cjs/src/pattern.d.ts +77 -0
  77. data/packages/webpacker/node_modules/glob/dist/cjs/src/pattern.d.ts.map +1 -0
  78. data/packages/webpacker/node_modules/glob/dist/cjs/src/pattern.js +219 -0
  79. data/packages/webpacker/node_modules/glob/dist/cjs/src/pattern.js.map +1 -0
  80. data/packages/webpacker/node_modules/glob/dist/cjs/src/processor.d.ts +59 -0
  81. data/packages/webpacker/node_modules/glob/dist/cjs/src/processor.d.ts.map +1 -0
  82. data/packages/webpacker/node_modules/glob/dist/cjs/src/processor.js +309 -0
  83. data/packages/webpacker/node_modules/glob/dist/cjs/src/processor.js.map +1 -0
  84. data/packages/webpacker/node_modules/glob/dist/cjs/src/walker.d.ts +96 -0
  85. data/packages/webpacker/node_modules/glob/dist/cjs/src/walker.d.ts.map +1 -0
  86. data/packages/webpacker/node_modules/glob/dist/cjs/src/walker.js +358 -0
  87. data/packages/webpacker/node_modules/glob/dist/cjs/src/walker.js.map +1 -0
  88. data/packages/webpacker/node_modules/glob/dist/mjs/glob.d.ts +344 -0
  89. data/packages/webpacker/node_modules/glob/dist/mjs/glob.d.ts.map +1 -0
  90. data/packages/webpacker/node_modules/glob/dist/mjs/glob.js +234 -0
  91. data/packages/webpacker/node_modules/glob/dist/mjs/glob.js.map +1 -0
  92. data/packages/webpacker/node_modules/glob/dist/mjs/has-magic.d.ts +14 -0
  93. data/packages/webpacker/node_modules/glob/dist/mjs/has-magic.d.ts.map +1 -0
  94. data/packages/webpacker/node_modules/glob/dist/mjs/has-magic.js +23 -0
  95. data/packages/webpacker/node_modules/glob/dist/mjs/has-magic.js.map +1 -0
  96. data/packages/webpacker/node_modules/glob/dist/mjs/ignore.d.ts +20 -0
  97. data/packages/webpacker/node_modules/glob/dist/mjs/ignore.d.ts.map +1 -0
  98. data/packages/webpacker/node_modules/glob/dist/mjs/ignore.js +99 -0
  99. data/packages/webpacker/node_modules/glob/dist/mjs/ignore.js.map +1 -0
  100. data/packages/webpacker/node_modules/glob/dist/mjs/index.d.ts +95 -0
  101. data/packages/webpacker/node_modules/glob/dist/mjs/index.d.ts.map +1 -0
  102. data/packages/webpacker/node_modules/glob/dist/mjs/index.js +56 -0
  103. data/packages/webpacker/node_modules/glob/dist/mjs/index.js.map +1 -0
  104. data/packages/webpacker/node_modules/glob/dist/mjs/package.json +4 -0
  105. data/packages/webpacker/node_modules/glob/dist/mjs/pattern.d.ts +77 -0
  106. data/packages/webpacker/node_modules/glob/dist/mjs/pattern.d.ts.map +1 -0
  107. data/packages/webpacker/node_modules/glob/dist/mjs/pattern.js +215 -0
  108. data/packages/webpacker/node_modules/glob/dist/mjs/pattern.js.map +1 -0
  109. data/packages/webpacker/node_modules/glob/dist/mjs/processor.d.ts +59 -0
  110. data/packages/webpacker/node_modules/glob/dist/mjs/processor.d.ts.map +1 -0
  111. data/packages/webpacker/node_modules/glob/dist/mjs/processor.js +302 -0
  112. data/packages/webpacker/node_modules/glob/dist/mjs/processor.js.map +1 -0
  113. data/packages/webpacker/node_modules/glob/dist/mjs/walker.d.ts +96 -0
  114. data/packages/webpacker/node_modules/glob/dist/mjs/walker.d.ts.map +1 -0
  115. data/packages/webpacker/node_modules/glob/dist/mjs/walker.js +352 -0
  116. data/packages/webpacker/node_modules/glob/dist/mjs/walker.js.map +1 -0
  117. data/packages/webpacker/node_modules/glob/package.json +98 -0
  118. data/packages/webpacker/node_modules/js-yaml/CHANGELOG.md +616 -0
  119. data/packages/webpacker/node_modules/js-yaml/LICENSE +21 -0
  120. data/packages/webpacker/node_modules/js-yaml/README.md +246 -0
  121. data/packages/webpacker/node_modules/js-yaml/bin/js-yaml.js +126 -0
  122. data/packages/webpacker/node_modules/js-yaml/dist/js-yaml.js +3874 -0
  123. data/packages/webpacker/node_modules/js-yaml/dist/js-yaml.min.js +2 -0
  124. data/packages/webpacker/node_modules/js-yaml/dist/js-yaml.mjs +3851 -0
  125. data/packages/webpacker/node_modules/js-yaml/index.js +47 -0
  126. data/packages/webpacker/node_modules/js-yaml/lib/common.js +59 -0
  127. data/packages/webpacker/node_modules/js-yaml/lib/dumper.js +965 -0
  128. data/packages/webpacker/node_modules/js-yaml/lib/exception.js +55 -0
  129. data/packages/webpacker/node_modules/js-yaml/lib/loader.js +1727 -0
  130. data/packages/webpacker/node_modules/js-yaml/lib/schema/core.js +11 -0
  131. data/packages/webpacker/node_modules/js-yaml/lib/schema/default.js +22 -0
  132. data/packages/webpacker/node_modules/js-yaml/lib/schema/failsafe.js +17 -0
  133. data/packages/webpacker/node_modules/js-yaml/lib/schema/json.js +19 -0
  134. data/packages/webpacker/node_modules/js-yaml/lib/schema.js +121 -0
  135. data/packages/webpacker/node_modules/js-yaml/lib/snippet.js +101 -0
  136. data/packages/webpacker/node_modules/js-yaml/lib/type/binary.js +125 -0
  137. data/packages/webpacker/node_modules/js-yaml/lib/type/bool.js +35 -0
  138. data/packages/webpacker/node_modules/js-yaml/lib/type/float.js +97 -0
  139. data/packages/webpacker/node_modules/js-yaml/lib/type/int.js +156 -0
  140. data/packages/webpacker/node_modules/js-yaml/lib/type/map.js +8 -0
  141. data/packages/webpacker/node_modules/js-yaml/lib/type/merge.js +12 -0
  142. data/packages/webpacker/node_modules/js-yaml/lib/type/null.js +35 -0
  143. data/packages/webpacker/node_modules/js-yaml/lib/type/omap.js +44 -0
  144. data/packages/webpacker/node_modules/js-yaml/lib/type/pairs.js +53 -0
  145. data/packages/webpacker/node_modules/js-yaml/lib/type/seq.js +8 -0
  146. data/packages/webpacker/node_modules/js-yaml/lib/type/set.js +29 -0
  147. data/packages/webpacker/node_modules/js-yaml/lib/type/str.js +8 -0
  148. data/packages/webpacker/node_modules/js-yaml/lib/type/timestamp.js +88 -0
  149. data/packages/webpacker/node_modules/js-yaml/lib/type.js +66 -0
  150. data/packages/webpacker/node_modules/js-yaml/package.json +66 -0
  151. data/packages/webpacker/node_modules/minimatch/LICENSE +15 -0
  152. data/packages/webpacker/node_modules/minimatch/README.md +454 -0
  153. data/packages/webpacker/node_modules/minimatch/dist/cjs/assert-valid-pattern.d.ts +2 -0
  154. data/packages/webpacker/node_modules/minimatch/dist/cjs/assert-valid-pattern.d.ts.map +1 -0
  155. data/packages/webpacker/node_modules/minimatch/dist/cjs/assert-valid-pattern.js +14 -0
  156. data/packages/webpacker/node_modules/minimatch/dist/cjs/assert-valid-pattern.js.map +1 -0
  157. data/packages/webpacker/node_modules/minimatch/dist/cjs/ast.d.ts +19 -0
  158. data/packages/webpacker/node_modules/minimatch/dist/cjs/ast.d.ts.map +1 -0
  159. data/packages/webpacker/node_modules/minimatch/dist/cjs/ast.js +589 -0
  160. data/packages/webpacker/node_modules/minimatch/dist/cjs/ast.js.map +1 -0
  161. data/packages/webpacker/node_modules/minimatch/dist/cjs/brace-expressions.d.ts +8 -0
  162. data/packages/webpacker/node_modules/minimatch/dist/cjs/brace-expressions.d.ts.map +1 -0
  163. data/packages/webpacker/node_modules/minimatch/dist/cjs/brace-expressions.js +152 -0
  164. data/packages/webpacker/node_modules/minimatch/dist/cjs/brace-expressions.js.map +1 -0
  165. data/packages/webpacker/node_modules/minimatch/dist/cjs/escape.d.ts +12 -0
  166. data/packages/webpacker/node_modules/minimatch/dist/cjs/escape.d.ts.map +1 -0
  167. data/packages/webpacker/node_modules/minimatch/dist/cjs/escape.js +22 -0
  168. data/packages/webpacker/node_modules/minimatch/dist/cjs/escape.js.map +1 -0
  169. data/packages/webpacker/node_modules/minimatch/dist/cjs/index.d.ts +94 -0
  170. data/packages/webpacker/node_modules/minimatch/dist/cjs/index.d.ts.map +1 -0
  171. data/packages/webpacker/node_modules/minimatch/dist/cjs/index.js +1011 -0
  172. data/packages/webpacker/node_modules/minimatch/dist/cjs/index.js.map +1 -0
  173. data/packages/webpacker/node_modules/minimatch/dist/cjs/package.json +3 -0
  174. data/packages/webpacker/node_modules/minimatch/dist/cjs/unescape.d.ts +17 -0
  175. data/packages/webpacker/node_modules/minimatch/dist/cjs/unescape.d.ts.map +1 -0
  176. data/packages/webpacker/node_modules/minimatch/dist/cjs/unescape.js +24 -0
  177. data/packages/webpacker/node_modules/minimatch/dist/cjs/unescape.js.map +1 -0
  178. data/packages/webpacker/node_modules/minimatch/dist/mjs/assert-valid-pattern.d.ts +2 -0
  179. data/packages/webpacker/node_modules/minimatch/dist/mjs/assert-valid-pattern.d.ts.map +1 -0
  180. data/packages/webpacker/node_modules/minimatch/dist/mjs/assert-valid-pattern.js +10 -0
  181. data/packages/webpacker/node_modules/minimatch/dist/mjs/assert-valid-pattern.js.map +1 -0
  182. data/packages/webpacker/node_modules/minimatch/dist/mjs/ast.d.ts +19 -0
  183. data/packages/webpacker/node_modules/minimatch/dist/mjs/ast.d.ts.map +1 -0
  184. data/packages/webpacker/node_modules/minimatch/dist/mjs/ast.js +585 -0
  185. data/packages/webpacker/node_modules/minimatch/dist/mjs/ast.js.map +1 -0
  186. data/packages/webpacker/node_modules/minimatch/dist/mjs/brace-expressions.d.ts +8 -0
  187. data/packages/webpacker/node_modules/minimatch/dist/mjs/brace-expressions.d.ts.map +1 -0
  188. data/packages/webpacker/node_modules/minimatch/dist/mjs/brace-expressions.js +148 -0
  189. data/packages/webpacker/node_modules/minimatch/dist/mjs/brace-expressions.js.map +1 -0
  190. data/packages/webpacker/node_modules/minimatch/dist/mjs/escape.d.ts +12 -0
  191. data/packages/webpacker/node_modules/minimatch/dist/mjs/escape.d.ts.map +1 -0
  192. data/packages/webpacker/node_modules/minimatch/dist/mjs/escape.js +18 -0
  193. data/packages/webpacker/node_modules/minimatch/dist/mjs/escape.js.map +1 -0
  194. data/packages/webpacker/node_modules/minimatch/dist/mjs/index.d.ts +94 -0
  195. data/packages/webpacker/node_modules/minimatch/dist/mjs/index.d.ts.map +1 -0
  196. data/packages/webpacker/node_modules/minimatch/dist/mjs/index.js +995 -0
  197. data/packages/webpacker/node_modules/minimatch/dist/mjs/index.js.map +1 -0
  198. data/packages/webpacker/node_modules/minimatch/dist/mjs/package.json +3 -0
  199. data/packages/webpacker/node_modules/minimatch/dist/mjs/unescape.d.ts +17 -0
  200. data/packages/webpacker/node_modules/minimatch/dist/mjs/unescape.d.ts.map +1 -0
  201. data/packages/webpacker/node_modules/minimatch/dist/mjs/unescape.js +20 -0
  202. data/packages/webpacker/node_modules/minimatch/dist/mjs/unescape.js.map +1 -0
  203. data/packages/webpacker/node_modules/minimatch/package.json +86 -0
  204. data/packages/webpacker/package.json +2 -2
  205. metadata +237 -64
  206. data/packages/core/node_modules/uuid/AUTHORS +0 -5
  207. data/packages/core/node_modules/uuid/CHANGELOG.md +0 -119
  208. data/packages/core/node_modules/uuid/README.md +0 -276
  209. data/packages/core/node_modules/uuid/bin/uuid +0 -65
  210. data/packages/core/node_modules/uuid/index.js +0 -8
  211. data/packages/core/node_modules/uuid/lib/bytesToUuid.js +0 -26
  212. data/packages/core/node_modules/uuid/lib/md5-browser.js +0 -216
  213. data/packages/core/node_modules/uuid/lib/md5.js +0 -25
  214. data/packages/core/node_modules/uuid/lib/rng-browser.js +0 -34
  215. data/packages/core/node_modules/uuid/lib/rng.js +0 -8
  216. data/packages/core/node_modules/uuid/lib/sha1-browser.js +0 -89
  217. data/packages/core/node_modules/uuid/lib/sha1.js +0 -25
  218. data/packages/core/node_modules/uuid/lib/v35.js +0 -57
  219. data/packages/core/node_modules/uuid/package.json +0 -49
  220. data/packages/core/node_modules/uuid/v1.js +0 -109
  221. data/packages/core/node_modules/uuid/v3.js +0 -4
  222. data/packages/core/node_modules/uuid/v4.js +0 -29
  223. data/packages/core/node_modules/uuid/v5.js +0 -3
@@ -0,0 +1,246 @@
1
+ JS-YAML - YAML 1.2 parser / writer for JavaScript
2
+ =================================================
3
+
4
+ [![CI](https://github.com/nodeca/js-yaml/workflows/CI/badge.svg?branch=master)](https://github.com/nodeca/js-yaml/actions)
5
+ [![NPM version](https://img.shields.io/npm/v/js-yaml.svg)](https://www.npmjs.org/package/js-yaml)
6
+
7
+ __[Online Demo](http://nodeca.github.com/js-yaml/)__
8
+
9
+
10
+ This is an implementation of [YAML](http://yaml.org/), a human-friendly data
11
+ serialization language. Started as [PyYAML](http://pyyaml.org/) port, it was
12
+ completely rewritten from scratch. Now it's very fast, and supports 1.2 spec.
13
+
14
+
15
+ Installation
16
+ ------------
17
+
18
+ ### YAML module for node.js
19
+
20
+ ```
21
+ npm install js-yaml
22
+ ```
23
+
24
+
25
+ ### CLI executable
26
+
27
+ If you want to inspect your YAML files from CLI, install js-yaml globally:
28
+
29
+ ```
30
+ npm install -g js-yaml
31
+ ```
32
+
33
+ #### Usage
34
+
35
+ ```
36
+ usage: js-yaml [-h] [-v] [-c] [-t] file
37
+
38
+ Positional arguments:
39
+ file File with YAML document(s)
40
+
41
+ Optional arguments:
42
+ -h, --help Show this help message and exit.
43
+ -v, --version Show program's version number and exit.
44
+ -c, --compact Display errors in compact mode
45
+ -t, --trace Show stack trace on error
46
+ ```
47
+
48
+
49
+ API
50
+ ---
51
+
52
+ Here we cover the most 'useful' methods. If you need advanced details (creating
53
+ your own tags), see [examples](https://github.com/nodeca/js-yaml/tree/master/examples)
54
+ for more info.
55
+
56
+ ``` javascript
57
+ const yaml = require('js-yaml');
58
+ const fs = require('fs');
59
+
60
+ // Get document, or throw exception on error
61
+ try {
62
+ const doc = yaml.load(fs.readFileSync('/home/ixti/example.yml', 'utf8'));
63
+ console.log(doc);
64
+ } catch (e) {
65
+ console.log(e);
66
+ }
67
+ ```
68
+
69
+
70
+ ### load (string [ , options ])
71
+
72
+ Parses `string` as single YAML document. Returns either a
73
+ plain object, a string, a number, `null` or `undefined`, or throws `YAMLException` on error. By default, does
74
+ not support regexps, functions and undefined.
75
+
76
+ options:
77
+
78
+ - `filename` _(default: null)_ - string to be used as a file path in
79
+ error/warning messages.
80
+ - `onWarning` _(default: null)_ - function to call on warning messages.
81
+ Loader will call this function with an instance of `YAMLException` for each warning.
82
+ - `schema` _(default: `DEFAULT_SCHEMA`)_ - specifies a schema to use.
83
+ - `FAILSAFE_SCHEMA` - only strings, arrays and plain objects:
84
+ http://www.yaml.org/spec/1.2/spec.html#id2802346
85
+ - `JSON_SCHEMA` - all JSON-supported types:
86
+ http://www.yaml.org/spec/1.2/spec.html#id2803231
87
+ - `CORE_SCHEMA` - same as `JSON_SCHEMA`:
88
+ http://www.yaml.org/spec/1.2/spec.html#id2804923
89
+ - `DEFAULT_SCHEMA` - all supported YAML types.
90
+ - `json` _(default: false)_ - compatibility with JSON.parse behaviour. If true, then duplicate keys in a mapping will override values rather than throwing an error.
91
+
92
+ NOTE: This function **does not** understand multi-document sources, it throws
93
+ exception on those.
94
+
95
+ NOTE: JS-YAML **does not** support schema-specific tag resolution restrictions.
96
+ So, the JSON schema is not as strictly defined in the YAML specification.
97
+ It allows numbers in any notation, use `Null` and `NULL` as `null`, etc.
98
+ The core schema also has no such restrictions. It allows binary notation for integers.
99
+
100
+
101
+ ### loadAll (string [, iterator] [, options ])
102
+
103
+ Same as `load()`, but understands multi-document sources. Applies
104
+ `iterator` to each document if specified, or returns array of documents.
105
+
106
+ ``` javascript
107
+ const yaml = require('js-yaml');
108
+
109
+ yaml.loadAll(data, function (doc) {
110
+ console.log(doc);
111
+ });
112
+ ```
113
+
114
+
115
+ ### dump (object [ , options ])
116
+
117
+ Serializes `object` as a YAML document. Uses `DEFAULT_SCHEMA`, so it will
118
+ throw an exception if you try to dump regexps or functions. However, you can
119
+ disable exceptions by setting the `skipInvalid` option to `true`.
120
+
121
+ options:
122
+
123
+ - `indent` _(default: 2)_ - indentation width to use (in spaces).
124
+ - `noArrayIndent` _(default: false)_ - when true, will not add an indentation level to array elements
125
+ - `skipInvalid` _(default: false)_ - do not throw on invalid types (like function
126
+ in the safe schema) and skip pairs and single values with such types.
127
+ - `flowLevel` _(default: -1)_ - specifies level of nesting, when to switch from
128
+ block to flow style for collections. -1 means block style everwhere
129
+ - `styles` - "tag" => "style" map. Each tag may have own set of styles.
130
+ - `schema` _(default: `DEFAULT_SCHEMA`)_ specifies a schema to use.
131
+ - `sortKeys` _(default: `false`)_ - if `true`, sort keys when dumping YAML. If a
132
+ function, use the function to sort the keys.
133
+ - `lineWidth` _(default: `80`)_ - set max line width. Set `-1` for unlimited width.
134
+ - `noRefs` _(default: `false`)_ - if `true`, don't convert duplicate objects into references
135
+ - `noCompatMode` _(default: `false`)_ - if `true` don't try to be compatible with older
136
+ yaml versions. Currently: don't quote "yes", "no" and so on, as required for YAML 1.1
137
+ - `condenseFlow` _(default: `false`)_ - if `true` flow sequences will be condensed, omitting the space between `a, b`. Eg. `'[a,b]'`, and omitting the space between `key: value` and quoting the key. Eg. `'{"a":b}'` Can be useful when using yaml for pretty URL query params as spaces are %-encoded.
138
+ - `quotingType` _(`'` or `"`, default: `'`)_ - strings will be quoted using this quoting style. If you specify single quotes, double quotes will still be used for non-printable characters.
139
+ - `forceQuotes` _(default: `false`)_ - if `true`, all non-key strings will be quoted even if they normally don't need to.
140
+ - `replacer` - callback `function (key, value)` called recursively on each key/value in source object (see `replacer` docs for `JSON.stringify`).
141
+
142
+ The following table show availlable styles (e.g. "canonical",
143
+ "binary"...) available for each tag (.e.g. !!null, !!int ...). Yaml
144
+ output is shown on the right side after `=>` (default setting) or `->`:
145
+
146
+ ``` none
147
+ !!null
148
+ "canonical" -> "~"
149
+ "lowercase" => "null"
150
+ "uppercase" -> "NULL"
151
+ "camelcase" -> "Null"
152
+
153
+ !!int
154
+ "binary" -> "0b1", "0b101010", "0b1110001111010"
155
+ "octal" -> "0o1", "0o52", "0o16172"
156
+ "decimal" => "1", "42", "7290"
157
+ "hexadecimal" -> "0x1", "0x2A", "0x1C7A"
158
+
159
+ !!bool
160
+ "lowercase" => "true", "false"
161
+ "uppercase" -> "TRUE", "FALSE"
162
+ "camelcase" -> "True", "False"
163
+
164
+ !!float
165
+ "lowercase" => ".nan", '.inf'
166
+ "uppercase" -> ".NAN", '.INF'
167
+ "camelcase" -> ".NaN", '.Inf'
168
+ ```
169
+
170
+ Example:
171
+
172
+ ``` javascript
173
+ dump(object, {
174
+ 'styles': {
175
+ '!!null': 'canonical' // dump null as ~
176
+ },
177
+ 'sortKeys': true // sort object keys
178
+ });
179
+ ```
180
+
181
+ Supported YAML types
182
+ --------------------
183
+
184
+ The list of standard YAML tags and corresponding JavaScript types. See also
185
+ [YAML tag discussion](http://pyyaml.org/wiki/YAMLTagDiscussion) and
186
+ [YAML types repository](http://yaml.org/type/).
187
+
188
+ ```
189
+ !!null '' # null
190
+ !!bool 'yes' # bool
191
+ !!int '3...' # number
192
+ !!float '3.14...' # number
193
+ !!binary '...base64...' # buffer
194
+ !!timestamp 'YYYY-...' # date
195
+ !!omap [ ... ] # array of key-value pairs
196
+ !!pairs [ ... ] # array or array pairs
197
+ !!set { ... } # array of objects with given keys and null values
198
+ !!str '...' # string
199
+ !!seq [ ... ] # array
200
+ !!map { ... } # object
201
+ ```
202
+
203
+ **JavaScript-specific tags**
204
+
205
+ See [js-yaml-js-types](https://github.com/nodeca/js-yaml-js-types) for
206
+ extra types.
207
+
208
+
209
+ Caveats
210
+ -------
211
+
212
+ Note, that you use arrays or objects as key in JS-YAML. JS does not allow objects
213
+ or arrays as keys, and stringifies (by calling `toString()` method) them at the
214
+ moment of adding them.
215
+
216
+ ``` yaml
217
+ ---
218
+ ? [ foo, bar ]
219
+ : - baz
220
+ ? { foo: bar }
221
+ : - baz
222
+ - baz
223
+ ```
224
+
225
+ ``` javascript
226
+ { "foo,bar": ["baz"], "[object Object]": ["baz", "baz"] }
227
+ ```
228
+
229
+ Also, reading of properties on implicit block mapping keys is not supported yet.
230
+ So, the following YAML document cannot be loaded.
231
+
232
+ ``` yaml
233
+ &anchor foo:
234
+ foo: bar
235
+ *anchor: duplicate key
236
+ baz: bat
237
+ *anchor: duplicate key
238
+ ```
239
+
240
+
241
+ js-yaml for enterprise
242
+ ----------------------
243
+
244
+ Available as part of the Tidelift Subscription
245
+
246
+ The maintainers of js-yaml and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-js-yaml?utm_source=npm-js-yaml&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
@@ -0,0 +1,126 @@
1
+ #!/usr/bin/env node
2
+
3
+
4
+ 'use strict';
5
+
6
+ /*eslint-disable no-console*/
7
+
8
+
9
+ var fs = require('fs');
10
+ var argparse = require('argparse');
11
+ var yaml = require('..');
12
+
13
+
14
+ ////////////////////////////////////////////////////////////////////////////////
15
+
16
+
17
+ var cli = new argparse.ArgumentParser({
18
+ prog: 'js-yaml',
19
+ add_help: true
20
+ });
21
+
22
+ cli.add_argument('-v', '--version', {
23
+ action: 'version',
24
+ version: require('../package.json').version
25
+ });
26
+
27
+ cli.add_argument('-c', '--compact', {
28
+ help: 'Display errors in compact mode',
29
+ action: 'store_true'
30
+ });
31
+
32
+ // deprecated (not needed after we removed output colors)
33
+ // option suppressed, but not completely removed for compatibility
34
+ cli.add_argument('-j', '--to-json', {
35
+ help: argparse.SUPPRESS,
36
+ dest: 'json',
37
+ action: 'store_true'
38
+ });
39
+
40
+ cli.add_argument('-t', '--trace', {
41
+ help: 'Show stack trace on error',
42
+ action: 'store_true'
43
+ });
44
+
45
+ cli.add_argument('file', {
46
+ help: 'File to read, utf-8 encoded without BOM',
47
+ nargs: '?',
48
+ default: '-'
49
+ });
50
+
51
+
52
+ ////////////////////////////////////////////////////////////////////////////////
53
+
54
+
55
+ var options = cli.parse_args();
56
+
57
+
58
+ ////////////////////////////////////////////////////////////////////////////////
59
+
60
+ function readFile(filename, encoding, callback) {
61
+ if (options.file === '-') {
62
+ // read from stdin
63
+
64
+ var chunks = [];
65
+
66
+ process.stdin.on('data', function (chunk) {
67
+ chunks.push(chunk);
68
+ });
69
+
70
+ process.stdin.on('end', function () {
71
+ return callback(null, Buffer.concat(chunks).toString(encoding));
72
+ });
73
+ } else {
74
+ fs.readFile(filename, encoding, callback);
75
+ }
76
+ }
77
+
78
+ readFile(options.file, 'utf8', function (error, input) {
79
+ var output, isYaml;
80
+
81
+ if (error) {
82
+ if (error.code === 'ENOENT') {
83
+ console.error('File not found: ' + options.file);
84
+ process.exit(2);
85
+ }
86
+
87
+ console.error(
88
+ options.trace && error.stack ||
89
+ error.message ||
90
+ String(error));
91
+
92
+ process.exit(1);
93
+ }
94
+
95
+ try {
96
+ output = JSON.parse(input);
97
+ isYaml = false;
98
+ } catch (err) {
99
+ if (err instanceof SyntaxError) {
100
+ try {
101
+ output = [];
102
+ yaml.loadAll(input, function (doc) { output.push(doc); }, {});
103
+ isYaml = true;
104
+
105
+ if (output.length === 0) output = null;
106
+ else if (output.length === 1) output = output[0];
107
+
108
+ } catch (e) {
109
+ if (options.trace && err.stack) console.error(e.stack);
110
+ else console.error(e.toString(options.compact));
111
+
112
+ process.exit(1);
113
+ }
114
+ } else {
115
+ console.error(
116
+ options.trace && err.stack ||
117
+ err.message ||
118
+ String(err));
119
+
120
+ process.exit(1);
121
+ }
122
+ }
123
+
124
+ if (isYaml) console.log(JSON.stringify(output, null, ' '));
125
+ else console.log(yaml.dump(output));
126
+ });