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,67 @@
1
+ // Limited implementation of python % string operator, supports only %s and %r for now
2
+ // (other formats are not used here, but may appear in custom templates)
3
+
4
+ 'use strict'
5
+
6
+ const { inspect } = require('util')
7
+
8
+
9
+ module.exports = function sub(pattern, ...values) {
10
+ let regex = /%(?:(%)|(-)?(\*)?(?:\((\w+)\))?([A-Za-z]))/g
11
+
12
+ let result = pattern.replace(regex, function (_, is_literal, is_left_align, is_padded, name, format) {
13
+ if (is_literal) return '%'
14
+
15
+ let padded_count = 0
16
+ if (is_padded) {
17
+ if (values.length === 0) throw new TypeError('not enough arguments for format string')
18
+ padded_count = values.shift()
19
+ if (!Number.isInteger(padded_count)) throw new TypeError('* wants int')
20
+ }
21
+
22
+ let str
23
+ if (name !== undefined) {
24
+ let dict = values[0]
25
+ if (typeof dict !== 'object' || dict === null) throw new TypeError('format requires a mapping')
26
+ if (!(name in dict)) throw new TypeError(`no such key: '${name}'`)
27
+ str = dict[name]
28
+ } else {
29
+ if (values.length === 0) throw new TypeError('not enough arguments for format string')
30
+ str = values.shift()
31
+ }
32
+
33
+ switch (format) {
34
+ case 's':
35
+ str = String(str)
36
+ break
37
+ case 'r':
38
+ str = inspect(str)
39
+ break
40
+ case 'd':
41
+ case 'i':
42
+ if (typeof str !== 'number') {
43
+ throw new TypeError(`%${format} format: a number is required, not ${typeof str}`)
44
+ }
45
+ str = String(str.toFixed(0))
46
+ break
47
+ default:
48
+ throw new TypeError(`unsupported format character '${format}'`)
49
+ }
50
+
51
+ if (padded_count > 0) {
52
+ return is_left_align ? str.padEnd(padded_count) : str.padStart(padded_count)
53
+ } else {
54
+ return str
55
+ }
56
+ })
57
+
58
+ if (values.length) {
59
+ if (values.length === 1 && typeof values[0] === 'object' && values[0] !== null) {
60
+ // mapping
61
+ } else {
62
+ throw new TypeError('not all arguments converted during string formatting')
63
+ }
64
+ }
65
+
66
+ return result
67
+ }
@@ -0,0 +1,440 @@
1
+ // Partial port of python's argparse module, version 3.9.0 (only wrap and fill functions):
2
+ // https://github.com/python/cpython/blob/v3.9.0b4/Lib/textwrap.py
3
+
4
+ 'use strict'
5
+
6
+ /*
7
+ * Text wrapping and filling.
8
+ */
9
+
10
+ // Copyright (C) 1999-2001 Gregory P. Ward.
11
+ // Copyright (C) 2002, 2003 Python Software Foundation.
12
+ // Copyright (C) 2020 argparse.js authors
13
+ // Originally written by Greg Ward <gward@python.net>
14
+
15
+ // Hardcode the recognized whitespace characters to the US-ASCII
16
+ // whitespace characters. The main reason for doing this is that
17
+ // some Unicode spaces (like \u00a0) are non-breaking whitespaces.
18
+ //
19
+ // This less funky little regex just split on recognized spaces. E.g.
20
+ // "Hello there -- you goof-ball, use the -b option!"
21
+ // splits into
22
+ // Hello/ /there/ /--/ /you/ /goof-ball,/ /use/ /the/ /-b/ /option!/
23
+ const wordsep_simple_re = /([\t\n\x0b\x0c\r ]+)/
24
+
25
+ class TextWrapper {
26
+ /*
27
+ * Object for wrapping/filling text. The public interface consists of
28
+ * the wrap() and fill() methods; the other methods are just there for
29
+ * subclasses to override in order to tweak the default behaviour.
30
+ * If you want to completely replace the main wrapping algorithm,
31
+ * you'll probably have to override _wrap_chunks().
32
+ *
33
+ * Several instance attributes control various aspects of wrapping:
34
+ * width (default: 70)
35
+ * the maximum width of wrapped lines (unless break_long_words
36
+ * is false)
37
+ * initial_indent (default: "")
38
+ * string that will be prepended to the first line of wrapped
39
+ * output. Counts towards the line's width.
40
+ * subsequent_indent (default: "")
41
+ * string that will be prepended to all lines save the first
42
+ * of wrapped output; also counts towards each line's width.
43
+ * expand_tabs (default: true)
44
+ * Expand tabs in input text to spaces before further processing.
45
+ * Each tab will become 0 .. 'tabsize' spaces, depending on its position
46
+ * in its line. If false, each tab is treated as a single character.
47
+ * tabsize (default: 8)
48
+ * Expand tabs in input text to 0 .. 'tabsize' spaces, unless
49
+ * 'expand_tabs' is false.
50
+ * replace_whitespace (default: true)
51
+ * Replace all whitespace characters in the input text by spaces
52
+ * after tab expansion. Note that if expand_tabs is false and
53
+ * replace_whitespace is true, every tab will be converted to a
54
+ * single space!
55
+ * fix_sentence_endings (default: false)
56
+ * Ensure that sentence-ending punctuation is always followed
57
+ * by two spaces. Off by default because the algorithm is
58
+ * (unavoidably) imperfect.
59
+ * break_long_words (default: true)
60
+ * Break words longer than 'width'. If false, those words will not
61
+ * be broken, and some lines might be longer than 'width'.
62
+ * break_on_hyphens (default: true)
63
+ * Allow breaking hyphenated words. If true, wrapping will occur
64
+ * preferably on whitespaces and right after hyphens part of
65
+ * compound words.
66
+ * drop_whitespace (default: true)
67
+ * Drop leading and trailing whitespace from lines.
68
+ * max_lines (default: None)
69
+ * Truncate wrapped lines.
70
+ * placeholder (default: ' [...]')
71
+ * Append to the last line of truncated text.
72
+ */
73
+
74
+ constructor(options = {}) {
75
+ let {
76
+ width = 70,
77
+ initial_indent = '',
78
+ subsequent_indent = '',
79
+ expand_tabs = true,
80
+ replace_whitespace = true,
81
+ fix_sentence_endings = false,
82
+ break_long_words = true,
83
+ drop_whitespace = true,
84
+ break_on_hyphens = true,
85
+ tabsize = 8,
86
+ max_lines = undefined,
87
+ placeholder=' [...]'
88
+ } = options
89
+
90
+ this.width = width
91
+ this.initial_indent = initial_indent
92
+ this.subsequent_indent = subsequent_indent
93
+ this.expand_tabs = expand_tabs
94
+ this.replace_whitespace = replace_whitespace
95
+ this.fix_sentence_endings = fix_sentence_endings
96
+ this.break_long_words = break_long_words
97
+ this.drop_whitespace = drop_whitespace
98
+ this.break_on_hyphens = break_on_hyphens
99
+ this.tabsize = tabsize
100
+ this.max_lines = max_lines
101
+ this.placeholder = placeholder
102
+ }
103
+
104
+
105
+ // -- Private methods -----------------------------------------------
106
+ // (possibly useful for subclasses to override)
107
+
108
+ _munge_whitespace(text) {
109
+ /*
110
+ * _munge_whitespace(text : string) -> string
111
+ *
112
+ * Munge whitespace in text: expand tabs and convert all other
113
+ * whitespace characters to spaces. Eg. " foo\\tbar\\n\\nbaz"
114
+ * becomes " foo bar baz".
115
+ */
116
+ if (this.expand_tabs) {
117
+ text = text.replace(/\t/g, ' '.repeat(this.tabsize)) // not strictly correct in js
118
+ }
119
+ if (this.replace_whitespace) {
120
+ text = text.replace(/[\t\n\x0b\x0c\r]/g, ' ')
121
+ }
122
+ return text
123
+ }
124
+
125
+ _split(text) {
126
+ /*
127
+ * _split(text : string) -> [string]
128
+ *
129
+ * Split the text to wrap into indivisible chunks. Chunks are
130
+ * not quite the same as words; see _wrap_chunks() for full
131
+ * details. As an example, the text
132
+ * Look, goof-ball -- use the -b option!
133
+ * breaks into the following chunks:
134
+ * 'Look,', ' ', 'goof-', 'ball', ' ', '--', ' ',
135
+ * 'use', ' ', 'the', ' ', '-b', ' ', 'option!'
136
+ * if break_on_hyphens is True, or in:
137
+ * 'Look,', ' ', 'goof-ball', ' ', '--', ' ',
138
+ * 'use', ' ', 'the', ' ', '-b', ' ', option!'
139
+ * otherwise.
140
+ */
141
+ let chunks = text.split(wordsep_simple_re)
142
+ chunks = chunks.filter(Boolean)
143
+ return chunks
144
+ }
145
+
146
+ _handle_long_word(reversed_chunks, cur_line, cur_len, width) {
147
+ /*
148
+ * _handle_long_word(chunks : [string],
149
+ * cur_line : [string],
150
+ * cur_len : int, width : int)
151
+ *
152
+ * Handle a chunk of text (most likely a word, not whitespace) that
153
+ * is too long to fit in any line.
154
+ */
155
+ // Figure out when indent is larger than the specified width, and make
156
+ // sure at least one character is stripped off on every pass
157
+ let space_left
158
+ if (width < 1) {
159
+ space_left = 1
160
+ } else {
161
+ space_left = width - cur_len
162
+ }
163
+
164
+ // If we're allowed to break long words, then do so: put as much
165
+ // of the next chunk onto the current line as will fit.
166
+ if (this.break_long_words) {
167
+ cur_line.push(reversed_chunks[reversed_chunks.length - 1].slice(0, space_left))
168
+ reversed_chunks[reversed_chunks.length - 1] = reversed_chunks[reversed_chunks.length - 1].slice(space_left)
169
+
170
+ // Otherwise, we have to preserve the long word intact. Only add
171
+ // it to the current line if there's nothing already there --
172
+ // that minimizes how much we violate the width constraint.
173
+ } else if (!cur_line) {
174
+ cur_line.push(...reversed_chunks.pop())
175
+ }
176
+
177
+ // If we're not allowed to break long words, and there's already
178
+ // text on the current line, do nothing. Next time through the
179
+ // main loop of _wrap_chunks(), we'll wind up here again, but
180
+ // cur_len will be zero, so the next line will be entirely
181
+ // devoted to the long word that we can't handle right now.
182
+ }
183
+
184
+ _wrap_chunks(chunks) {
185
+ /*
186
+ * _wrap_chunks(chunks : [string]) -> [string]
187
+ *
188
+ * Wrap a sequence of text chunks and return a list of lines of
189
+ * length 'self.width' or less. (If 'break_long_words' is false,
190
+ * some lines may be longer than this.) Chunks correspond roughly
191
+ * to words and the whitespace between them: each chunk is
192
+ * indivisible (modulo 'break_long_words'), but a line break can
193
+ * come between any two chunks. Chunks should not have internal
194
+ * whitespace; ie. a chunk is either all whitespace or a "word".
195
+ * Whitespace chunks will be removed from the beginning and end of
196
+ * lines, but apart from that whitespace is preserved.
197
+ */
198
+ let lines = []
199
+ let indent
200
+ if (this.width <= 0) {
201
+ throw Error(`invalid width ${this.width} (must be > 0)`)
202
+ }
203
+ if (this.max_lines !== undefined) {
204
+ if (this.max_lines > 1) {
205
+ indent = this.subsequent_indent
206
+ } else {
207
+ indent = this.initial_indent
208
+ }
209
+ if (indent.length + this.placeholder.trimStart().length > this.width) {
210
+ throw Error('placeholder too large for max width')
211
+ }
212
+ }
213
+
214
+ // Arrange in reverse order so items can be efficiently popped
215
+ // from a stack of chucks.
216
+ chunks = chunks.reverse()
217
+
218
+ while (chunks.length > 0) {
219
+
220
+ // Start the list of chunks that will make up the current line.
221
+ // cur_len is just the length of all the chunks in cur_line.
222
+ let cur_line = []
223
+ let cur_len = 0
224
+
225
+ // Figure out which static string will prefix this line.
226
+ let indent
227
+ if (lines) {
228
+ indent = this.subsequent_indent
229
+ } else {
230
+ indent = this.initial_indent
231
+ }
232
+
233
+ // Maximum width for this line.
234
+ let width = this.width - indent.length
235
+
236
+ // First chunk on line is whitespace -- drop it, unless this
237
+ // is the very beginning of the text (ie. no lines started yet).
238
+ if (this.drop_whitespace && chunks[chunks.length - 1].trim() === '' && lines.length > 0) {
239
+ chunks.pop()
240
+ }
241
+
242
+ while (chunks.length > 0) {
243
+ let l = chunks[chunks.length - 1].length
244
+
245
+ // Can at least squeeze this chunk onto the current line.
246
+ if (cur_len + l <= width) {
247
+ cur_line.push(chunks.pop())
248
+ cur_len += l
249
+
250
+ // Nope, this line is full.
251
+ } else {
252
+ break
253
+ }
254
+ }
255
+
256
+ // The current line is full, and the next chunk is too big to
257
+ // fit on *any* line (not just this one).
258
+ if (chunks.length && chunks[chunks.length - 1].length > width) {
259
+ this._handle_long_word(chunks, cur_line, cur_len, width)
260
+ cur_len = cur_line.map(l => l.length).reduce((a, b) => a + b, 0)
261
+ }
262
+
263
+ // If the last chunk on this line is all whitespace, drop it.
264
+ if (this.drop_whitespace && cur_line.length > 0 && cur_line[cur_line.length - 1].trim() === '') {
265
+ cur_len -= cur_line[cur_line.length - 1].length
266
+ cur_line.pop()
267
+ }
268
+
269
+ if (cur_line) {
270
+ if (this.max_lines === undefined ||
271
+ lines.length + 1 < this.max_lines ||
272
+ (chunks.length === 0 ||
273
+ this.drop_whitespace &&
274
+ chunks.length === 1 &&
275
+ !chunks[0].trim()) && cur_len <= width) {
276
+ // Convert current line back to a string and store it in
277
+ // list of all lines (return value).
278
+ lines.push(indent + cur_line.join(''))
279
+ } else {
280
+ let had_break = false
281
+ while (cur_line) {
282
+ if (cur_line[cur_line.length - 1].trim() &&
283
+ cur_len + this.placeholder.length <= width) {
284
+ cur_line.push(this.placeholder)
285
+ lines.push(indent + cur_line.join(''))
286
+ had_break = true
287
+ break
288
+ }
289
+ cur_len -= cur_line[-1].length
290
+ cur_line.pop()
291
+ }
292
+ if (!had_break) {
293
+ if (lines) {
294
+ let prev_line = lines[lines.length - 1].trimEnd()
295
+ if (prev_line.length + this.placeholder.length <=
296
+ this.width) {
297
+ lines[lines.length - 1] = prev_line + this.placeholder
298
+ break
299
+ }
300
+ }
301
+ lines.push(indent + this.placeholder.lstrip())
302
+ }
303
+ break
304
+ }
305
+ }
306
+ }
307
+
308
+ return lines
309
+ }
310
+
311
+ _split_chunks(text) {
312
+ text = this._munge_whitespace(text)
313
+ return this._split(text)
314
+ }
315
+
316
+ // -- Public interface ----------------------------------------------
317
+
318
+ wrap(text) {
319
+ /*
320
+ * wrap(text : string) -> [string]
321
+ *
322
+ * Reformat the single paragraph in 'text' so it fits in lines of
323
+ * no more than 'self.width' columns, and return a list of wrapped
324
+ * lines. Tabs in 'text' are expanded with string.expandtabs(),
325
+ * and all other whitespace characters (including newline) are
326
+ * converted to space.
327
+ */
328
+ let chunks = this._split_chunks(text)
329
+ // not implemented in js
330
+ //if (this.fix_sentence_endings) {
331
+ // this._fix_sentence_endings(chunks)
332
+ //}
333
+ return this._wrap_chunks(chunks)
334
+ }
335
+
336
+ fill(text) {
337
+ /*
338
+ * fill(text : string) -> string
339
+ *
340
+ * Reformat the single paragraph in 'text' to fit in lines of no
341
+ * more than 'self.width' columns, and return a new string
342
+ * containing the entire wrapped paragraph.
343
+ */
344
+ return this.wrap(text).join('\n')
345
+ }
346
+ }
347
+
348
+
349
+ // -- Convenience interface ---------------------------------------------
350
+
351
+ function wrap(text, options = {}) {
352
+ /*
353
+ * Wrap a single paragraph of text, returning a list of wrapped lines.
354
+ *
355
+ * Reformat the single paragraph in 'text' so it fits in lines of no
356
+ * more than 'width' columns, and return a list of wrapped lines. By
357
+ * default, tabs in 'text' are expanded with string.expandtabs(), and
358
+ * all other whitespace characters (including newline) are converted to
359
+ * space. See TextWrapper class for available keyword args to customize
360
+ * wrapping behaviour.
361
+ */
362
+ let { width = 70, ...kwargs } = options
363
+ let w = new TextWrapper(Object.assign({ width }, kwargs))
364
+ return w.wrap(text)
365
+ }
366
+
367
+ function fill(text, options = {}) {
368
+ /*
369
+ * Fill a single paragraph of text, returning a new string.
370
+ *
371
+ * Reformat the single paragraph in 'text' to fit in lines of no more
372
+ * than 'width' columns, and return a new string containing the entire
373
+ * wrapped paragraph. As with wrap(), tabs are expanded and other
374
+ * whitespace characters converted to space. See TextWrapper class for
375
+ * available keyword args to customize wrapping behaviour.
376
+ */
377
+ let { width = 70, ...kwargs } = options
378
+ let w = new TextWrapper(Object.assign({ width }, kwargs))
379
+ return w.fill(text)
380
+ }
381
+
382
+ // -- Loosely related functionality -------------------------------------
383
+
384
+ let _whitespace_only_re = /^[ \t]+$/mg
385
+ let _leading_whitespace_re = /(^[ \t]*)(?:[^ \t\n])/mg
386
+
387
+ function dedent(text) {
388
+ /*
389
+ * Remove any common leading whitespace from every line in `text`.
390
+ *
391
+ * This can be used to make triple-quoted strings line up with the left
392
+ * edge of the display, while still presenting them in the source code
393
+ * in indented form.
394
+ *
395
+ * Note that tabs and spaces are both treated as whitespace, but they
396
+ * are not equal: the lines " hello" and "\\thello" are
397
+ * considered to have no common leading whitespace.
398
+ *
399
+ * Entirely blank lines are normalized to a newline character.
400
+ */
401
+ // Look for the longest leading string of spaces and tabs common to
402
+ // all lines.
403
+ let margin = undefined
404
+ text = text.replace(_whitespace_only_re, '')
405
+ let indents = text.match(_leading_whitespace_re) || []
406
+ for (let indent of indents) {
407
+ indent = indent.slice(0, -1)
408
+
409
+ if (margin === undefined) {
410
+ margin = indent
411
+
412
+ // Current line more deeply indented than previous winner:
413
+ // no change (previous winner is still on top).
414
+ } else if (indent.startsWith(margin)) {
415
+ // pass
416
+
417
+ // Current line consistent with and no deeper than previous winner:
418
+ // it's the new winner.
419
+ } else if (margin.startsWith(indent)) {
420
+ margin = indent
421
+
422
+ // Find the largest common whitespace between current line and previous
423
+ // winner.
424
+ } else {
425
+ for (let i = 0; i < margin.length && i < indent.length; i++) {
426
+ if (margin[i] !== indent[i]) {
427
+ margin = margin.slice(0, i)
428
+ break
429
+ }
430
+ }
431
+ }
432
+ }
433
+
434
+ if (margin) {
435
+ text = text.replace(new RegExp('^' + margin, 'mg'), '')
436
+ }
437
+ return text
438
+ }
439
+
440
+ module.exports = { wrap, fill, dedent }
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "argparse",
3
+ "description": "CLI arguments parser. Native port of python's argparse.",
4
+ "version": "2.0.1",
5
+ "keywords": [
6
+ "cli",
7
+ "parser",
8
+ "argparse",
9
+ "option",
10
+ "args"
11
+ ],
12
+ "main": "argparse.js",
13
+ "files": [
14
+ "argparse.js",
15
+ "lib/"
16
+ ],
17
+ "license": "Python-2.0",
18
+ "repository": "nodeca/argparse",
19
+ "scripts": {
20
+ "lint": "eslint .",
21
+ "test": "npm run lint && nyc mocha",
22
+ "coverage": "npm run test && nyc report --reporter html"
23
+ },
24
+ "devDependencies": {
25
+ "@babel/eslint-parser": "^7.11.0",
26
+ "@babel/plugin-syntax-class-properties": "^7.10.4",
27
+ "eslint": "^7.5.0",
28
+ "mocha": "^8.0.1",
29
+ "nyc": "^15.1.0"
30
+ }
31
+ }
@@ -1,6 +1,6 @@
1
- The MIT License (MIT)
1
+ MIT License
2
2
 
