protobufjs 6.10.2 → 6.11.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.
Files changed (220) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/bin/pbjs +0 -0
  3. package/bin/pbts +0 -0
  4. package/cli/README.md +163 -0
  5. package/cli/node_modules/.package-lock.json +256 -0
  6. package/cli/node_modules/acorn/CHANGELOG.md +620 -0
  7. package/cli/node_modules/acorn/LICENSE +21 -0
  8. package/cli/node_modules/acorn/README.md +269 -0
  9. package/cli/node_modules/acorn/bin/acorn +4 -0
  10. package/cli/node_modules/acorn/dist/acorn.d.ts +209 -0
  11. package/cli/node_modules/acorn/dist/acorn.js +5186 -0
  12. package/cli/node_modules/acorn/dist/acorn.js.map +1 -0
  13. package/cli/node_modules/acorn/dist/acorn.mjs +5155 -0
  14. package/cli/node_modules/acorn/dist/acorn.mjs.d.ts +2 -0
  15. package/cli/node_modules/acorn/dist/acorn.mjs.map +1 -0
  16. package/cli/node_modules/acorn/dist/bin.js +64 -0
  17. package/cli/node_modules/acorn/package.json +35 -0
  18. package/cli/node_modules/acorn-jsx/LICENSE +19 -0
  19. package/cli/node_modules/acorn-jsx/README.md +40 -0
  20. package/cli/node_modules/acorn-jsx/index.js +488 -0
  21. package/cli/node_modules/acorn-jsx/package.json +27 -0
  22. package/cli/node_modules/acorn-jsx/xhtml.js +255 -0
  23. package/cli/node_modules/balanced-match/.npmignore +5 -0
  24. package/cli/node_modules/balanced-match/LICENSE.md +21 -0
  25. package/cli/node_modules/balanced-match/README.md +91 -0
  26. package/cli/node_modules/balanced-match/index.js +59 -0
  27. package/cli/node_modules/balanced-match/package.json +49 -0
  28. package/cli/node_modules/brace-expansion/LICENSE +21 -0
  29. package/cli/node_modules/brace-expansion/README.md +129 -0
  30. package/cli/node_modules/brace-expansion/index.js +201 -0
  31. package/cli/node_modules/brace-expansion/package.json +47 -0
  32. package/cli/node_modules/concat-map/.travis.yml +4 -0
  33. package/cli/node_modules/concat-map/LICENSE +18 -0
  34. package/cli/node_modules/concat-map/README.markdown +62 -0
  35. package/cli/node_modules/concat-map/example/map.js +6 -0
  36. package/cli/node_modules/concat-map/index.js +13 -0
  37. package/cli/node_modules/concat-map/package.json +43 -0
  38. package/cli/node_modules/concat-map/test/map.js +39 -0
  39. package/cli/node_modules/deep-is/.npmignore +1 -0
  40. package/cli/node_modules/deep-is/.travis.yml +6 -0
  41. package/cli/node_modules/deep-is/LICENSE +22 -0
  42. package/cli/node_modules/deep-is/README.markdown +70 -0
  43. package/cli/node_modules/deep-is/example/cmp.js +11 -0
  44. package/cli/node_modules/deep-is/index.js +102 -0
  45. package/cli/node_modules/deep-is/package.json +61 -0
  46. package/cli/node_modules/deep-is/test/NaN.js +16 -0
  47. package/cli/node_modules/deep-is/test/cmp.js +23 -0
  48. package/cli/node_modules/deep-is/test/neg-vs-pos-0.js +15 -0
  49. package/cli/node_modules/escodegen/LICENSE.BSD +21 -0
  50. package/cli/node_modules/escodegen/README.md +84 -0
  51. package/cli/node_modules/escodegen/bin/escodegen.js +77 -0
  52. package/cli/node_modules/escodegen/bin/esgenerate.js +64 -0
  53. package/cli/node_modules/escodegen/escodegen.js +2647 -0
  54. package/cli/node_modules/escodegen/package.json +62 -0
  55. package/cli/node_modules/eslint-visitor-keys/CHANGELOG.md +25 -0
  56. package/cli/node_modules/eslint-visitor-keys/LICENSE +201 -0
  57. package/cli/node_modules/eslint-visitor-keys/README.md +98 -0
  58. package/cli/node_modules/eslint-visitor-keys/lib/index.js +81 -0
  59. package/cli/node_modules/eslint-visitor-keys/lib/visitor-keys.json +284 -0
  60. package/cli/node_modules/eslint-visitor-keys/package.json +40 -0
  61. package/cli/node_modules/espree/CHANGELOG.md +509 -0
  62. package/cli/node_modules/espree/LICENSE +25 -0
  63. package/cli/node_modules/espree/README.md +233 -0
  64. package/cli/node_modules/espree/espree.js +177 -0
  65. package/cli/node_modules/espree/lib/ast-node-types.js +96 -0
  66. package/cli/node_modules/espree/lib/espree.js +286 -0
  67. package/cli/node_modules/espree/lib/features.js +29 -0
  68. package/cli/node_modules/espree/lib/options.js +106 -0
  69. package/cli/node_modules/espree/lib/token-translator.js +263 -0
  70. package/cli/node_modules/espree/lib/visitor-keys.js +123 -0
  71. package/cli/node_modules/espree/package.json +64 -0
  72. package/cli/node_modules/esprima/ChangeLog +235 -0
  73. package/cli/node_modules/esprima/LICENSE.BSD +21 -0
  74. package/cli/node_modules/esprima/README.md +46 -0
  75. package/cli/node_modules/esprima/bin/esparse.js +139 -0
  76. package/cli/node_modules/esprima/bin/esvalidate.js +236 -0
  77. package/cli/node_modules/esprima/dist/esprima.js +6709 -0
  78. package/cli/node_modules/esprima/package.json +112 -0
  79. package/cli/node_modules/estraverse/.jshintrc +16 -0
  80. package/cli/node_modules/estraverse/LICENSE.BSD +19 -0
  81. package/cli/node_modules/estraverse/README.md +153 -0
  82. package/cli/node_modules/estraverse/estraverse.js +801 -0
  83. package/cli/node_modules/estraverse/gulpfile.js +70 -0
  84. package/cli/node_modules/estraverse/package.json +40 -0
  85. package/cli/node_modules/esutils/LICENSE.BSD +19 -0
  86. package/cli/node_modules/esutils/README.md +174 -0
  87. package/cli/node_modules/esutils/lib/ast.js +144 -0
  88. package/cli/node_modules/esutils/lib/code.js +135 -0
  89. package/cli/node_modules/esutils/lib/keyword.js +165 -0
  90. package/cli/node_modules/esutils/lib/utils.js +33 -0
  91. package/cli/node_modules/esutils/package.json +44 -0
  92. package/cli/node_modules/fast-levenshtein/LICENSE.md +25 -0
  93. package/cli/node_modules/fast-levenshtein/README.md +104 -0
  94. package/cli/node_modules/fast-levenshtein/levenshtein.js +136 -0
  95. package/cli/node_modules/fast-levenshtein/package.json +39 -0
  96. package/cli/node_modules/fs.realpath/LICENSE +43 -0
  97. package/cli/node_modules/fs.realpath/README.md +33 -0
  98. package/cli/node_modules/fs.realpath/index.js +66 -0
  99. package/cli/node_modules/fs.realpath/old.js +303 -0
  100. package/cli/node_modules/fs.realpath/package.json +26 -0
  101. package/cli/node_modules/glob/LICENSE +21 -0
  102. package/cli/node_modules/glob/README.md +375 -0
  103. package/cli/node_modules/glob/changelog.md +67 -0
  104. package/cli/node_modules/glob/common.js +240 -0
  105. package/cli/node_modules/glob/glob.js +790 -0
  106. package/cli/node_modules/glob/package.json +46 -0
  107. package/cli/node_modules/glob/sync.js +486 -0
  108. package/cli/node_modules/inflight/LICENSE +15 -0
  109. package/cli/node_modules/inflight/README.md +37 -0
  110. package/cli/node_modules/inflight/inflight.js +54 -0
  111. package/cli/node_modules/inflight/package.json +29 -0
  112. package/cli/node_modules/inherits/LICENSE +16 -0
  113. package/cli/node_modules/inherits/README.md +42 -0
  114. package/cli/node_modules/inherits/inherits.js +9 -0
  115. package/cli/node_modules/inherits/inherits_browser.js +27 -0
  116. package/cli/node_modules/inherits/package.json +29 -0
  117. package/cli/node_modules/levn/LICENSE +22 -0
  118. package/cli/node_modules/levn/README.md +196 -0
  119. package/cli/node_modules/levn/lib/cast.js +298 -0
  120. package/cli/node_modules/levn/lib/coerce.js +285 -0
  121. package/cli/node_modules/levn/lib/index.js +22 -0
  122. package/cli/node_modules/levn/lib/parse-string.js +113 -0
  123. package/cli/node_modules/levn/lib/parse.js +102 -0
  124. package/cli/node_modules/levn/package.json +47 -0
  125. package/cli/node_modules/minimatch/LICENSE +15 -0
  126. package/cli/node_modules/minimatch/README.md +209 -0
  127. package/cli/node_modules/minimatch/minimatch.js +923 -0
  128. package/cli/node_modules/minimatch/package.json +30 -0
  129. package/cli/node_modules/once/LICENSE +15 -0
  130. package/cli/node_modules/once/README.md +79 -0
  131. package/cli/node_modules/once/once.js +42 -0
  132. package/cli/node_modules/once/package.json +33 -0
  133. package/cli/node_modules/optionator/CHANGELOG.md +56 -0
  134. package/cli/node_modules/optionator/LICENSE +22 -0
  135. package/cli/node_modules/optionator/README.md +238 -0
  136. package/cli/node_modules/optionator/lib/help.js +260 -0
  137. package/cli/node_modules/optionator/lib/index.js +465 -0
  138. package/cli/node_modules/optionator/lib/util.js +54 -0
  139. package/cli/node_modules/optionator/package.json +44 -0
  140. package/cli/node_modules/path-is-absolute/index.js +20 -0
  141. package/cli/node_modules/path-is-absolute/license +21 -0
  142. package/cli/node_modules/path-is-absolute/package.json +43 -0
  143. package/cli/node_modules/path-is-absolute/readme.md +59 -0
  144. package/cli/node_modules/prelude-ls/CHANGELOG.md +99 -0
  145. package/cli/node_modules/prelude-ls/LICENSE +22 -0
  146. package/cli/node_modules/prelude-ls/README.md +15 -0
  147. package/cli/node_modules/prelude-ls/lib/Func.js +65 -0
  148. package/cli/node_modules/prelude-ls/lib/List.js +686 -0
  149. package/cli/node_modules/prelude-ls/lib/Num.js +130 -0
  150. package/cli/node_modules/prelude-ls/lib/Obj.js +154 -0
  151. package/cli/node_modules/prelude-ls/lib/Str.js +92 -0
  152. package/cli/node_modules/prelude-ls/lib/index.js +178 -0
  153. package/cli/node_modules/prelude-ls/package.json +52 -0
  154. package/cli/node_modules/rimraf/CHANGELOG.md +65 -0
  155. package/cli/node_modules/rimraf/LICENSE +15 -0
  156. package/cli/node_modules/rimraf/README.md +101 -0
  157. package/cli/node_modules/rimraf/bin.js +68 -0
  158. package/cli/node_modules/rimraf/package.json +32 -0
  159. package/cli/node_modules/rimraf/rimraf.js +360 -0
  160. package/cli/node_modules/source-map/CHANGELOG.md +301 -0
  161. package/cli/node_modules/source-map/LICENSE +28 -0
  162. package/cli/node_modules/source-map/README.md +742 -0
  163. package/cli/node_modules/source-map/dist/source-map.debug.js +3234 -0
  164. package/cli/node_modules/source-map/dist/source-map.js +3233 -0
  165. package/cli/node_modules/source-map/dist/source-map.min.js +2 -0
  166. package/cli/node_modules/source-map/dist/source-map.min.js.map +1 -0
  167. package/cli/node_modules/source-map/lib/array-set.js +121 -0
  168. package/cli/node_modules/source-map/lib/base64-vlq.js +140 -0
  169. package/cli/node_modules/source-map/lib/base64.js +67 -0
  170. package/cli/node_modules/source-map/lib/binary-search.js +111 -0
  171. package/cli/node_modules/source-map/lib/mapping-list.js +79 -0
  172. package/cli/node_modules/source-map/lib/quick-sort.js +114 -0
  173. package/cli/node_modules/source-map/lib/source-map-consumer.js +1145 -0
  174. package/cli/node_modules/source-map/lib/source-map-generator.js +425 -0
  175. package/cli/node_modules/source-map/lib/source-node.js +413 -0
  176. package/cli/node_modules/source-map/lib/util.js +488 -0
  177. package/cli/node_modules/source-map/package.json +73 -0
  178. package/cli/node_modules/source-map/source-map.d.ts +98 -0
  179. package/cli/node_modules/source-map/source-map.js +8 -0
  180. package/cli/node_modules/tmp/CHANGELOG.md +288 -0
  181. package/cli/node_modules/tmp/LICENSE +21 -0
  182. package/cli/node_modules/tmp/README.md +365 -0
  183. package/cli/node_modules/tmp/lib/tmp.js +780 -0
  184. package/cli/node_modules/tmp/package.json +58 -0
  185. package/cli/node_modules/type-check/LICENSE +22 -0
  186. package/cli/node_modules/type-check/README.md +210 -0
  187. package/cli/node_modules/type-check/lib/check.js +126 -0
  188. package/cli/node_modules/type-check/lib/index.js +16 -0
  189. package/cli/node_modules/type-check/lib/parse-type.js +196 -0
  190. package/cli/node_modules/type-check/package.json +40 -0
  191. package/cli/node_modules/word-wrap/LICENSE +21 -0
  192. package/cli/node_modules/word-wrap/README.md +182 -0
  193. package/cli/node_modules/word-wrap/index.d.ts +50 -0
  194. package/cli/node_modules/word-wrap/index.js +46 -0
  195. package/cli/node_modules/word-wrap/package.json +77 -0
  196. package/cli/node_modules/wrappy/LICENSE +15 -0
  197. package/cli/node_modules/wrappy/README.md +36 -0
  198. package/cli/node_modules/wrappy/package.json +29 -0
  199. package/cli/node_modules/wrappy/wrappy.js +33 -0
  200. package/cli/package.json +1 -0
  201. package/cli/pbjs.js +3 -1
  202. package/cli/targets/static.js +7 -1
  203. package/dist/light/protobuf.js +17 -5
  204. package/dist/light/protobuf.js.map +1 -1
  205. package/dist/light/protobuf.min.js +3 -3
  206. package/dist/light/protobuf.min.js.map +1 -1
  207. package/dist/minimal/protobuf.js +2 -2
  208. package/dist/minimal/protobuf.min.js +3 -3
  209. package/dist/minimal/protobuf.min.js.map +1 -1
  210. package/dist/protobuf.js +54 -9
  211. package/dist/protobuf.js.map +1 -1
  212. package/dist/protobuf.min.js +3 -3
  213. package/dist/protobuf.min.js.map +1 -1
  214. package/index.d.ts +11 -1
  215. package/package.json +2 -2
  216. package/src/field.js +3 -0
  217. package/src/namespace.js +2 -1
  218. package/src/parse.js +37 -4
  219. package/package-lock.json +0 -8922
  220. package/scripts/changelog.js +0 -150
