protobufjs 6.11.2 → 6.11.3

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 (202) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/bin/pbjs +0 -0
  3. package/bin/pbts +0 -0
  4. package/package-lock.json +7870 -0
  5. package/package.json +3 -3
  6. package/scripts/changelog.js +150 -0
  7. package/src/util.js +3 -0
  8. package/cli/node_modules/.package-lock.json +0 -256
  9. package/cli/node_modules/acorn/CHANGELOG.md +0 -620
  10. package/cli/node_modules/acorn/LICENSE +0 -21
  11. package/cli/node_modules/acorn/README.md +0 -269
  12. package/cli/node_modules/acorn/bin/acorn +0 -4
  13. package/cli/node_modules/acorn/dist/acorn.d.ts +0 -209
  14. package/cli/node_modules/acorn/dist/acorn.js +0 -5186
  15. package/cli/node_modules/acorn/dist/acorn.js.map +0 -1
  16. package/cli/node_modules/acorn/dist/acorn.mjs +0 -5155
  17. package/cli/node_modules/acorn/dist/acorn.mjs.d.ts +0 -2
  18. package/cli/node_modules/acorn/dist/acorn.mjs.map +0 -1
  19. package/cli/node_modules/acorn/dist/bin.js +0 -64
  20. package/cli/node_modules/acorn/package.json +0 -35
  21. package/cli/node_modules/acorn-jsx/LICENSE +0 -19
  22. package/cli/node_modules/acorn-jsx/README.md +0 -40
  23. package/cli/node_modules/acorn-jsx/index.js +0 -488
  24. package/cli/node_modules/acorn-jsx/package.json +0 -27
  25. package/cli/node_modules/acorn-jsx/xhtml.js +0 -255
  26. package/cli/node_modules/balanced-match/.npmignore +0 -5
  27. package/cli/node_modules/balanced-match/LICENSE.md +0 -21
  28. package/cli/node_modules/balanced-match/README.md +0 -91
  29. package/cli/node_modules/balanced-match/index.js +0 -59
  30. package/cli/node_modules/balanced-match/package.json +0 -49
  31. package/cli/node_modules/brace-expansion/LICENSE +0 -21
  32. package/cli/node_modules/brace-expansion/README.md +0 -129
  33. package/cli/node_modules/brace-expansion/index.js +0 -201
  34. package/cli/node_modules/brace-expansion/package.json +0 -47
  35. package/cli/node_modules/concat-map/.travis.yml +0 -4
  36. package/cli/node_modules/concat-map/LICENSE +0 -18
  37. package/cli/node_modules/concat-map/README.markdown +0 -62
  38. package/cli/node_modules/concat-map/example/map.js +0 -6
  39. package/cli/node_modules/concat-map/index.js +0 -13
  40. package/cli/node_modules/concat-map/package.json +0 -43
  41. package/cli/node_modules/concat-map/test/map.js +0 -39
  42. package/cli/node_modules/deep-is/.npmignore +0 -1
  43. package/cli/node_modules/deep-is/.travis.yml +0 -6
  44. package/cli/node_modules/deep-is/LICENSE +0 -22
  45. package/cli/node_modules/deep-is/README.markdown +0 -70
  46. package/cli/node_modules/deep-is/example/cmp.js +0 -11
  47. package/cli/node_modules/deep-is/index.js +0 -102
  48. package/cli/node_modules/deep-is/package.json +0 -61
  49. package/cli/node_modules/deep-is/test/NaN.js +0 -16
  50. package/cli/node_modules/deep-is/test/cmp.js +0 -23
  51. package/cli/node_modules/deep-is/test/neg-vs-pos-0.js +0 -15
  52. package/cli/node_modules/escodegen/LICENSE.BSD +0 -21
  53. package/cli/node_modules/escodegen/README.md +0 -84
  54. package/cli/node_modules/escodegen/bin/escodegen.js +0 -77
  55. package/cli/node_modules/escodegen/bin/esgenerate.js +0 -64
  56. package/cli/node_modules/escodegen/escodegen.js +0 -2647
  57. package/cli/node_modules/escodegen/package.json +0 -62
  58. package/cli/node_modules/eslint-visitor-keys/CHANGELOG.md +0 -25
  59. package/cli/node_modules/eslint-visitor-keys/LICENSE +0 -201
  60. package/cli/node_modules/eslint-visitor-keys/README.md +0 -98
  61. package/cli/node_modules/eslint-visitor-keys/lib/index.js +0 -81
  62. package/cli/node_modules/eslint-visitor-keys/lib/visitor-keys.json +0 -284
  63. package/cli/node_modules/eslint-visitor-keys/package.json +0 -40
  64. package/cli/node_modules/espree/CHANGELOG.md +0 -509
  65. package/cli/node_modules/espree/LICENSE +0 -25
  66. package/cli/node_modules/espree/README.md +0 -233
  67. package/cli/node_modules/espree/espree.js +0 -177
  68. package/cli/node_modules/espree/lib/ast-node-types.js +0 -96
  69. package/cli/node_modules/espree/lib/espree.js +0 -286
  70. package/cli/node_modules/espree/lib/features.js +0 -29
  71. package/cli/node_modules/espree/lib/options.js +0 -106
  72. package/cli/node_modules/espree/lib/token-translator.js +0 -263
  73. package/cli/node_modules/espree/lib/visitor-keys.js +0 -123
  74. package/cli/node_modules/espree/package.json +0 -64
  75. package/cli/node_modules/esprima/ChangeLog +0 -235
  76. package/cli/node_modules/esprima/LICENSE.BSD +0 -21
  77. package/cli/node_modules/esprima/README.md +0 -46
  78. package/cli/node_modules/esprima/bin/esparse.js +0 -139
  79. package/cli/node_modules/esprima/bin/esvalidate.js +0 -236
  80. package/cli/node_modules/esprima/dist/esprima.js +0 -6709
  81. package/cli/node_modules/esprima/package.json +0 -112
  82. package/cli/node_modules/estraverse/.jshintrc +0 -16
  83. package/cli/node_modules/estraverse/LICENSE.BSD +0 -19
  84. package/cli/node_modules/estraverse/README.md +0 -153
  85. package/cli/node_modules/estraverse/estraverse.js +0 -801
  86. package/cli/node_modules/estraverse/gulpfile.js +0 -70
  87. package/cli/node_modules/estraverse/package.json +0 -40
  88. package/cli/node_modules/esutils/LICENSE.BSD +0 -19
  89. package/cli/node_modules/esutils/README.md +0 -174
  90. package/cli/node_modules/esutils/lib/ast.js +0 -144
  91. package/cli/node_modules/esutils/lib/code.js +0 -135
  92. package/cli/node_modules/esutils/lib/keyword.js +0 -165
  93. package/cli/node_modules/esutils/lib/utils.js +0 -33
  94. package/cli/node_modules/esutils/package.json +0 -44
  95. package/cli/node_modules/fast-levenshtein/LICENSE.md +0 -25
  96. package/cli/node_modules/fast-levenshtein/README.md +0 -104
  97. package/cli/node_modules/fast-levenshtein/levenshtein.js +0 -136
  98. package/cli/node_modules/fast-levenshtein/package.json +0 -39
  99. package/cli/node_modules/fs.realpath/LICENSE +0 -43
  100. package/cli/node_modules/fs.realpath/README.md +0 -33
  101. package/cli/node_modules/fs.realpath/index.js +0 -66
  102. package/cli/node_modules/fs.realpath/old.js +0 -303
  103. package/cli/node_modules/fs.realpath/package.json +0 -26
  104. package/cli/node_modules/glob/LICENSE +0 -21
  105. package/cli/node_modules/glob/README.md +0 -375
  106. package/cli/node_modules/glob/changelog.md +0 -67
  107. package/cli/node_modules/glob/common.js +0 -240
  108. package/cli/node_modules/glob/glob.js +0 -790
  109. package/cli/node_modules/glob/package.json +0 -46
  110. package/cli/node_modules/glob/sync.js +0 -486
  111. package/cli/node_modules/inflight/LICENSE +0 -15
  112. package/cli/node_modules/inflight/README.md +0 -37
  113. package/cli/node_modules/inflight/inflight.js +0 -54
  114. package/cli/node_modules/inflight/package.json +0 -29
  115. package/cli/node_modules/inherits/LICENSE +0 -16
  116. package/cli/node_modules/inherits/README.md +0 -42
  117. package/cli/node_modules/inherits/inherits.js +0 -9
  118. package/cli/node_modules/inherits/inherits_browser.js +0 -27
  119. package/cli/node_modules/inherits/package.json +0 -29
  120. package/cli/node_modules/levn/LICENSE +0 -22
  121. package/cli/node_modules/levn/README.md +0 -196
  122. package/cli/node_modules/levn/lib/cast.js +0 -298
  123. package/cli/node_modules/levn/lib/coerce.js +0 -285
  124. package/cli/node_modules/levn/lib/index.js +0 -22
  125. package/cli/node_modules/levn/lib/parse-string.js +0 -113
  126. package/cli/node_modules/levn/lib/parse.js +0 -102
  127. package/cli/node_modules/levn/package.json +0 -47
  128. package/cli/node_modules/minimatch/LICENSE +0 -15
  129. package/cli/node_modules/minimatch/README.md +0 -209
  130. package/cli/node_modules/minimatch/minimatch.js +0 -923
  131. package/cli/node_modules/minimatch/package.json +0 -30
  132. package/cli/node_modules/once/LICENSE +0 -15
  133. package/cli/node_modules/once/README.md +0 -79
  134. package/cli/node_modules/once/once.js +0 -42
  135. package/cli/node_modules/once/package.json +0 -33
  136. package/cli/node_modules/optionator/CHANGELOG.md +0 -56
  137. package/cli/node_modules/optionator/LICENSE +0 -22
  138. package/cli/node_modules/optionator/README.md +0 -238
  139. package/cli/node_modules/optionator/lib/help.js +0 -260
  140. package/cli/node_modules/optionator/lib/index.js +0 -465
  141. package/cli/node_modules/optionator/lib/util.js +0 -54
  142. package/cli/node_modules/optionator/package.json +0 -44
  143. package/cli/node_modules/path-is-absolute/index.js +0 -20
  144. package/cli/node_modules/path-is-absolute/license +0 -21
  145. package/cli/node_modules/path-is-absolute/package.json +0 -43
  146. package/cli/node_modules/path-is-absolute/readme.md +0 -59
  147. package/cli/node_modules/prelude-ls/CHANGELOG.md +0 -99
  148. package/cli/node_modules/prelude-ls/LICENSE +0 -22
  149. package/cli/node_modules/prelude-ls/README.md +0 -15
  150. package/cli/node_modules/prelude-ls/lib/Func.js +0 -65
  151. package/cli/node_modules/prelude-ls/lib/List.js +0 -686
  152. package/cli/node_modules/prelude-ls/lib/Num.js +0 -130
  153. package/cli/node_modules/prelude-ls/lib/Obj.js +0 -154
  154. package/cli/node_modules/prelude-ls/lib/Str.js +0 -92
  155. package/cli/node_modules/prelude-ls/lib/index.js +0 -178
  156. package/cli/node_modules/prelude-ls/package.json +0 -52
  157. package/cli/node_modules/rimraf/CHANGELOG.md +0 -65
  158. package/cli/node_modules/rimraf/LICENSE +0 -15
  159. package/cli/node_modules/rimraf/README.md +0 -101
  160. package/cli/node_modules/rimraf/bin.js +0 -68
  161. package/cli/node_modules/rimraf/package.json +0 -32
  162. package/cli/node_modules/rimraf/rimraf.js +0 -360
  163. package/cli/node_modules/source-map/CHANGELOG.md +0 -301
  164. package/cli/node_modules/source-map/LICENSE +0 -28
  165. package/cli/node_modules/source-map/README.md +0 -742
  166. package/cli/node_modules/source-map/dist/source-map.debug.js +0 -3234
  167. package/cli/node_modules/source-map/dist/source-map.js +0 -3233
  168. package/cli/node_modules/source-map/dist/source-map.min.js +0 -2
  169. package/cli/node_modules/source-map/dist/source-map.min.js.map +0 -1
  170. package/cli/node_modules/source-map/lib/array-set.js +0 -121
  171. package/cli/node_modules/source-map/lib/base64-vlq.js +0 -140
  172. package/cli/node_modules/source-map/lib/base64.js +0 -67
  173. package/cli/node_modules/source-map/lib/binary-search.js +0 -111
  174. package/cli/node_modules/source-map/lib/mapping-list.js +0 -79
  175. package/cli/node_modules/source-map/lib/quick-sort.js +0 -114
  176. package/cli/node_modules/source-map/lib/source-map-consumer.js +0 -1145
  177. package/cli/node_modules/source-map/lib/source-map-generator.js +0 -425
  178. package/cli/node_modules/source-map/lib/source-node.js +0 -413
  179. package/cli/node_modules/source-map/lib/util.js +0 -488
  180. package/cli/node_modules/source-map/package.json +0 -73
  181. package/cli/node_modules/source-map/source-map.d.ts +0 -98
  182. package/cli/node_modules/source-map/source-map.js +0 -8
  183. package/cli/node_modules/tmp/CHANGELOG.md +0 -288
  184. package/cli/node_modules/tmp/LICENSE +0 -21
  185. package/cli/node_modules/tmp/README.md +0 -365
  186. package/cli/node_modules/tmp/lib/tmp.js +0 -780
  187. package/cli/node_modules/tmp/package.json +0 -58
  188. package/cli/node_modules/type-check/LICENSE +0 -22
  189. package/cli/node_modules/type-check/README.md +0 -210
  190. package/cli/node_modules/type-check/lib/check.js +0 -126
  191. package/cli/node_modules/type-check/lib/index.js +0 -16
  192. package/cli/node_modules/type-check/lib/parse-type.js +0 -196
  193. package/cli/node_modules/type-check/package.json +0 -40
  194. package/cli/node_modules/word-wrap/LICENSE +0 -21
  195. package/cli/node_modules/word-wrap/README.md +0 -182
  196. package/cli/node_modules/word-wrap/index.d.ts +0 -50
  197. package/cli/node_modules/word-wrap/index.js +0 -46
  198. package/cli/node_modules/word-wrap/package.json +0 -77
  199. package/cli/node_modules/wrappy/LICENSE +0 -15
  200. package/cli/node_modules/wrappy/README.md +0 -36
  201. package/cli/node_modules/wrappy/package.json +0 -29
  202. package/cli/node_modules/wrappy/wrappy.js +0 -33
