neo-cmp-cli 1.8.6-beta.2 → 1.8.6-beta.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 (154) hide show
  1. package/dist/_virtual/AddNeoRequirePlugin.js +8 -0
  2. package/dist/_virtual/OverloadYield.js +5 -0
  3. package/dist/_virtual/_commonjsHelpers.js +40 -0
  4. package/dist/_virtual/array-set.js +5 -0
  5. package/dist/_virtual/base64-vlq.js +5 -0
  6. package/dist/_virtual/base64.js +5 -0
  7. package/dist/_virtual/binary-search.js +5 -0
  8. package/dist/_virtual/createCmpByZip.js +8 -0
  9. package/dist/_virtual/deleteCmp.js +8 -0
  10. package/dist/_virtual/index.js +9 -0
  11. package/dist/_virtual/mapping-list.js +5 -0
  12. package/dist/_virtual/neoLogin.js +8 -0
  13. package/dist/_virtual/neoService.js +8 -0
  14. package/dist/_virtual/openProject.js +8 -0
  15. package/dist/_virtual/publish2oss.js +8 -0
  16. package/dist/_virtual/pullCmp.js +8 -0
  17. package/dist/_virtual/pushCmp.js +8 -0
  18. package/dist/_virtual/quick-sort.js +5 -0
  19. package/dist/_virtual/regenerator.js +5 -0
  20. package/dist/_virtual/regeneratorAsync.js +5 -0
  21. package/dist/_virtual/regeneratorAsyncGen.js +5 -0
  22. package/dist/_virtual/regeneratorAsyncIterator.js +5 -0
  23. package/dist/_virtual/regeneratorDefine.js +5 -0
  24. package/dist/_virtual/regeneratorKeys.js +5 -0
  25. package/dist/_virtual/regeneratorRuntime.js +5 -0
  26. package/dist/_virtual/regeneratorValues.js +5 -0
  27. package/dist/_virtual/source-map-consumer.js +5 -0
  28. package/dist/_virtual/source-map-generator.js +5 -0
  29. package/dist/_virtual/source-map-support.js +5 -0
  30. package/dist/_virtual/source-map.js +5 -0
  31. package/dist/_virtual/source-node.js +5 -0
  32. package/dist/_virtual/typeof.js +5 -0
  33. package/dist/_virtual/typescript.js +5 -0
  34. package/dist/_virtual/util.js +5 -0
  35. package/dist/config/auth.config.js +50 -0
  36. package/dist/config/default.config.js +225 -0
  37. package/dist/config/index.js +27 -0
  38. package/dist/main.js +9 -0
  39. package/dist/main2.js +261 -0
  40. package/dist/module/inspect.js +64 -0
  41. package/dist/module/neoInit.js +69 -0
  42. package/dist/module/neoInitByCopy.js +81 -0
  43. package/dist/neo/neoLogin.js +663 -0
  44. package/dist/neo/neoRequire.js +118 -0
  45. package/dist/neo/neoService.js +1246 -0
  46. package/dist/node_modules/@babel/runtime/helpers/OverloadYield.js +19 -0
  47. package/dist/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js +29 -0
  48. package/dist/node_modules/@babel/runtime/helpers/esm/extends.js +13 -0
  49. package/dist/node_modules/@babel/runtime/helpers/regenerator.js +105 -0
  50. package/dist/node_modules/@babel/runtime/helpers/regeneratorAsync.js +24 -0
  51. package/dist/node_modules/@babel/runtime/helpers/regeneratorAsyncGen.js +23 -0
  52. package/dist/node_modules/@babel/runtime/helpers/regeneratorAsyncIterator.js +50 -0
  53. package/dist/node_modules/@babel/runtime/helpers/regeneratorDefine.js +37 -0
  54. package/dist/node_modules/@babel/runtime/helpers/regeneratorKeys.js +25 -0
  55. package/dist/node_modules/@babel/runtime/helpers/regeneratorRuntime.js +98 -0
  56. package/dist/node_modules/@babel/runtime/helpers/regeneratorValues.js +35 -0
  57. package/dist/node_modules/@babel/runtime/helpers/typeof.js +25 -0
  58. package/dist/node_modules/@babel/runtime/regenerator/index.js +29 -0
  59. package/dist/node_modules/buffer-from/index.js +57 -0
  60. package/dist/node_modules/source-map/lib/array-set.js +134 -0
  61. package/dist/node_modules/source-map/lib/base64-vlq.js +144 -0
  62. package/dist/node_modules/source-map/lib/base64.js +81 -0
  63. package/dist/node_modules/source-map/lib/binary-search.js +122 -0
  64. package/dist/node_modules/source-map/lib/mapping-list.js +94 -0
  65. package/dist/node_modules/source-map/lib/quick-sort.js +126 -0
  66. package/dist/node_modules/source-map/lib/source-map-consumer.js +1018 -0
  67. package/dist/node_modules/source-map/lib/source-map-generator.js +385 -0
  68. package/dist/node_modules/source-map/lib/source-node.js +400 -0
  69. package/dist/node_modules/source-map/lib/util.js +449 -0
  70. package/dist/node_modules/source-map/source-map.js +25 -0
  71. package/dist/node_modules/source-map-support/source-map-support.js +610 -0
  72. package/dist/node_modules/typescript/lib/typescript.js +22376 -0
  73. package/dist/oss/publish2oss.js +378 -0
  74. package/dist/plugins/AddNeoRequirePlugin.js +178 -0
  75. package/dist/utils/autoEntryRootDir.js +98 -0
  76. package/dist/utils/cmpUtils/createCmpByTemplate.js +73 -0
  77. package/dist/utils/cmpUtils/createCmpByZip.js +530 -0
  78. package/dist/utils/cmpUtils/createCommonModulesCode.js +84 -0
  79. package/dist/utils/cmpUtils/deleteCmp.js +98 -0
  80. package/dist/utils/cmpUtils/getCmpModelRegisterCode.js +38 -0
  81. package/dist/utils/cmpUtils/getCmpPreviewCode.js +37 -0
  82. package/dist/utils/cmpUtils/getCmpRegisterCode.js +38 -0
  83. package/dist/utils/cmpUtils/getCmpTypeByDir.js +58 -0
  84. package/dist/utils/cmpUtils/hasCmpTypeByDir.js +25 -0
  85. package/dist/utils/cmpUtils/previewCmp.js +74 -0
  86. package/dist/utils/cmpUtils/pullCmp.js +144 -0
  87. package/dist/utils/cmpUtils/pushCmp.js +290 -0
  88. package/dist/utils/common.js +121 -0
  89. package/dist/utils/configureNeoBuild.js +153 -0
  90. package/dist/utils/generateEntries.js +73 -0
  91. package/dist/utils/neoConfigInit.js +25 -0
  92. package/dist/utils/neoParams.js +23 -0
  93. package/dist/utils/pathUtils.js +48 -0
  94. package/dist/utils/projectNameValidator.js +89 -0
  95. package/dist/utils/projectUtils/createCmpProjectByTemplate.js +74 -0
  96. package/dist/utils/projectUtils/createCmpProjectZip.js +135 -0
  97. package/dist/utils/projectUtils/getEntries.js +99 -0
  98. package/dist/utils/projectUtils/getEntriesWithAutoRegister.js +127 -0
  99. package/dist/utils/projectUtils/hasNeoProject.js +31 -0
  100. package/dist/utils/projectUtils/openProject.js +168 -0
  101. package/dist/utils/projectUtils/updatePublishLog.js +45 -0
  102. package/dist/utils/replaceInFilesByMap.js +70 -0
  103. package/dist/utils/replaceInPackage.js +151 -0
  104. package/dist/utils/resetPackageVersion.js +134 -0
  105. package/package.json +2 -2
  106. package/src/config/auth.config.js +0 -27
  107. package/src/config/default.config.js +0 -176
  108. package/src/config/index.js +0 -9
  109. package/src/initData/defaultTemplate.html +0 -13
  110. package/src/initData/neo.config.js +0 -138
  111. package/src/module/inspect.js +0 -41
  112. package/src/module/neoInit.js +0 -55
  113. package/src/module/neoInitByCopy.js +0 -61
  114. package/src/neo/NeoUMDContent.js +0 -30
  115. package/src/neo/neoLogin.js +0 -565
  116. package/src/neo/neoRequire.js +0 -125
  117. package/src/neo/neoService.js +0 -874
  118. package/src/neo/webpack.mf.js +0 -60
  119. package/src/neo/wrapperContent.js +0 -16
  120. package/src/oss/publish2oss.js +0 -348
  121. package/src/plugins/AddNeoRequirePlugin-v1.js +0 -47
  122. package/src/plugins/AddNeoRequirePlugin.js +0 -179
  123. package/src/plugins/README.md +0 -109
  124. package/src/utils/autoEntryRootDir.js +0 -85
  125. package/src/utils/cmpUtils/createCmpByTemplate.js +0 -60
  126. package/src/utils/cmpUtils/createCmpByZip.js +0 -408
  127. package/src/utils/cmpUtils/createCommonModulesCode.js +0 -121
  128. package/src/utils/cmpUtils/deleteCmp.js +0 -63
  129. package/src/utils/cmpUtils/getCmpModelRegisterCode.js +0 -31
  130. package/src/utils/cmpUtils/getCmpPreviewCode.js +0 -43
  131. package/src/utils/cmpUtils/getCmpRegisterCode.js +0 -31
  132. package/src/utils/cmpUtils/getCmpTypeByDir.js +0 -41
  133. package/src/utils/cmpUtils/hasCmpTypeByDir.js +0 -11
  134. package/src/utils/cmpUtils/previewCmp.js +0 -55
  135. package/src/utils/cmpUtils/pullCmp.js +0 -104
  136. package/src/utils/cmpUtils/pushCmp.js +0 -230
  137. package/src/utils/common.js +0 -107
  138. package/src/utils/configureNeoBuild.js +0 -109
  139. package/src/utils/generateEntries.js +0 -63
  140. package/src/utils/neoConfigInit.js +0 -13
  141. package/src/utils/neoParams.js +0 -12
  142. package/src/utils/pathUtils.js +0 -23
  143. package/src/utils/projectNameValidator.js +0 -76
  144. package/src/utils/projectUtils/createCmpProjectByTemplate.js +0 -59
  145. package/src/utils/projectUtils/createCmpProjectZip.js +0 -120
  146. package/src/utils/projectUtils/getEntries.js +0 -80
  147. package/src/utils/projectUtils/getEntriesWithAutoRegister.js +0 -108
  148. package/src/utils/projectUtils/hasNeoProject.js +0 -17
  149. package/src/utils/projectUtils/openProject.js +0 -94
  150. package/src/utils/projectUtils/updatePublishLog.js +0 -30
  151. package/src/utils/replaceInFiles.js +0 -47
  152. package/src/utils/replaceInFilesByMap.js +0 -54
  153. package/src/utils/replaceInPackage.js +0 -134
  154. package/src/utils/resetPackageVersion.js +0 -115