3
- Copyright (c) 2010-2016 Robert Kieffer and other contributors
3
+ Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,135 @@
1
+ # brace-expansion
2
+
3
+ [Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html),
4
+ as known from sh/bash, in JavaScript.
5
+
6
+ [![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion)
7
+ [![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion)
8
+ [![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/brace-expansion.svg)](https://greenkeeper.io/)
9
+
10
+ [![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion)
11
+
12
+ ## Example
13
+
14
+ ```js
15
+ var expand = require('brace-expansion');
16
+
17
+ expand('file-{a,b,c}.jpg')
18
+ // => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
19
+
20
+ expand('-v{,,}')
21
+ // => ['-v', '-v', '-v']
22
+
23
+ expand('file{0..2}.jpg')
24
+ // => ['file0.jpg', 'file1.jpg', 'file2.jpg']
25
+
26
+ expand('file-{a..c}.jpg')
27
+ // => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
28
+
29
+ expand('file{2..0}.jpg')
30
+ // => ['file2.jpg', 'file1.jpg', 'file0.jpg']
31
+
32
+ expand('file{0..4..2}.jpg')
33
+ // => ['file0.jpg', 'file2.jpg', 'file4.jpg']
34
+
35
+ expand('file-{a..e..2}.jpg')
36
+ // => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg']
37
+
38
+ expand('file{00..10..5}.jpg')
39
+ // => ['file00.jpg', 'file05.jpg', 'file10.jpg']
40
+
41
+ expand('{{A..C},{a..c}}')
42
+ // => ['A', 'B', 'C', 'a', 'b', 'c']
43
+
44
+ expand('ppp{,config,oe{,conf}}')
45
+ // => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf']
46
+ ```
47
+
48
+ ## API
49
+
50
+ ```js
51
+ var expand = require('brace-expansion');
52
+ ```
53
+
54
+ ### var expanded = expand(str)
55
+
56
+ Return an array of all possible and valid expansions of `str`. If none are
57
+ found, `[str]` is returned.
58
+
59
+ Valid expansions are:
60
+
61
+ ```js
62
+ /^(.*,)+(.+)?$/
63
+ // {a,b,...}
64
+ ```
65
+
66
+ A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`.
67
+
68
+ ```js
69
+ /^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
70
+ // {x..y[..incr]}
71
+ ```
72
+
73
+ A numeric sequence from `x` to `y` inclusive, with optional increment.
74
+ If `x` or `y` start with a leading `0`, all the numbers will be padded
75
+ to have equal length. Negative numbers and backwards iteration work too.
76
+
77
+ ```js
78
+ /^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
79
+ // {x..y[..incr]}
80
+ ```
81
+
82
+ An alphabetic sequence from `x` to `y` inclusive, with optional increment.
83
+ `x` and `y` must be exactly one character, and if given, `incr` must be a
84
+ number.
85
+
86
+ For compatibility reasons, the string `${` is not eligible for brace expansion.
87
+
88
+ ## Installation
89
+
90
+ With [npm](https://npmjs.org) do:
91
+
92
+ ```bash
93
+ npm install brace-expansion
94
+ ```
95
+
96
+ ## Contributors
97
+
98
+ - [Julian Gruber](https://github.com/juliangruber)
99
+ - [Isaac Z. Schlueter](https://github.com/isaacs)
100
+
101
+ ## Sponsors
102
+
103
+ This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)!
104
+
105
+ Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)!
106
+
107
+ ## Security contact information
108
+
109
+ To report a security vulnerability, please use the
110
+ [Tidelift security contact](https://tidelift.com/security).
111
+ Tidelift will coordinate the fix and disclosure.
112
+
113
+ ## License
114
+
115
+ (MIT)
116
+
117
+ Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
118
+
119
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
120
+ this software and associated documentation files (the "Software"), to deal in
121
+ the Software without restriction, including without limitation the rights to
122
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
123
+ of the Software, and to permit persons to whom the Software is furnished to do
124
+ so, subject to the following conditions:
125
+
126
+ The above copyright notice and this permission notice shall be included in all
127
+ copies or substantial portions of the Software.
128
+
129
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
130
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
131
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
132
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
133
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
134
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
135
+ SOFTWARE.