@@ -0,0 +1,260 @@
1
+ // Generated by LiveScript 1.6.0
2
+ (function(){
3
+ var ref$, id, find, sort, min, max, map, unlines, nameToRaw, dasherize, naturalJoin, wordWrap, wordwrap, getPreText, setHelpStyleDefaults, generateHelpForOption, generateHelp;
4
+ ref$ = require('prelude-ls'), id = ref$.id, find = ref$.find, sort = ref$.sort, min = ref$.min, max = ref$.max, map = ref$.map, unlines = ref$.unlines;
5
+ ref$ = require('./util'), nameToRaw = ref$.nameToRaw, dasherize = ref$.dasherize, naturalJoin = ref$.naturalJoin;
6
+ wordWrap = require('word-wrap');
7
+ wordwrap = function(a, b){
8
+ var ref$, indent, width;
9
+ ref$ = b === undefined
10
+ ? ['', a - 1]
11
+ : [repeatString$(' ', a), b - a - 1], indent = ref$[0], width = ref$[1];
12
+ return function(text){
13
+ return wordWrap(text, {
14
+ indent: indent,
15
+ width: width,
16
+ trim: true
17
+ });
18
+ };
19
+ };
20
+ getPreText = function(option, arg$, maxWidth){
21
+ var mainName, shortNames, ref$, longNames, type, description, aliasSeparator, typeSeparator, initialIndent, names, namesString, namesStringLen, typeSeparatorString, typeSeparatorStringLen, wrap;
22
+ mainName = option.option, shortNames = (ref$ = option.shortNames) != null
23
+ ? ref$
24
+ : [], longNames = (ref$ = option.longNames) != null
25
+ ? ref$
26
+ : [], type = option.type, description = option.description;
27
+ aliasSeparator = arg$.aliasSeparator, typeSeparator = arg$.typeSeparator, initialIndent = arg$.initialIndent;
28
+ if (option.negateName) {
29
+ mainName = "no-" + mainName;
30
+ if (longNames) {
31
+ longNames = map(function(it){
32
+ return "no-" + it;
33
+ }, longNames);
34
+ }
35
+ }
36
+ names = mainName.length === 1
37
+ ? [mainName].concat(shortNames, longNames)
38
+ : shortNames.concat([mainName], longNames);
39
+ namesString = map(nameToRaw, names).join(aliasSeparator);
40
+ namesStringLen = namesString.length;
41
+ typeSeparatorString = mainName === 'NUM' ? '::' : typeSeparator;
42
+ typeSeparatorStringLen = typeSeparatorString.length;
43
+ if (maxWidth != null && !option.boolean && initialIndent + namesStringLen + typeSeparatorStringLen + type.length > maxWidth) {
44
+ wrap = wordwrap(initialIndent + namesStringLen + typeSeparatorStringLen, maxWidth);
45
+ return namesString + "" + typeSeparatorString + wrap(type).replace(/^\s+/, '');
46
+ } else {
47
+ return namesString + "" + (option.boolean
48
+ ? ''
49
+ : typeSeparatorString + "" + type);
50
+ }
51
+ };
52
+ setHelpStyleDefaults = function(helpStyle){
53
+ helpStyle.aliasSeparator == null && (helpStyle.aliasSeparator = ', ');
54
+ helpStyle.typeSeparator == null && (helpStyle.typeSeparator = ' ');
55
+ helpStyle.descriptionSeparator == null && (helpStyle.descriptionSeparator = ' ');
56
+ helpStyle.initialIndent == null && (helpStyle.initialIndent = 2);
57
+ helpStyle.secondaryIndent == null && (helpStyle.secondaryIndent = 4);
58
+ helpStyle.maxPadFactor == null && (helpStyle.maxPadFactor = 1.5);
59
+ };
60
+ generateHelpForOption = function(getOption, arg$){
61
+ var stdout, helpStyle, ref$;
62
+ stdout = arg$.stdout, helpStyle = (ref$ = arg$.helpStyle) != null
63
+ ? ref$
64
+ : {};
65
+ setHelpStyleDefaults(helpStyle);
66
+ return function(optionName){
67
+ var maxWidth, wrap, option, e, pre, defaultString, restPositionalString, description, fullDescription, that, preDescription, descriptionString, exampleString, examples, seperator;
68
+ maxWidth = stdout != null && stdout.isTTY ? stdout.columns - 1 : null;
69
+ wrap = maxWidth ? wordwrap(maxWidth) : id;
70
+ try {
71
+ option = getOption(dasherize(optionName));
72
+ } catch (e$) {
73
+ e = e$;
74
+ return e.message;
75
+ }
76
+ pre = getPreText(option, helpStyle);
77
+ defaultString = option['default'] && !option.negateName ? "\ndefault: " + option['default'] : '';
78
+ restPositionalString = option.restPositional ? 'Everything after this option is considered a positional argument, even if it looks like an option.' : '';
79
+ description = option.longDescription || option.description && sentencize(option.description);
80
+ fullDescription = description && restPositionalString
81
+ ? description + " " + restPositionalString
82
+ : (that = description || restPositionalString) ? that : '';
83
+ preDescription = 'description:';
84
+ descriptionString = !fullDescription
85
+ ? ''
86
+ : maxWidth && fullDescription.length - 1 - preDescription.length > maxWidth
87
+ ? "\n" + preDescription + "\n" + wrap(fullDescription)
88
+ : "\n" + preDescription + " " + fullDescription;
89
+ exampleString = (that = option.example) ? (examples = [].concat(that), examples.length > 1
90
+ ? "\nexamples:\n" + unlines(examples)
91
+ : "\nexample: " + examples[0]) : '';
92
+ seperator = defaultString || descriptionString || exampleString ? "\n" + repeatString$('=', pre.length) : '';
93
+ return pre + "" + seperator + defaultString + descriptionString + exampleString;
94
+ };
95
+ };
96
+ generateHelp = function(arg$){
97
+ var options, prepend, append, helpStyle, ref$, stdout, aliasSeparator, typeSeparator, descriptionSeparator, maxPadFactor, initialIndent, secondaryIndent;
98
+ options = arg$.options, prepend = arg$.prepend, append = arg$.append, helpStyle = (ref$ = arg$.helpStyle) != null
99
+ ? ref$
100
+ : {}, stdout = arg$.stdout;
101
+ setHelpStyleDefaults(helpStyle);
102
+ aliasSeparator = helpStyle.aliasSeparator, typeSeparator = helpStyle.typeSeparator, descriptionSeparator = helpStyle.descriptionSeparator, maxPadFactor = helpStyle.maxPadFactor, initialIndent = helpStyle.initialIndent, secondaryIndent = helpStyle.secondaryIndent;
103
+ return function(arg$){
104
+ var ref$, showHidden, interpolate, maxWidth, output, out, data, optionCount, totalPreLen, preLens, i$, len$, item, that, pre, descParts, desc, preLen, sortedPreLens, maxPreLen, preLenMean, x, padAmount, descSepLen, fullWrapCount, partialWrapCount, descLen, totalLen, initialSpace, wrapAllFull, i, wrap;
105
+ ref$ = arg$ != null
106
+ ? arg$
107
+ : {}, showHidden = ref$.showHidden, interpolate = ref$.interpolate;
108
+ maxWidth = stdout != null && stdout.isTTY ? stdout.columns - 1 : null;
109
+ output = [];
110
+ out = function(it){
111
+ return output.push(it != null ? it : '');
112
+ };
113
+ if (prepend) {
114
+ out(interpolate ? interp(prepend, interpolate) : prepend);
115
+ out();
116
+ }
117
+ data = [];
118
+ optionCount = 0;
119
+ totalPreLen = 0;
120
+ preLens = [];
121
+ for (i$ = 0, len$ = (ref$ = options).length; i$ < len$; ++i$) {
122
+ item = ref$[i$];
123
+ if (showHidden || !item.hidden) {
124
+ if (that = item.heading) {
125
+ data.push({
126
+ type: 'heading',
127
+ value: that
128
+ });
129
+ } else {
130
+ pre = getPreText(item, helpStyle, maxWidth);
131
+ descParts = [];
132
+ if ((that = item.description) != null) {
133
+ descParts.push(that);
134
+ }
135
+ if (that = item['enum']) {
136
+ descParts.push("either: " + naturalJoin(that));
137
+ }
138
+ if (item['default'] && !item.negateName) {
139
+ descParts.push("default: " + item['default']);
140
+ }
141
+ desc = descParts.join(' - ');
142
+ data.push({
143
+ type: 'option',
144
+ pre: pre,
145
+ desc: desc,
146
+ descLen: desc.length
147
+ });
148
+ preLen = pre.length;
149
+ optionCount++;
150
+ totalPreLen += preLen;
151
+ preLens.push(preLen);
152
+ }
153
+ }
154
+ }
155
+ sortedPreLens = sort(preLens);
156
+ maxPreLen = sortedPreLens[sortedPreLens.length - 1];
157
+ preLenMean = initialIndent + totalPreLen / optionCount;
158
+ x = optionCount > 2 ? min(preLenMean * maxPadFactor, maxPreLen) : maxPreLen;
159
+ for (i$ = sortedPreLens.length - 1; i$ >= 0; --i$) {
160
+ preLen = sortedPreLens[i$];
161
+ if (preLen <= x) {
162
+ padAmount = preLen;
163
+ break;
164
+ }
165
+ }
166
+ descSepLen = descriptionSeparator.length;
167
+ if (maxWidth != null) {
168
+ fullWrapCount = 0;
169
+ partialWrapCount = 0;
170
+ for (i$ = 0, len$ = data.length; i$ < len$; ++i$) {
171
+ item = data[i$];
172
+ if (item.type === 'option') {
173
+ pre = item.pre, desc = item.desc, descLen = item.descLen;
174
+ if (descLen === 0) {
175
+ item.wrap = 'none';
176
+ } else {
177
+ preLen = max(padAmount, pre.length) + initialIndent + descSepLen;
178
+ totalLen = preLen + descLen;
179
+ if (totalLen > maxWidth) {
180
+ if (descLen / 2.5 > maxWidth - preLen) {
181
+ fullWrapCount++;
182
+ item.wrap = 'full';
183
+ } else {
184
+ partialWrapCount++;
185
+ item.wrap = 'partial';
186
+ }
187
+ } else {
188
+ item.wrap = 'none';
189
+ }
190
+ }
191
+ }
192
+ }
193
+ }
194
+ initialSpace = repeatString$(' ', initialIndent);
195
+ wrapAllFull = optionCount > 1 && fullWrapCount + partialWrapCount * 0.5 > optionCount * 0.5;
196
+ for (i$ = 0, len$ = data.length; i$ < len$; ++i$) {
197
+ i = i$;
198
+ item = data[i$];
199
+ if (item.type === 'heading') {
200
+ if (i !== 0) {
201
+ out();
202
+ }
203
+ out(item.value + ":");
204
+ } else {
205
+ pre = item.pre, desc = item.desc, descLen = item.descLen, wrap = item.wrap;
206
+ if (maxWidth != null) {
207
+ if (wrapAllFull || wrap === 'full') {
208
+ wrap = wordwrap(initialIndent + secondaryIndent, maxWidth);
209
+ out(initialSpace + "" + pre + "\n" + wrap(desc));
210
+ continue;
211
+ } else if (wrap === 'partial') {
212
+ wrap = wordwrap(initialIndent + descSepLen + max(padAmount, pre.length), maxWidth);
213
+ out(initialSpace + "" + pad(pre, padAmount) + descriptionSeparator + wrap(desc).replace(/^\s+/, ''));
214
+ continue;
215
+ }
216
+ }
217
+ if (descLen === 0) {
218
+ out(initialSpace + "" + pre);
219
+ } else {
220
+ out(initialSpace + "" + pad(pre, padAmount) + descriptionSeparator + desc);
221
+ }
222
+ }
223
+ }
224
+ if (append) {
225
+ out();
226
+ out(interpolate ? interp(append, interpolate) : append);
227
+ }
228
+ return unlines(output);
229
+ };
230
+ };
231
+ function pad(str, num){
232
+ var len, padAmount;
233
+ len = str.length;
234
+ padAmount = num - len;
235
+ return str + "" + repeatString$(' ', padAmount > 0 ? padAmount : 0);
236
+ }
237
+ function sentencize(str){
238
+ var first, rest, period;
239
+ first = str.charAt(0).toUpperCase();
240
+ rest = str.slice(1);
241
+ period = /[\.!\?]$/.test(str) ? '' : '.';
242
+ return first + "" + rest + period;
243
+ }
244
+ function interp(string, object){
245
+ return string.replace(/{{([a-zA-Z$_][a-zA-Z$_0-9]*)}}/g, function(arg$, key){
246
+ var ref$;
247
+ return (ref$ = object[key]) != null
248
+ ? ref$
249
+ : "{{" + key + "}}";
250
+ });
251
+ }
252
+ module.exports = {
253
+ generateHelp: generateHelp,
254
+ generateHelpForOption: generateHelpForOption
255
+ };
256
+ function repeatString$(str, n){
257
+ for (var r = ''; n > 0; (n >>= 1) && (str += str)) if (n & 1) r += str;
258
+ return r;
259
+ }
260
+ }).call(this);