@@ -0,0 +1,449 @@
1
+ 'use strict';
2
+
3
+ var util = require('../../../_virtual/util.js');
4
+
5
+ /* -*- Mode: js; js-indent-level: 2; -*- */
6
+
7
+ var hasRequiredUtil;
8
+
9
+ function requireUtil () {
10
+ if (hasRequiredUtil) return util.__exports;
11
+ hasRequiredUtil = 1;
12
+ (function (exports$1) {
13
+ /*
14
+ * Copyright 2011 Mozilla Foundation and contributors
15
+ * Licensed under the New BSD license. See LICENSE or:
16
+ * http://opensource.org/licenses/BSD-3-Clause
17
+ */
18
+
19
+ /**
20
+ * This is a helper function for getting values from parameter/options
21
+ * objects.
22
+ *
23
+ * @param args The object we are extracting values from
24
+ * @param name The name of the property we are getting.
25
+ * @param defaultValue An optional value to return if the property is missing
26
+ * from the object. If this is not specified and the property is missing, an
27
+ * error will be thrown.
28
+ */
29
+ function getArg(aArgs, aName, aDefaultValue) {
30
+ if (aName in aArgs) {
31
+ return aArgs[aName];
32
+ } else if (arguments.length === 3) {
33
+ return aDefaultValue;
34
+ } else {
35
+ throw new Error('"' + aName + '" is a required argument.');
36
+ }
37
+ }
38
+ exports$1.getArg = getArg;
39
+ var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
40
+ var dataUrlRegexp = /^data:.+\,.+$/;
41
+ function urlParse(aUrl) {
42
+ var match = aUrl.match(urlRegexp);
43
+ if (!match) {
44
+ return null;
45
+ }
46
+ return {
47
+ scheme: match[1],
48
+ auth: match[2],
49
+ host: match[3],
50
+ port: match[4],
51
+ path: match[5]
52
+ };
53
+ }
54
+ exports$1.urlParse = urlParse;
55
+ function urlGenerate(aParsedUrl) {
56
+ var url = '';
57
+ if (aParsedUrl.scheme) {
58
+ url += aParsedUrl.scheme + ':';
59
+ }
60
+ url += '//';
61
+ if (aParsedUrl.auth) {
62
+ url += aParsedUrl.auth + '@';
63
+ }
64
+ if (aParsedUrl.host) {
65
+ url += aParsedUrl.host;
66
+ }
67
+ if (aParsedUrl.port) {
68
+ url += ":" + aParsedUrl.port;
69
+ }
70
+ if (aParsedUrl.path) {
71
+ url += aParsedUrl.path;
72
+ }
73
+ return url;
74
+ }
75
+ exports$1.urlGenerate = urlGenerate;
76
+
77
+ /**
78
+ * Normalizes a path, or the path portion of a URL:
79
+ *
80
+ * - Replaces consecutive slashes with one slash.
81
+ * - Removes unnecessary '.' parts.
82
+ * - Removes unnecessary '<dir>/..' parts.
83
+ *
84
+ * Based on code in the Node.js 'path' core module.
85
+ *
86
+ * @param aPath The path or url to normalize.
87
+ */
88
+ function normalize(aPath) {
89
+ var path = aPath;
90
+ var url = urlParse(aPath);
91
+ if (url) {
92
+ if (!url.path) {
93
+ return aPath;
94
+ }
95
+ path = url.path;
96
+ }
97
+ var isAbsolute = exports$1.isAbsolute(path);
98
+ var parts = path.split(/\/+/);
99
+ for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
100
+ part = parts[i];
101
+ if (part === '.') {
102
+ parts.splice(i, 1);
103
+ } else if (part === '..') {
104
+ up++;
105
+ } else if (up > 0) {
106
+ if (part === '') {
107
+ // The first part is blank if the path is absolute. Trying to go
108
+ // above the root is a no-op. Therefore we can remove all '..' parts
109
+ // directly after the root.
110
+ parts.splice(i + 1, up);
111
+ up = 0;
112
+ } else {
113
+ parts.splice(i, 2);
114
+ up--;
115
+ }
116
+ }
117
+ }
118
+ path = parts.join('/');
119
+ if (path === '') {
120
+ path = isAbsolute ? '/' : '.';
121
+ }
122
+ if (url) {
123
+ url.path = path;
124
+ return urlGenerate(url);
125
+ }
126
+ return path;
127
+ }
128
+ exports$1.normalize = normalize;
129
+
130
+ /**
131
+ * Joins two paths/URLs.
132
+ *
133
+ * @param aRoot The root path or URL.
134
+ * @param aPath The path or URL to be joined with the root.
135
+ *
136
+ * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
137
+ * scheme-relative URL: Then the scheme of aRoot, if any, is prepended
138
+ * first.
139
+ * - Otherwise aPath is a path. If aRoot is a URL, then its path portion
140
+ * is updated with the result and aRoot is returned. Otherwise the result
141
+ * is returned.
142
+ * - If aPath is absolute, the result is aPath.
143
+ * - Otherwise the two paths are joined with a slash.
144
+ * - Joining for example 'http://' and 'www.example.com' is also supported.
145
+ */
146
+ function join(aRoot, aPath) {
147
+ if (aRoot === "") {
148
+ aRoot = ".";
149
+ }
150
+ if (aPath === "") {
151
+ aPath = ".";
152
+ }
153
+ var aPathUrl = urlParse(aPath);
154
+ var aRootUrl = urlParse(aRoot);
155
+ if (aRootUrl) {
156
+ aRoot = aRootUrl.path || '/';
157
+ }
158
+
159
+ // `join(foo, '//www.example.org')`
160
+ if (aPathUrl && !aPathUrl.scheme) {
161
+ if (aRootUrl) {
162
+ aPathUrl.scheme = aRootUrl.scheme;
163
+ }
164
+ return urlGenerate(aPathUrl);
165
+ }
166
+ if (aPathUrl || aPath.match(dataUrlRegexp)) {
167
+ return aPath;
168
+ }
169
+
170
+ // `join('http://', 'www.example.com')`
171
+ if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
172
+ aRootUrl.host = aPath;
173
+ return urlGenerate(aRootUrl);
174
+ }
175
+ var joined = aPath.charAt(0) === '/' ? aPath : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
176
+ if (aRootUrl) {
177
+ aRootUrl.path = joined;
178
+ return urlGenerate(aRootUrl);
179
+ }
180
+ return joined;
181
+ }
182
+ exports$1.join = join;
183
+ exports$1.isAbsolute = function (aPath) {
184
+ return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
185
+ };
186
+
187
+ /**
188
+ * Make a path relative to a URL or another path.
189
+ *
190
+ * @param aRoot The root path or URL.
191
+ * @param aPath The path or URL to be made relative to aRoot.
192
+ */
193
+ function relative(aRoot, aPath) {
194
+ if (aRoot === "") {
195
+ aRoot = ".";
196
+ }
197
+ aRoot = aRoot.replace(/\/$/, '');
198
+
199
+ // It is possible for the path to be above the root. In this case, simply
200
+ // checking whether the root is a prefix of the path won't work. Instead, we
201
+ // need to remove components from the root one by one, until either we find
202
+ // a prefix that fits, or we run out of components to remove.
203
+ var level = 0;
204
+ while (aPath.indexOf(aRoot + '/') !== 0) {
205
+ var index = aRoot.lastIndexOf("/");
206
+ if (index < 0) {
207
+ return aPath;
208
+ }
209
+
210
+ // If the only part of the root that is left is the scheme (i.e. http://,
211
+ // file:///, etc.), one or more slashes (/), or simply nothing at all, we
212
+ // have exhausted all components, so the path is not relative to the root.
213
+ aRoot = aRoot.slice(0, index);
214
+ if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
215
+ return aPath;
216
+ }
217
+ ++level;
218
+ }
219
+
220
+ // Make sure we add a "../" for each component we removed from the root.
221
+ return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
222
+ }
223
+ exports$1.relative = relative;
224
+ var supportsNullProto = function () {
225
+ var obj = Object.create(null);
226
+ return !('__proto__' in obj);
227
+ }();
228
+ function identity(s) {
229
+ return s;
230
+ }
231
+
232
+ /**
233
+ * Because behavior goes wacky when you set `__proto__` on objects, we
234
+ * have to prefix all the strings in our set with an arbitrary character.
235
+ *
236
+ * See https://github.com/mozilla/source-map/pull/31 and
237
+ * https://github.com/mozilla/source-map/issues/30
238
+ *
239
+ * @param String aStr
240
+ */
241
+ function toSetString(aStr) {
242
+ if (isProtoString(aStr)) {
243
+ return '$' + aStr;
244
+ }
245
+ return aStr;
246
+ }
247
+ exports$1.toSetString = supportsNullProto ? identity : toSetString;
248
+ function fromSetString(aStr) {
249
+ if (isProtoString(aStr)) {
250
+ return aStr.slice(1);
251
+ }
252
+ return aStr;
253
+ }
254
+ exports$1.fromSetString = supportsNullProto ? identity : fromSetString;
255
+ function isProtoString(s) {
256
+ if (!s) {
257
+ return false;
258
+ }
259
+ var length = s.length;
260
+ if (length < 9 /* "__proto__".length */) {
261
+ return false;
262
+ }
263
+ if (s.charCodeAt(length - 1) !== 95 /* '_' */ || s.charCodeAt(length - 2) !== 95 /* '_' */ || s.charCodeAt(length - 3) !== 111 /* 'o' */ || s.charCodeAt(length - 4) !== 116 /* 't' */ || s.charCodeAt(length - 5) !== 111 /* 'o' */ || s.charCodeAt(length - 6) !== 114 /* 'r' */ || s.charCodeAt(length - 7) !== 112 /* 'p' */ || s.charCodeAt(length - 8) !== 95 /* '_' */ || s.charCodeAt(length - 9) !== 95 /* '_' */) {
264
+ return false;
265
+ }
266
+ for (var i = length - 10; i >= 0; i--) {
267
+ if (s.charCodeAt(i) !== 36 /* '$' */) {
268
+ return false;
269
+ }
270
+ }
271
+ return true;
272
+ }
273
+
274
+ /**
275
+ * Comparator between two mappings where the original positions are compared.
276
+ *
277
+ * Optionally pass in `true` as `onlyCompareGenerated` to consider two
278
+ * mappings with the same original source/line/column, but different generated
279
+ * line and column the same. Useful when searching for a mapping with a
280
+ * stubbed out mapping.
281
+ */
282
+ function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
283
+ var cmp = strcmp(mappingA.source, mappingB.source);
284
+ if (cmp !== 0) {
285
+ return cmp;
286
+ }
287
+ cmp = mappingA.originalLine - mappingB.originalLine;
288
+ if (cmp !== 0) {
289
+ return cmp;
290
+ }
291
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
292
+ if (cmp !== 0 || onlyCompareOriginal) {
293
+ return cmp;
294
+ }
295
+ cmp = mappingA.generatedColumn - mappingB.generatedColumn;
296
+ if (cmp !== 0) {
297
+ return cmp;
298
+ }
299
+ cmp = mappingA.generatedLine - mappingB.generatedLine;
300
+ if (cmp !== 0) {
301
+ return cmp;
302
+ }
303
+ return strcmp(mappingA.name, mappingB.name);
304
+ }
305
+ exports$1.compareByOriginalPositions = compareByOriginalPositions;
306
+
307
+ /**
308
+ * Comparator between two mappings with deflated source and name indices where
309
+ * the generated positions are compared.
310
+ *
311
+ * Optionally pass in `true` as `onlyCompareGenerated` to consider two
312
+ * mappings with the same generated line and column, but different
313
+ * source/name/original line and column the same. Useful when searching for a
314
+ * mapping with a stubbed out mapping.
315
+ */
316
+ function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
317
+ var cmp = mappingA.generatedLine - mappingB.generatedLine;
318
+ if (cmp !== 0) {
319
+ return cmp;
320
+ }
321
+ cmp = mappingA.generatedColumn - mappingB.generatedColumn;
322
+ if (cmp !== 0 || onlyCompareGenerated) {
323
+ return cmp;
324
+ }
325
+ cmp = strcmp(mappingA.source, mappingB.source);
326
+ if (cmp !== 0) {
327
+ return cmp;
328
+ }
329
+ cmp = mappingA.originalLine - mappingB.originalLine;
330
+ if (cmp !== 0) {
331
+ return cmp;
332
+ }
333
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
334
+ if (cmp !== 0) {
335
+ return cmp;
336
+ }
337
+ return strcmp(mappingA.name, mappingB.name);
338
+ }
339
+ exports$1.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
340
+ function strcmp(aStr1, aStr2) {
341
+ if (aStr1 === aStr2) {
342
+ return 0;
343
+ }
344
+ if (aStr1 === null) {
345
+ return 1; // aStr2 !== null
346
+ }
347
+ if (aStr2 === null) {
348
+ return -1; // aStr1 !== null
349
+ }
350
+ if (aStr1 > aStr2) {
351
+ return 1;
352
+ }
353
+ return -1;
354
+ }
355
+
356
+ /**
357
+ * Comparator between two mappings with inflated source and name strings where
358
+ * the generated positions are compared.
359
+ */
360
+ function compareByGeneratedPositionsInflated(mappingA, mappingB) {
361
+ var cmp = mappingA.generatedLine - mappingB.generatedLine;
362
+ if (cmp !== 0) {
363
+ return cmp;
364
+ }
365
+ cmp = mappingA.generatedColumn - mappingB.generatedColumn;
366
+ if (cmp !== 0) {
367
+ return cmp;
368
+ }
369
+ cmp = strcmp(mappingA.source, mappingB.source);
370
+ if (cmp !== 0) {
371
+ return cmp;
372
+ }
373
+ cmp = mappingA.originalLine - mappingB.originalLine;
374
+ if (cmp !== 0) {
375
+ return cmp;
376
+ }
377
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
378
+ if (cmp !== 0) {
379
+ return cmp;
380
+ }
381
+ return strcmp(mappingA.name, mappingB.name);
382
+ }
383
+ exports$1.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
384
+
385
+ /**
386
+ * Strip any JSON XSSI avoidance prefix from the string (as documented
387
+ * in the source maps specification), and then parse the string as
388
+ * JSON.
389
+ */
390
+ function parseSourceMapInput(str) {
391
+ return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
392
+ }
393
+ exports$1.parseSourceMapInput = parseSourceMapInput;
394
+
395
+ /**
396
+ * Compute the URL of a source given the the source root, the source's
397
+ * URL, and the source map's URL.
398
+ */
399
+ function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
400
+ sourceURL = sourceURL || '';
401
+ if (sourceRoot) {
402
+ // This follows what Chrome does.
403
+ if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {
404
+ sourceRoot += '/';
405
+ }
406
+ // The spec says:
407
+ // Line 4: An optional source root, useful for relocating source
408
+ // files on a server or removing repeated values in the
409
+ // “sources” entry. This value is prepended to the individual
410
+ // entries in the “source” field.
411
+ sourceURL = sourceRoot + sourceURL;
412
+ }
413
+
414
+ // Historically, SourceMapConsumer did not take the sourceMapURL as
415
+ // a parameter. This mode is still somewhat supported, which is why
416
+ // this code block is conditional. However, it's preferable to pass
417
+ // the source map URL to SourceMapConsumer, so that this function
418
+ // can implement the source URL resolution algorithm as outlined in
419
+ // the spec. This block is basically the equivalent of:
420
+ // new URL(sourceURL, sourceMapURL).toString()
421
+ // ... except it avoids using URL, which wasn't available in the
422
+ // older releases of node still supported by this library.
423
+ //
424
+ // The spec says:
425
+ // If the sources are not absolute URLs after prepending of the
426
+ // “sourceRoot”, the sources are resolved relative to the
427
+ // SourceMap (like resolving script src in a html document).
428
+ if (sourceMapURL) {
429
+ var parsed = urlParse(sourceMapURL);
430
+ if (!parsed) {
431
+ throw new Error("sourceMapURL could not be parsed");
432
+ }
433
+ if (parsed.path) {
434
+ // Strip the last path component, but keep the "/".
435
+ var index = parsed.path.lastIndexOf('/');
436
+ if (index >= 0) {
437
+ parsed.path = parsed.path.substring(0, index + 1);
438
+ }
439
+ }
440
+ sourceURL = join(urlGenerate(parsed), sourceURL);
441
+ }
442
+ return normalize(sourceURL);
443
+ }
444
+ exports$1.computeSourceURL = computeSourceURL;
445
+ } (util.__exports));
446
+ return util.__exports;
447
+ }
448
+
449
+ exports.__require = requireUtil;
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ var sourceMap = require('../../_virtual/source-map.js');
4
+ var sourceMapGenerator = require('./lib/source-map-generator.js');
5
+ var sourceMapConsumer = require('./lib/source-map-consumer.js');
6
+ var sourceNode = require('./lib/source-node.js');
7
+
8
+ /*
9
+ * Copyright 2009-2011 Mozilla Foundation and contributors
10
+ * Licensed under the New BSD license. See LICENSE.txt or:
11
+ * http://opensource.org/licenses/BSD-3-Clause
12
+ */
13
+
14
+ var hasRequiredSourceMap;
15
+
16
+ function requireSourceMap () {
17
+ if (hasRequiredSourceMap) return sourceMap.__exports;
18
+ hasRequiredSourceMap = 1;
19
+ sourceMap.__exports.SourceMapGenerator = sourceMapGenerator.__require().SourceMapGenerator;
20
+ sourceMap.__exports.SourceMapConsumer = sourceMapConsumer.__require().SourceMapConsumer;
21
+ sourceMap.__exports.SourceNode = sourceNode.__require().SourceNode;
22
+ return sourceMap.__exports;
23
+ }
24
+
25
+ exports.__require = requireSourceMap;