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,134 @@
1
+ 'use strict';
2
+
3
+ var arraySet = require('../../../_virtual/array-set.js');
4
+ var util = require('./util.js');
5
+
6
+ /* -*- Mode: js; js-indent-level: 2; -*- */
7
+
8
+ var hasRequiredArraySet;
9
+
10
+ function requireArraySet () {
11
+ if (hasRequiredArraySet) return arraySet.__exports;
12
+ hasRequiredArraySet = 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
+ var util$1 = util.__require();
20
+ var has = Object.prototype.hasOwnProperty;
21
+ var hasNativeMap = typeof Map !== "undefined";
22
+
23
+ /**
24
+ * A data structure which is a combination of an array and a set. Adding a new
25
+ * member is O(1), testing for membership is O(1), and finding the index of an
26
+ * element is O(1). Removing elements from the set is not supported. Only
27
+ * strings are supported for membership.
28
+ */
29
+ function ArraySet() {
30
+ this._array = [];
31
+ this._set = hasNativeMap ? new Map() : Object.create(null);
32
+ }
33
+
34
+ /**
35
+ * Static method for creating ArraySet instances from an existing array.
36
+ */
37
+ ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
38
+ var set = new ArraySet();
39
+ for (var i = 0, len = aArray.length; i < len; i++) {
40
+ set.add(aArray[i], aAllowDuplicates);
41
+ }
42
+ return set;
43
+ };
44
+
45
+ /**
46
+ * Return how many unique items are in this ArraySet. If duplicates have been
47
+ * added, than those do not count towards the size.
48
+ *
49
+ * @returns Number
50
+ */
51
+ ArraySet.prototype.size = function ArraySet_size() {
52
+ return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
53
+ };
54
+
55
+ /**
56
+ * Add the given string to this set.
57
+ *
58
+ * @param String aStr
59
+ */
60
+ ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
61
+ var sStr = hasNativeMap ? aStr : util$1.toSetString(aStr);
62
+ var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
63
+ var idx = this._array.length;
64
+ if (!isDuplicate || aAllowDuplicates) {
65
+ this._array.push(aStr);
66
+ }
67
+ if (!isDuplicate) {
68
+ if (hasNativeMap) {
69
+ this._set.set(aStr, idx);
70
+ } else {
71
+ this._set[sStr] = idx;
72
+ }
73
+ }
74
+ };
75
+
76
+ /**
77
+ * Is the given string a member of this set?
78
+ *
79
+ * @param String aStr
80
+ */
81
+ ArraySet.prototype.has = function ArraySet_has(aStr) {
82
+ if (hasNativeMap) {
83
+ return this._set.has(aStr);
84
+ } else {
85
+ var sStr = util$1.toSetString(aStr);
86
+ return has.call(this._set, sStr);
87
+ }
88
+ };
89
+
90
+ /**
91
+ * What is the index of the given string in the array?
92
+ *
93
+ * @param String aStr
94
+ */
95
+ ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
96
+ if (hasNativeMap) {
97
+ var idx = this._set.get(aStr);
98
+ if (idx >= 0) {
99
+ return idx;
100
+ }
101
+ } else {
102
+ var sStr = util$1.toSetString(aStr);
103
+ if (has.call(this._set, sStr)) {
104
+ return this._set[sStr];
105
+ }
106
+ }
107
+ throw new Error('"' + aStr + '" is not in the set.');
108
+ };
109
+
110
+ /**
111
+ * What is the element at the given index?
112
+ *
113
+ * @param Number aIdx
114
+ */
115
+ ArraySet.prototype.at = function ArraySet_at(aIdx) {
116
+ if (aIdx >= 0 && aIdx < this._array.length) {
117
+ return this._array[aIdx];
118
+ }
119
+ throw new Error('No element indexed by ' + aIdx);
120
+ };
121
+
122
+ /**
123
+ * Returns the array representation of this set (which has the proper indices
124
+ * indicated by indexOf). Note that this is a copy of the internal array used
125
+ * for storing the members so that no one can mess with internal state.
126
+ */
127
+ ArraySet.prototype.toArray = function ArraySet_toArray() {
128
+ return this._array.slice();
129
+ };
130
+ arraySet.__exports.ArraySet = ArraySet;
131
+ return arraySet.__exports;
132
+ }
133
+
134
+ exports.__require = requireArraySet;
@@ -0,0 +1,144 @@
1
+ 'use strict';
2
+
3
+ var base64Vlq = require('../../../_virtual/base64-vlq.js');
4
+ var base64 = require('./base64.js');
5
+
6
+ /* -*- Mode: js; js-indent-level: 2; -*- */
7
+
8
+ var hasRequiredBase64Vlq;
9
+
10
+ function requireBase64Vlq () {
11
+ if (hasRequiredBase64Vlq) return base64Vlq.__exports;
12
+ hasRequiredBase64Vlq = 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
+ * Based on the Base 64 VLQ implementation in Closure Compiler:
19
+ * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
20
+ *
21
+ * Copyright 2011 The Closure Compiler Authors. All rights reserved.
22
+ * Redistribution and use in source and binary forms, with or without
23
+ * modification, are permitted provided that the following conditions are
24
+ * met:
25
+ *
26
+ * * Redistributions of source code must retain the above copyright
27
+ * notice, this list of conditions and the following disclaimer.
28
+ * * Redistributions in binary form must reproduce the above
29
+ * copyright notice, this list of conditions and the following
30
+ * disclaimer in the documentation and/or other materials provided
31
+ * with the distribution.
32
+ * * Neither the name of Google Inc. nor the names of its
33
+ * contributors may be used to endorse or promote products derived
34
+ * from this software without specific prior written permission.
35
+ *
36
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
37
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
38
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
39
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
40
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
43
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
44
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
45
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
46
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
47
+ */
48
+
49
+ var base64$1 = base64.__require();
50
+
51
+ // A single base 64 digit can contain 6 bits of data. For the base 64 variable
52
+ // length quantities we use in the source map spec, the first bit is the sign,
53
+ // the next four bits are the actual value, and the 6th bit is the
54
+ // continuation bit. The continuation bit tells us whether there are more
55
+ // digits in this value following this digit.
56
+ //
57
+ // Continuation
58
+ // | Sign
59
+ // | |
60
+ // V V
61
+ // 101011
62
+
63
+ var VLQ_BASE_SHIFT = 5;
64
+
65
+ // binary: 100000
66
+ var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
67
+
68
+ // binary: 011111
69
+ var VLQ_BASE_MASK = VLQ_BASE - 1;
70
+
71
+ // binary: 100000
72
+ var VLQ_CONTINUATION_BIT = VLQ_BASE;
73
+
74
+ /**
75
+ * Converts from a two-complement value to a value where the sign bit is
76
+ * placed in the least significant bit. For example, as decimals:
77
+ * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
78
+ * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
79
+ */
80
+ function toVLQSigned(aValue) {
81
+ return aValue < 0 ? (-aValue << 1) + 1 : (aValue << 1) + 0;
82
+ }
83
+
84
+ /**
85
+ * Converts to a two-complement value from a value where the sign bit is
86
+ * placed in the least significant bit. For example, as decimals:
87
+ * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
88
+ * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
89
+ */
90
+ function fromVLQSigned(aValue) {
91
+ var isNegative = (aValue & 1) === 1;
92
+ var shifted = aValue >> 1;
93
+ return isNegative ? -shifted : shifted;
94
+ }
95
+
96
+ /**
97
+ * Returns the base 64 VLQ encoded value.
98
+ */
99
+ base64Vlq.__exports.encode = function base64VLQ_encode(aValue) {
100
+ var encoded = "";
101
+ var digit;
102
+ var vlq = toVLQSigned(aValue);
103
+ do {
104
+ digit = vlq & VLQ_BASE_MASK;
105
+ vlq >>>= VLQ_BASE_SHIFT;
106
+ if (vlq > 0) {
107
+ // There are still more digits in this value, so we must make sure the
108
+ // continuation bit is marked.
109
+ digit |= VLQ_CONTINUATION_BIT;
110
+ }
111
+ encoded += base64$1.encode(digit);
112
+ } while (vlq > 0);
113
+ return encoded;
114
+ };
115
+
116
+ /**
117
+ * Decodes the next base 64 VLQ value from the given string and returns the
118
+ * value and the rest of the string via the out parameter.
119
+ */
120
+ base64Vlq.__exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
121
+ var strLen = aStr.length;
122
+ var result = 0;
123
+ var shift = 0;
124
+ var continuation, digit;
125
+ do {
126
+ if (aIndex >= strLen) {
127
+ throw new Error("Expected more digits in base 64 VLQ value.");
128
+ }
129
+ digit = base64$1.decode(aStr.charCodeAt(aIndex++));
130
+ if (digit === -1) {
131
+ throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
132
+ }
133
+ continuation = !!(digit & VLQ_CONTINUATION_BIT);
134
+ digit &= VLQ_BASE_MASK;
135
+ result = result + (digit << shift);
136
+ shift += VLQ_BASE_SHIFT;
137
+ } while (continuation);
138
+ aOutParam.value = fromVLQSigned(result);
139
+ aOutParam.rest = aIndex;
140
+ };
141
+ return base64Vlq.__exports;
142
+ }
143
+
144
+ exports.__require = requireBase64Vlq;
@@ -0,0 +1,81 @@
1
+ 'use strict';
2
+
3
+ var base64 = require('../../../_virtual/base64.js');
4
+
5
+ /* -*- Mode: js; js-indent-level: 2; -*- */
6
+
7
+ var hasRequiredBase64;
8
+
9
+ function requireBase64 () {
10
+ if (hasRequiredBase64) return base64.__exports;
11
+ hasRequiredBase64 = 1;
12
+ /*
13
+ * Copyright 2011 Mozilla Foundation and contributors
14
+ * Licensed under the New BSD license. See LICENSE or:
15
+ * http://opensource.org/licenses/BSD-3-Clause
16
+ */
17
+
18
+ var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
19
+
20
+ /**
21
+ * Encode an integer in the range of 0 to 63 to a single base 64 digit.
22
+ */
23
+ base64.__exports.encode = function (number) {
24
+ if (0 <= number && number < intToCharMap.length) {
25
+ return intToCharMap[number];
26
+ }
27
+ throw new TypeError("Must be between 0 and 63: " + number);
28
+ };
29
+
30
+ /**
31
+ * Decode a single base 64 character code digit to an integer. Returns -1 on
32
+ * failure.
33
+ */
34
+ base64.__exports.decode = function (charCode) {
35
+ var bigA = 65; // 'A'
36
+ var bigZ = 90; // 'Z'
37
+
38
+ var littleA = 97; // 'a'
39
+ var littleZ = 122; // 'z'
40
+
41
+ var zero = 48; // '0'
42
+ var nine = 57; // '9'
43
+
44
+ var plus = 43; // '+'
45
+ var slash = 47; // '/'
46
+
47
+ var littleOffset = 26;
48
+ var numberOffset = 52;
49
+
50
+ // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
51
+ if (bigA <= charCode && charCode <= bigZ) {
52
+ return charCode - bigA;
53
+ }
54
+
55
+ // 26 - 51: abcdefghijklmnopqrstuvwxyz
56
+ if (littleA <= charCode && charCode <= littleZ) {
57
+ return charCode - littleA + littleOffset;
58
+ }
59
+
60
+ // 52 - 61: 0123456789
61
+ if (zero <= charCode && charCode <= nine) {
62
+ return charCode - zero + numberOffset;
63
+ }
64
+
65
+ // 62: +
66
+ if (charCode == plus) {
67
+ return 62;
68
+ }
69
+
70
+ // 63: /
71
+ if (charCode == slash) {
72
+ return 63;
73
+ }
74
+
75
+ // Invalid base64 digit.
76
+ return -1;
77
+ };
78
+ return base64.__exports;
79
+ }
80
+
81
+ exports.__require = requireBase64;
@@ -0,0 +1,122 @@
1
+ 'use strict';
2
+
3
+ var binarySearch = require('../../../_virtual/binary-search.js');
4
+
5
+ /* -*- Mode: js; js-indent-level: 2; -*- */
6
+
7
+ var hasRequiredBinarySearch;
8
+
9
+ function requireBinarySearch () {
10
+ if (hasRequiredBinarySearch) return binarySearch.__exports;
11
+ hasRequiredBinarySearch = 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
+ exports$1.GREATEST_LOWER_BOUND = 1;
20
+ exports$1.LEAST_UPPER_BOUND = 2;
21
+
22
+ /**
23
+ * Recursive implementation of binary search.
24
+ *
25
+ * @param aLow Indices here and lower do not contain the needle.
26
+ * @param aHigh Indices here and higher do not contain the needle.
27
+ * @param aNeedle The element being searched for.
28
+ * @param aHaystack The non-empty array being searched.
29
+ * @param aCompare Function which takes two elements and returns -1, 0, or 1.
30
+ * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
31
+ * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
32
+ * closest element that is smaller than or greater than the one we are
33
+ * searching for, respectively, if the exact element cannot be found.
34
+ */
35
+ function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
36
+ // This function terminates when one of the following is true:
37
+ //
38
+ // 1. We find the exact element we are looking for.
39
+ //
40
+ // 2. We did not find the exact element, but we can return the index of
41
+ // the next-closest element.
42
+ //
43
+ // 3. We did not find the exact element, and there is no next-closest
44
+ // element than the one we are searching for, so we return -1.
45
+ var mid = Math.floor((aHigh - aLow) / 2) + aLow;
46
+ var cmp = aCompare(aNeedle, aHaystack[mid], true);
47
+ if (cmp === 0) {
48
+ // Found the element we are looking for.
49
+ return mid;
50
+ } else if (cmp > 0) {
51
+ // Our needle is greater than aHaystack[mid].
52
+ if (aHigh - mid > 1) {
53
+ // The element is in the upper half.
54
+ return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
55
+ }
56
+
57
+ // The exact needle element was not found in this haystack. Determine if
58
+ // we are in termination case (3) or (2) and return the appropriate thing.
59
+ if (aBias == exports$1.LEAST_UPPER_BOUND) {
60
+ return aHigh < aHaystack.length ? aHigh : -1;
61
+ } else {
62
+ return mid;
63
+ }
64
+ } else {
65
+ // Our needle is less than aHaystack[mid].
66
+ if (mid - aLow > 1) {
67
+ // The element is in the lower half.
68
+ return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
69
+ }
70
+
71
+ // we are in termination case (3) or (2) and return the appropriate thing.
72
+ if (aBias == exports$1.LEAST_UPPER_BOUND) {
73
+ return mid;
74
+ } else {
75
+ return aLow < 0 ? -1 : aLow;
76
+ }
77
+ }
78
+ }
79
+
80
+ /**
81
+ * This is an implementation of binary search which will always try and return
82
+ * the index of the closest element if there is no exact hit. This is because
83
+ * mappings between original and generated line/col pairs are single points,
84
+ * and there is an implicit region between each of them, so a miss just means
85
+ * that you aren't on the very start of a region.
86
+ *
87
+ * @param aNeedle The element you are looking for.
88
+ * @param aHaystack The array that is being searched.
89
+ * @param aCompare A function which takes the needle and an element in the
90
+ * array and returns -1, 0, or 1 depending on whether the needle is less
91
+ * than, equal to, or greater than the element, respectively.
92
+ * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
93
+ * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
94
+ * closest element that is smaller than or greater than the one we are
95
+ * searching for, respectively, if the exact element cannot be found.
96
+ * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
97
+ */
98
+ exports$1.search = function search(aNeedle, aHaystack, aCompare, aBias) {
99
+ if (aHaystack.length === 0) {
100
+ return -1;
101
+ }
102
+ var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, aCompare, aBias || exports$1.GREATEST_LOWER_BOUND);
103
+ if (index < 0) {
104
+ return -1;
105
+ }
106
+
107
+ // We have found either the exact element, or the next-closest element than
108
+ // the one we are searching for. However, there may be more than one such
109
+ // element. Make sure we always return the smallest of these.
110
+ while (index - 1 >= 0) {
111
+ if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
112
+ break;
113
+ }
114
+ --index;
115
+ }
116
+ return index;
117
+ };
118
+ } (binarySearch.__exports));
119
+ return binarySearch.__exports;
120
+ }
121
+
122
+ exports.__require = requireBinarySearch;
@@ -0,0 +1,94 @@
1
+ 'use strict';
2
+
3
+ var mappingList = require('../../../_virtual/mapping-list.js');
4
+ var util = require('./util.js');
5
+
6
+ /* -*- Mode: js; js-indent-level: 2; -*- */
7
+
8
+ var hasRequiredMappingList;
9
+
10
+ function requireMappingList () {
11
+ if (hasRequiredMappingList) return mappingList.__exports;
12
+ hasRequiredMappingList = 1;
13
+ /*
14
+ * Copyright 2014 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
+ var util$1 = util.__require();
20
+
21
+ /**
22
+ * Determine whether mappingB is after mappingA with respect to generated
23
+ * position.
24
+ */
25
+ function generatedPositionAfter(mappingA, mappingB) {
26
+ // Optimized for most common case
27
+ var lineA = mappingA.generatedLine;
28
+ var lineB = mappingB.generatedLine;
29
+ var columnA = mappingA.generatedColumn;
30
+ var columnB = mappingB.generatedColumn;
31
+ return lineB > lineA || lineB == lineA && columnB >= columnA || util$1.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
32
+ }
33
+
34
+ /**
35
+ * A data structure to provide a sorted view of accumulated mappings in a
36
+ * performance conscious manner. It trades a neglibable overhead in general
37
+ * case for a large speedup in case of mappings being added in order.
38
+ */
39
+ function MappingList() {
40
+ this._array = [];
41
+ this._sorted = true;
42
+ // Serves as infimum
43
+ this._last = {
44
+ generatedLine: -1,
45
+ generatedColumn: 0
46
+ };
47
+ }
48
+
49
+ /**
50
+ * Iterate through internal items. This method takes the same arguments that
51
+ * `Array.prototype.forEach` takes.
52
+ *
53
+ * NOTE: The order of the mappings is NOT guaranteed.
54
+ */
55
+ MappingList.prototype.unsortedForEach = function MappingList_forEach(aCallback, aThisArg) {
56
+ this._array.forEach(aCallback, aThisArg);
57
+ };
58
+
59
+ /**
60
+ * Add the given source mapping.
61
+ *
62
+ * @param Object aMapping
63
+ */
64
+ MappingList.prototype.add = function MappingList_add(aMapping) {
65
+ if (generatedPositionAfter(this._last, aMapping)) {
66
+ this._last = aMapping;
67
+ this._array.push(aMapping);
68
+ } else {
69
+ this._sorted = false;
70
+ this._array.push(aMapping);
71
+ }
72
+ };
73
+
74
+ /**
75
+ * Returns the flat, sorted array of mappings. The mappings are sorted by
76
+ * generated position.
77
+ *
78
+ * WARNING: This method returns internal data without copying, for
79
+ * performance. The return value must NOT be mutated, and should be treated as
80
+ * an immutable borrow. If you want to take ownership, you must make your own
81
+ * copy.
82
+ */
83
+ MappingList.prototype.toArray = function MappingList_toArray() {
84
+ if (!this._sorted) {
85
+ this._array.sort(util$1.compareByGeneratedPositionsInflated);
86
+ this._sorted = true;
87
+ }
88
+ return this._array;
89
+ };
90
+ mappingList.__exports.MappingList = MappingList;
91
+ return mappingList.__exports;
92
+ }
93
+
94
+ exports.__require = requireMappingList;
@@ -0,0 +1,126 @@
1
+ 'use strict';
2
+
3
+ var quickSort = require('../../../_virtual/quick-sort.js');
4
+
5
+ /* -*- Mode: js; js-indent-level: 2; -*- */
6
+
7
+ var hasRequiredQuickSort;
8
+
9
+ function requireQuickSort () {
10
+ if (hasRequiredQuickSort) return quickSort.__exports;
11
+ hasRequiredQuickSort = 1;
12
+ /*
13
+ * Copyright 2011 Mozilla Foundation and contributors
14
+ * Licensed under the New BSD license. See LICENSE or:
15
+ * http://opensource.org/licenses/BSD-3-Clause
16
+ */
17
+
18
+ // It turns out that some (most?) JavaScript engines don't self-host
19
+ // `Array.prototype.sort`. This makes sense because C++ will likely remain
20
+ // faster than JS when doing raw CPU-intensive sorting. However, when using a
21
+ // custom comparator function, calling back and forth between the VM's C++ and
22
+ // JIT'd JS is rather slow *and* loses JIT type information, resulting in
23
+ // worse generated code for the comparator function than would be optimal. In
24
+ // fact, when sorting with a comparator, these costs outweigh the benefits of
25
+ // sorting in C++. By using our own JS-implemented Quick Sort (below), we get
26
+ // a ~3500ms mean speed-up in `bench/bench.html`.
27
+
28
+ /**
29
+ * Swap the elements indexed by `x` and `y` in the array `ary`.
30
+ *
31
+ * @param {Array} ary
32
+ * The array.
33
+ * @param {Number} x
34
+ * The index of the first item.
35
+ * @param {Number} y
36
+ * The index of the second item.
37
+ */
38
+ function swap(ary, x, y) {
39
+ var temp = ary[x];
40
+ ary[x] = ary[y];
41
+ ary[y] = temp;
42
+ }
43
+
44
+ /**
45
+ * Returns a random integer within the range `low .. high` inclusive.
46
+ *
47
+ * @param {Number} low
48
+ * The lower bound on the range.
49
+ * @param {Number} high
50
+ * The upper bound on the range.
51
+ */
52
+ function randomIntInRange(low, high) {
53
+ return Math.round(low + Math.random() * (high - low));
54
+ }
55
+
56
+ /**
57
+ * The Quick Sort algorithm.
58
+ *
59
+ * @param {Array} ary
60
+ * An array to sort.
61
+ * @param {function} comparator
62
+ * Function to use to compare two items.
63
+ * @param {Number} p
64
+ * Start index of the array
65
+ * @param {Number} r
66
+ * End index of the array
67
+ */
68
+ function doQuickSort(ary, comparator, p, r) {
69
+ // If our lower bound is less than our upper bound, we (1) partition the
70
+ // array into two pieces and (2) recurse on each half. If it is not, this is
71
+ // the empty array and our base case.
72
+
73
+ if (p < r) {
74
+ // (1) Partitioning.
75
+ //
76
+ // The partitioning chooses a pivot between `p` and `r` and moves all
77
+ // elements that are less than or equal to the pivot to the before it, and
78
+ // all the elements that are greater than it after it. The effect is that
79
+ // once partition is done, the pivot is in the exact place it will be when
80
+ // the array is put in sorted order, and it will not need to be moved
81
+ // again. This runs in O(n) time.
82
+
83
+ // Always choose a random pivot so that an input array which is reverse
84
+ // sorted does not cause O(n^2) running time.
85
+ var pivotIndex = randomIntInRange(p, r);
86
+ var i = p - 1;
87
+ swap(ary, pivotIndex, r);
88
+ var pivot = ary[r];
89
+
90
+ // Immediately after `j` is incremented in this loop, the following hold
91
+ // true:
92
+ //
93
+ // * Every element in `ary[p .. i]` is less than or equal to the pivot.
94
+ //
95
+ // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
96
+ for (var j = p; j < r; j++) {
97
+ if (comparator(ary[j], pivot) <= 0) {
98
+ i += 1;
99
+ swap(ary, i, j);
100
+ }
101
+ }
102
+ swap(ary, i + 1, j);
103
+ var q = i + 1;
104
+
105
+ // (2) Recurse on each half.
106
+
107
+ doQuickSort(ary, comparator, p, q - 1);
108
+ doQuickSort(ary, comparator, q + 1, r);
109
+ }
110
+ }
111
+
112
+ /**
113
+ * Sort the given array in-place with the given comparator function.
114
+ *
115
+ * @param {Array} ary
116
+ * An array to sort.
117
+ * @param {function} comparator
118
+ * Function to use to compare two items.
119
+ */
120
+ quickSort.__exports.quickSort = function (ary, comparator) {
121
+ doQuickSort(ary, comparator, 0, ary.length - 1);
122
+ };
123
+ return quickSort.__exports;
124
+ }
125
+
126
+ exports.__require = requireQuickSort;