@@ -1,488 +0,0 @@
1
- /* -*- Mode: js; js-indent-level: 2; -*- */
2
- /*
3
- * Copyright 2011 Mozilla Foundation and contributors
4
- * Licensed under the New BSD license. See LICENSE or:
5
- * http://opensource.org/licenses/BSD-3-Clause
6
- */
7
-
8
- /**
9
- * This is a helper function for getting values from parameter/options
10
- * objects.
11
- *
12
- * @param args The object we are extracting values from
13
- * @param name The name of the property we are getting.
14
- * @param defaultValue An optional value to return if the property is missing
15
- * from the object. If this is not specified and the property is missing, an
16
- * error will be thrown.
17
- */
18
- function getArg(aArgs, aName, aDefaultValue) {
19
- if (aName in aArgs) {
20
- return aArgs[aName];
21
- } else if (arguments.length === 3) {
22
- return aDefaultValue;
23
- } else {
24
- throw new Error('"' + aName + '" is a required argument.');
25
- }
26
- }
27
- exports.getArg = getArg;
28
-
29
- var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
30
- var dataUrlRegexp = /^data:.+\,.+$/;
31
-
32
- function urlParse(aUrl) {
33
- var match = aUrl.match(urlRegexp);
34
- if (!match) {
35
- return null;
36
- }
37
- return {
38
- scheme: match[1],
39
- auth: match[2],
40
- host: match[3],
41
- port: match[4],
42
- path: match[5]
43
- };
44
- }
45
- exports.urlParse = urlParse;
46
-
47
- function urlGenerate(aParsedUrl) {
48
- var url = '';
49
- if (aParsedUrl.scheme) {
50
- url += aParsedUrl.scheme + ':';
51
- }
52
- url += '//';
53
- if (aParsedUrl.auth) {
54
- url += aParsedUrl.auth + '@';
55
- }
56
- if (aParsedUrl.host) {
57
- url += aParsedUrl.host;
58
- }
59
- if (aParsedUrl.port) {
60
- url += ":" + aParsedUrl.port
61
- }
62
- if (aParsedUrl.path) {
63
- url += aParsedUrl.path;
64
- }
65
- return url;
66
- }
67
- exports.urlGenerate = urlGenerate;
68
-
69
- /**
70
- * Normalizes a path, or the path portion of a URL:
71
- *
72
- * - Replaces consecutive slashes with one slash.
73
- * - Removes unnecessary '.' parts.
74
- * - Removes unnecessary '<dir>/..' parts.
75
- *
76
- * Based on code in the Node.js 'path' core module.
77
- *
78
- * @param aPath The path or url to normalize.
79
- */
80
- function normalize(aPath) {
81
- var path = aPath;
82
- var url = urlParse(aPath);
83
- if (url) {
84
- if (!url.path) {
85
- return aPath;
86
- }
87
- path = url.path;
88
- }
89
- var isAbsolute = exports.isAbsolute(path);
90
-
91
- var parts = path.split(/\/+/);
92
- for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
93
- part = parts[i];
94
- if (part === '.') {
95
- parts.splice(i, 1);
96
- } else if (part === '..') {
97
- up++;
98
- } else if (up > 0) {
99
- if (part === '') {
100
- // The first part is blank if the path is absolute. Trying to go
101
- // above the root is a no-op. Therefore we can remove all '..' parts
102
- // directly after the root.
103
- parts.splice(i + 1, up);
104
- up = 0;
105
- } else {
106
- parts.splice(i, 2);
107
- up--;
108
- }
109
- }
110
- }
111
- path = parts.join('/');
112
-
113
- if (path === '') {
114
- path = isAbsolute ? '/' : '.';
115
- }
116
-
117
- if (url) {
118
- url.path = path;
119
- return urlGenerate(url);
120
- }
121
- return path;
122
- }
123
- exports.normalize = normalize;
124
-
125
- /**
126
- * Joins two paths/URLs.
127
- *
128
- * @param aRoot The root path or URL.
129
- * @param aPath The path or URL to be joined with the root.
130
- *
131
- * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
132
- * scheme-relative URL: Then the scheme of aRoot, if any, is prepended
133
- * first.
134
- * - Otherwise aPath is a path. If aRoot is a URL, then its path portion
135
- * is updated with the result and aRoot is returned. Otherwise the result
136
- * is returned.
137
- * - If aPath is absolute, the result is aPath.
138
- * - Otherwise the two paths are joined with a slash.
139
- * - Joining for example 'http://' and 'www.example.com' is also supported.
140
- */
141
- function join(aRoot, aPath) {
142
- if (aRoot === "") {
143
- aRoot = ".";
144
- }
145
- if (aPath === "") {
146
- aPath = ".";
147
- }
148
- var aPathUrl = urlParse(aPath);
149
- var aRootUrl = urlParse(aRoot);
150
- if (aRootUrl) {
151
- aRoot = aRootUrl.path || '/';
152
- }
153
-
154
- // `join(foo, '//www.example.org')`
155
- if (aPathUrl && !aPathUrl.scheme) {
156
- if (aRootUrl) {
157
- aPathUrl.scheme = aRootUrl.scheme;
158
- }
159
- return urlGenerate(aPathUrl);
160
- }
161
-
162
- if (aPathUrl || aPath.match(dataUrlRegexp)) {
163
- return aPath;
164
- }
165
-
166
- // `join('http://', 'www.example.com')`
167
- if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
168
- aRootUrl.host = aPath;
169
- return urlGenerate(aRootUrl);
170
- }
171
-
172
- var joined = aPath.charAt(0) === '/'
173
- ? aPath
174
- : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
175
-
176
- if (aRootUrl) {
177
- aRootUrl.path = joined;
178
- return urlGenerate(aRootUrl);
179
- }
180
- return joined;
181
- }
182
- exports.join = join;
183
-
184
- exports.isAbsolute = function (aPath) {
185
- return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
186
- };
187
-
188
- /**
189
- * Make a path relative to a URL or another path.
190
- *
191
- * @param aRoot The root path or URL.
192
- * @param aPath The path or URL to be made relative to aRoot.
193
- */
194
- function relative(aRoot, aPath) {
195
- if (aRoot === "") {
196
- aRoot = ".";
197
- }
198
-
199
- aRoot = aRoot.replace(/\/$/, '');
200
-
201
- // It is possible for the path to be above the root. In this case, simply
202
- // checking whether the root is a prefix of the path won't work. Instead, we
203
- // need to remove components from the root one by one, until either we find
204
- // a prefix that fits, or we run out of components to remove.
205
- var level = 0;
206
- while (aPath.indexOf(aRoot + '/') !== 0) {
207
- var index = aRoot.lastIndexOf("/");
208
- if (index < 0) {
209
- return aPath;
210
- }
211
-
212
- // If the only part of the root that is left is the scheme (i.e. http://,
213
- // file:///, etc.), one or more slashes (/), or simply nothing at all, we
214
- // have exhausted all components, so the path is not relative to the root.
215
- aRoot = aRoot.slice(0, index);
216
- if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
217
- return aPath;
218
- }
219
-
220
- ++level;
221
- }
222
-
223
- // Make sure we add a "../" for each component we removed from the root.
224
- return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
225
- }
226
- exports.relative = relative;
227
-
228
- var supportsNullProto = (function () {
229
- var obj = Object.create(null);
230
- return !('__proto__' in obj);
231
- }());
232
-
233
- function identity (s) {
234
- return s;
235
- }
236
-
237
- /**
238
- * Because behavior goes wacky when you set `__proto__` on objects, we
239
- * have to prefix all the strings in our set with an arbitrary character.
240
- *
241
- * See https://github.com/mozilla/source-map/pull/31 and
242
- * https://github.com/mozilla/source-map/issues/30
243
- *
244
- * @param String aStr
245
- */
246
- function toSetString(aStr) {
247
- if (isProtoString(aStr)) {
248
- return '$' + aStr;
249
- }
250
-
251
- return aStr;
252
- }
253
- exports.toSetString = supportsNullProto ? identity : toSetString;
254
-
255
- function fromSetString(aStr) {
256
- if (isProtoString(aStr)) {
257
- return aStr.slice(1);
258
- }
259
-
260
- return aStr;
261
- }
262
- exports.fromSetString = supportsNullProto ? identity : fromSetString;
263
-
264
- function isProtoString(s) {
265
- if (!s) {
266
- return false;
267
- }
268
-
269
- var length = s.length;
270
-
271
- if (length < 9 /* "__proto__".length */) {
272
- return false;
273
- }
274
-
275
- if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
276
- s.charCodeAt(length - 2) !== 95 /* '_' */ ||
277
- s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
278
- s.charCodeAt(length - 4) !== 116 /* 't' */ ||
279
- s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
280
- s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
281
- s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
282
- s.charCodeAt(length - 8) !== 95 /* '_' */ ||
283
- s.charCodeAt(length - 9) !== 95 /* '_' */) {
284
- return false;
285
- }
286
-
287
- for (var i = length - 10; i >= 0; i--) {
288
- if (s.charCodeAt(i) !== 36 /* '$' */) {
289
- return false;
290
- }
291
- }
292
-
293
- return true;
294
- }
295
-
296
- /**
297
- * Comparator between two mappings where the original positions are compared.
298
- *
299
- * Optionally pass in `true` as `onlyCompareGenerated` to consider two
300
- * mappings with the same original source/line/column, but different generated
301
- * line and column the same. Useful when searching for a mapping with a
302
- * stubbed out mapping.
303
- */
304
- function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
305
- var cmp = strcmp(mappingA.source, mappingB.source);
306
- if (cmp !== 0) {
307
- return cmp;
308
- }
309
-
310
- cmp = mappingA.originalLine - mappingB.originalLine;
311
- if (cmp !== 0) {
312
- return cmp;
313
- }
314
-
315
- cmp = mappingA.originalColumn - mappingB.originalColumn;
316
- if (cmp !== 0 || onlyCompareOriginal) {
317
- return cmp;
318
- }
319
-
320
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
321
- if (cmp !== 0) {
322
- return cmp;
323
- }
324
-
325
- cmp = mappingA.generatedLine - mappingB.generatedLine;
326
- if (cmp !== 0) {
327
- return cmp;
328
- }
329
-
330
- return strcmp(mappingA.name, mappingB.name);
331
- }
332
- exports.compareByOriginalPositions = compareByOriginalPositions;
333
-
334
- /**
335
- * Comparator between two mappings with deflated source and name indices where
336
- * the generated positions are compared.
337
- *
338
- * Optionally pass in `true` as `onlyCompareGenerated` to consider two
339
- * mappings with the same generated line and column, but different
340
- * source/name/original line and column the same. Useful when searching for a
341
- * mapping with a stubbed out mapping.
342
- */
343
- function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
344
- var cmp = mappingA.generatedLine - mappingB.generatedLine;
345
- if (cmp !== 0) {
346
- return cmp;
347
- }
348
-
349
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
350
- if (cmp !== 0 || onlyCompareGenerated) {
351
- return cmp;
352
- }
353
-
354
- cmp = strcmp(mappingA.source, mappingB.source);
355
- if (cmp !== 0) {
356
- return cmp;
357
- }
358
-
359
- cmp = mappingA.originalLine - mappingB.originalLine;
360
- if (cmp !== 0) {
361
- return cmp;
362
- }
363
-
364
- cmp = mappingA.originalColumn - mappingB.originalColumn;
365
- if (cmp !== 0) {
366
- return cmp;
367
- }
368
-
369
- return strcmp(mappingA.name, mappingB.name);
370
- }
371
- exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
372
-
373
- function strcmp(aStr1, aStr2) {
374
- if (aStr1 === aStr2) {
375
- return 0;
376
- }
377
-
378
- if (aStr1 === null) {
379
- return 1; // aStr2 !== null
380
- }
381
-
382
- if (aStr2 === null) {
383
- return -1; // aStr1 !== null
384
- }
385
-
386
- if (aStr1 > aStr2) {
387
- return 1;
388
- }
389
-
390
- return -1;
391
- }
392
-
393
- /**
394
- * Comparator between two mappings with inflated source and name strings where
395
- * the generated positions are compared.
396
- */
397
- function compareByGeneratedPositionsInflated(mappingA, mappingB) {
398
- var cmp = mappingA.generatedLine - mappingB.generatedLine;
399
- if (cmp !== 0) {
400
- return cmp;
401
- }
402
-
403
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
404
- if (cmp !== 0) {
405
- return cmp;
406
- }
407
-
408
- cmp = strcmp(mappingA.source, mappingB.source);
409
- if (cmp !== 0) {
410
- return cmp;
411
- }
412
-
413
- cmp = mappingA.originalLine - mappingB.originalLine;
414
- if (cmp !== 0) {
415
- return cmp;
416
- }
417
-
418
- cmp = mappingA.originalColumn - mappingB.originalColumn;
419
- if (cmp !== 0) {
420
- return cmp;
421
- }
422
-
423
- return strcmp(mappingA.name, mappingB.name);
424
- }
425
- exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
426
-
427
- /**
428
- * Strip any JSON XSSI avoidance prefix from the string (as documented
429
- * in the source maps specification), and then parse the string as
430
- * JSON.
431
- */
432
- function parseSourceMapInput(str) {
433
- return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
434
- }
435
- exports.parseSourceMapInput = parseSourceMapInput;
436
-
437
- /**
438
- * Compute the URL of a source given the the source root, the source's
439
- * URL, and the source map's URL.
440
- */
441
- function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
442
- sourceURL = sourceURL || '';
443
-
444
- if (sourceRoot) {
445
- // This follows what Chrome does.
446
- if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {
447
- sourceRoot += '/';
448
- }
449
- // The spec says:
450
- // Line 4: An optional source root, useful for relocating source
451
- // files on a server or removing repeated values in the
452
- // “sources” entry. This value is prepended to the individual
453
- // entries in the “source” field.
454
- sourceURL = sourceRoot + sourceURL;
455
- }
456
-
457
- // Historically, SourceMapConsumer did not take the sourceMapURL as
458
- // a parameter. This mode is still somewhat supported, which is why
459
- // this code block is conditional. However, it's preferable to pass
460
- // the source map URL to SourceMapConsumer, so that this function
461
- // can implement the source URL resolution algorithm as outlined in
462
- // the spec. This block is basically the equivalent of:
463
- // new URL(sourceURL, sourceMapURL).toString()
464
- // ... except it avoids using URL, which wasn't available in the
465
- // older releases of node still supported by this library.
466
- //
467
- // The spec says:
468
- // If the sources are not absolute URLs after prepending of the
469
- // “sourceRoot”, the sources are resolved relative to the
470
- // SourceMap (like resolving script src in a html document).
471
- if (sourceMapURL) {
472
- var parsed = urlParse(sourceMapURL);
473
- if (!parsed) {
474
- throw new Error("sourceMapURL could not be parsed");
475
- }
476
- if (parsed.path) {
477
- // Strip the last path component, but keep the "/".
478
- var index = parsed.path.lastIndexOf('/');
479
- if (index >= 0) {
480
- parsed.path = parsed.path.substring(0, index + 1);
481
- }
482
- }
483
- sourceURL = join(urlGenerate(parsed), sourceURL);
484
- }
485
-
486
- return normalize(sourceURL);
487
- }
488
- exports.computeSourceURL = computeSourceURL;
@@ -1,73 +0,0 @@
1
- {
2
- "name": "source-map",
3
- "description": "Generates and consumes source maps",
4
- "version": "0.6.1",
5
- "homepage": "https://github.com/mozilla/source-map",
6
- "author": "Nick Fitzgerald <nfitzgerald@mozilla.com>",
7
- "contributors": [
8
- "Tobias Koppers <tobias.koppers@googlemail.com>",
9
- "Duncan Beevers <duncan@dweebd.com>",
10
- "Stephen Crane <scrane@mozilla.com>",
11
- "Ryan Seddon <seddon.ryan@gmail.com>",
12
- "Miles Elam <miles.elam@deem.com>",
13
- "Mihai Bazon <mihai.bazon@gmail.com>",
14
- "Michael Ficarra <github.public.email@michael.ficarra.me>",
15
- "Todd Wolfson <todd@twolfson.com>",
16
- "Alexander Solovyov <alexander@solovyov.net>",
17
- "Felix Gnass <fgnass@gmail.com>",
18
- "Conrad Irwin <conrad.irwin@gmail.com>",
19
- "usrbincc <usrbincc@yahoo.com>",
20
- "David Glasser <glasser@davidglasser.net>",
21
- "Chase Douglas <chase@newrelic.com>",
22
- "Evan Wallace <evan.exe@gmail.com>",
23
- "Heather Arthur <fayearthur@gmail.com>",
24
- "Hugh Kennedy <hughskennedy@gmail.com>",
25
- "David Glasser <glasser@davidglasser.net>",
26
- "Simon Lydell <simon.lydell@gmail.com>",
27
- "Jmeas Smith <jellyes2@gmail.com>",
28
- "Michael Z Goddard <mzgoddard@gmail.com>",
29
- "azu <azu@users.noreply.github.com>",
30
- "John Gozde <john@gozde.ca>",
31
- "Adam Kirkton <akirkton@truefitinnovation.com>",
32
- "Chris Montgomery <christopher.montgomery@dowjones.com>",
33
- "J. Ryan Stinnett <jryans@gmail.com>",
34
- "Jack Herrington <jherrington@walmartlabs.com>",
35
- "Chris Truter <jeffpalentine@gmail.com>",
36
- "Daniel Espeset <daniel@danielespeset.com>",
37
- "Jamie Wong <jamie.lf.wong@gmail.com>",
38
- "Eddy Bruël <ejpbruel@mozilla.com>",
39
- "Hawken Rives <hawkrives@gmail.com>",
40
- "Gilad Peleg <giladp007@gmail.com>",
41
- "djchie <djchie.dev@gmail.com>",
42
- "Gary Ye <garysye@gmail.com>",
43
- "Nicolas Lalevée <nicolas.lalevee@hibnet.org>"
44
- ],
45
- "repository": {
46
- "type": "git",
47
- "url": "http://github.com/mozilla/source-map.git"
48
- },
49
- "main": "./source-map.js",
50
- "files": [
51
- "source-map.js",
52
- "source-map.d.ts",
53
- "lib/",
54
- "dist/source-map.debug.js",
55
- "dist/source-map.js",
56
- "dist/source-map.min.js",
57
- "dist/source-map.min.js.map"
58
- ],
59
- "engines": {
60
- "node": ">=0.10.0"
61
- },
62
- "license": "BSD-3-Clause",
63
- "scripts": {
64
- "test": "npm run build && node test/run-tests.js",
65
- "build": "webpack --color",
66
- "toc": "doctoc --title '## Table of Contents' README.md && doctoc --title '## Table of Contents' CONTRIBUTING.md"
67
- },
68
- "devDependencies": {
69
- "doctoc": "^0.15.0",
70
- "webpack": "^1.12.0"
71
- },
72
- "typings": "source-map"
73
- }
@@ -1,98 +0,0 @@
1
- export interface StartOfSourceMap {
2
- file?: string;
3
- sourceRoot?: string;
4
- }
5
-
6
- export interface RawSourceMap extends StartOfSourceMap {
7
- version: string;
8
- sources: string[];
9
- names: string[];
10
- sourcesContent?: string[];
11
- mappings: string;
12
- }
13
-
14
- export interface Position {
15
- line: number;
16
- column: number;
17
- }
18
-
19
- export interface LineRange extends Position {
20
- lastColumn: number;
21
- }
22
-
23
- export interface FindPosition extends Position {
24
- // SourceMapConsumer.GREATEST_LOWER_BOUND or SourceMapConsumer.LEAST_UPPER_BOUND
25
- bias?: number;
26
- }
27
-
28
- export interface SourceFindPosition extends FindPosition {
29
- source: string;
30
- }
31
-
32
- export interface MappedPosition extends Position {
33
- source: string;
34
- name?: string;
35
- }
36
-
37
- export interface MappingItem {
38
- source: string;
39
- generatedLine: number;
40
- generatedColumn: number;
41
- originalLine: number;
42
- originalColumn: number;
43
- name: string;
44
- }
45
-
46
- export class SourceMapConsumer {
47
- static GENERATED_ORDER: number;
48
- static ORIGINAL_ORDER: number;
49
-
50
- static GREATEST_LOWER_BOUND: number;
51
- static LEAST_UPPER_BOUND: number;
52
-
53
- constructor(rawSourceMap: RawSourceMap);
54
- computeColumnSpans(): void;
55
- originalPositionFor(generatedPosition: FindPosition): MappedPosition;
56
- generatedPositionFor(originalPosition: SourceFindPosition): LineRange;
57
- allGeneratedPositionsFor(originalPosition: MappedPosition): Position[];
58
- hasContentsOfAllSources(): boolean;
59
- sourceContentFor(source: string, returnNullOnMissing?: boolean): string;
60
- eachMapping(callback: (mapping: MappingItem) => void, context?: any, order?: number): void;
61
- }
62
-
63
- export interface Mapping {
64
- generated: Position;
65
- original: Position;
66
- source: string;
67
- name?: string;
68
- }
69
-
70
- export class SourceMapGenerator {
71
- constructor(startOfSourceMap?: StartOfSourceMap);
72
- static fromSourceMap(sourceMapConsumer: SourceMapConsumer): SourceMapGenerator;
73
- addMapping(mapping: Mapping): void;
74
- setSourceContent(sourceFile: string, sourceContent: string): void;
75
- applySourceMap(sourceMapConsumer: SourceMapConsumer, sourceFile?: string, sourceMapPath?: string): void;
76
- toString(): string;
77
- }
78
-
79
- export interface CodeWithSourceMap {
80
- code: string;
81
- map: SourceMapGenerator;
82
- }
83
-
84
- export class SourceNode {
85
- constructor();
86
- constructor(line: number, column: number, source: string);
87
- constructor(line: number, column: number, source: string, chunk?: string, name?: string);
88
- static fromStringWithSourceMap(code: string, sourceMapConsumer: SourceMapConsumer, relativePath?: string): SourceNode;
89
- add(chunk: string): void;
90
- prepend(chunk: string): void;
91
- setSourceContent(sourceFile: string, sourceContent: string): void;
92
- walk(fn: (chunk: string, mapping: MappedPosition) => void): void;
93
- walkSourceContents(fn: (file: string, content: string) => void): void;
94
- join(sep: string): SourceNode;
95
- replaceRight(pattern: string, replacement: string): SourceNode;
96
- toString(): string;
97
- toStringWithSourceMap(startOfSourceMap?: StartOfSourceMap): CodeWithSourceMap;
98
- }
@@ -1,8 +0,0 @@
1
- /*
2
- * Copyright 2009-2011 Mozilla Foundation and contributors
3
- * Licensed under the New BSD license. See LICENSE.txt or:
4
- * http://opensource.org/licenses/BSD-3-Clause
5
- */
6
- exports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator;
7
- exports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer;
8
- exports.SourceNode = require('./lib/source-node').SourceNode;