react 0.14.0-alpha1 → 0.14.0-beta2

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 (195) hide show
  1. package/README.md +5 -2
  2. package/addons.js +5 -2
  3. package/dist/JSXTransformer.js +634 -274
  4. package/dist/react-with-addons.js +5376 -4800
  5. package/dist/react-with-addons.min.js +6 -6
  6. package/dist/react.js +5175 -4626
  7. package/dist/react.min.js +6 -5
  8. package/lib/{AutoFocusMixin.js → AutoFocusUtils.js} +15 -5
  9. package/lib/BeforeInputEventPlugin.js +13 -13
  10. package/lib/CSSProperty.js +3 -0
  11. package/lib/CSSPropertyOperations.js +13 -13
  12. package/lib/CallbackQueue.js +4 -4
  13. package/lib/ChangeEventPlugin.js +16 -14
  14. package/lib/DOMChildrenOperations.js +10 -6
  15. package/lib/DOMProperty.js +82 -119
  16. package/lib/DOMPropertyOperations.js +78 -33
  17. package/lib/Danger.js +14 -16
  18. package/lib/DefaultEventPluginOrder.js +2 -2
  19. package/lib/EnterLeaveEventPlugin.js +8 -8
  20. package/lib/EventConstants.js +23 -1
  21. package/lib/EventPluginHub.js +13 -13
  22. package/lib/EventPluginRegistry.js +8 -8
  23. package/lib/EventPluginUtils.js +17 -17
  24. package/lib/EventPropagators.js +7 -7
  25. package/lib/FallbackCompositionState.js +3 -3
  26. package/lib/HTMLDOMPropertyConfig.js +14 -5
  27. package/lib/LinkedStateMixin.js +2 -2
  28. package/lib/LinkedValueUtils.js +50 -38
  29. package/lib/MetaMatchers.js +118 -0
  30. package/lib/OrderedMap.js +453 -0
  31. package/lib/PooledClass.js +14 -2
  32. package/lib/React.js +9 -111
  33. package/lib/ReactBrowserComponentMixin.js +4 -4
  34. package/lib/ReactBrowserEventEmitter.js +30 -7
  35. package/lib/ReactCSSTransitionGroup.js +16 -5
  36. package/lib/ReactCSSTransitionGroupChild.js +20 -11
  37. package/lib/ReactChildReconciler.js +25 -18
  38. package/lib/ReactChildren.js +24 -22
  39. package/lib/ReactClass.js +68 -86
  40. package/lib/ReactComponent.js +22 -17
  41. package/lib/ReactComponentBrowserEnvironment.js +2 -4
  42. package/lib/ReactComponentEnvironment.js +2 -2
  43. package/lib/ReactComponentWithPureRenderMixin.js +3 -3
  44. package/lib/ReactCompositeComponent.js +80 -111
  45. package/lib/ReactDOM.js +72 -158
  46. package/lib/ReactDOMButton.js +15 -26
  47. package/lib/ReactDOMComponent.js +384 -62
  48. package/lib/ReactDOMFactories.js +177 -0
  49. package/lib/ReactDOMIDOperations.js +23 -25
  50. package/lib/ReactDOMInput.js +83 -99
  51. package/lib/ReactDOMOption.js +38 -42
  52. package/lib/ReactDOMSelect.js +88 -98
  53. package/lib/ReactDOMSelection.js +3 -3
  54. package/lib/ReactDOMServer.js +24 -0
  55. package/lib/ReactDOMTextComponent.js +13 -13
  56. package/lib/ReactDOMTextarea.js +48 -61
  57. package/lib/ReactDefaultBatchingStrategy.js +4 -4
  58. package/lib/ReactDefaultInjection.js +34 -71
  59. package/lib/ReactDefaultPerf.js +7 -7
  60. package/lib/ReactDefaultPerfAnalysis.js +6 -9
  61. package/lib/ReactElement.js +35 -92
  62. package/lib/ReactElementValidator.js +53 -130
  63. package/lib/ReactEmptyComponent.js +4 -4
  64. package/lib/ReactErrorUtils.js +1 -1
  65. package/lib/ReactEventEmitterMixin.js +3 -4
  66. package/lib/ReactEventListener.js +57 -12
  67. package/lib/ReactFragment.js +22 -17
  68. package/lib/ReactInjection.js +11 -11
  69. package/lib/ReactInputSelection.js +8 -7
  70. package/lib/ReactInstanceHandles.js +12 -12
  71. package/lib/ReactIsomorphic.js +70 -0
  72. package/lib/ReactLink.js +1 -1
  73. package/lib/ReactMarkupChecksum.js +6 -2
  74. package/lib/ReactMount.js +90 -89
  75. package/lib/ReactMultiChild.js +83 -22
  76. package/lib/ReactMultiChildUpdateTypes.js +2 -1
  77. package/lib/ReactNativeComponent.js +3 -8
  78. package/lib/ReactNoopUpdateQueue.js +118 -0
  79. package/lib/ReactOwner.js +3 -3
  80. package/lib/ReactPerf.js +2 -2
  81. package/lib/ReactPropTransferer.js +3 -3
  82. package/lib/ReactPropTypeLocationNames.js +1 -1
  83. package/lib/ReactPropTypeLocations.js +1 -1
  84. package/lib/ReactPropTypes.js +72 -33
  85. package/lib/ReactReconcileTransaction.js +8 -8
  86. package/lib/ReactReconciler.js +18 -20
  87. package/lib/ReactRef.js +1 -1
  88. package/lib/ReactServerBatchingStrategy.js +23 -0
  89. package/lib/ReactServerRendering.js +22 -9
  90. package/lib/ReactServerRenderingTransaction.js +7 -7
  91. package/lib/ReactTestUtils.js +80 -58
  92. package/lib/ReactTransitionChildMapping.js +2 -2
  93. package/lib/ReactTransitionEvents.js +1 -1
  94. package/lib/ReactTransitionGroup.js +5 -6
  95. package/lib/ReactUpdateQueue.js +61 -36
  96. package/lib/ReactUpdates.js +14 -17
  97. package/lib/ReactWithAddons.js +14 -16
  98. package/lib/ResponderEventPlugin.js +514 -0
  99. package/lib/ResponderSyntheticEvent.js +40 -0
  100. package/lib/ResponderTouchHistoryStore.js +180 -0
  101. package/lib/SVGDOMPropertyConfig.js +1 -3
  102. package/lib/SelectEventPlugin.js +14 -15
  103. package/lib/SimpleEventPlugin.js +205 -29
  104. package/lib/SyntheticClipboardEvent.js +3 -3
  105. package/lib/SyntheticCompositionEvent.js +3 -3
  106. package/lib/SyntheticDragEvent.js +3 -3
  107. package/lib/SyntheticEvent.js +9 -8
  108. package/lib/SyntheticFocusEvent.js +3 -3
  109. package/lib/SyntheticInputEvent.js +3 -3
  110. package/lib/SyntheticKeyboardEvent.js +6 -6
  111. package/lib/SyntheticMouseEvent.js +5 -5
  112. package/lib/SyntheticTouchEvent.js +4 -4
  113. package/lib/SyntheticUIEvent.js +4 -4
  114. package/lib/SyntheticWheelEvent.js +3 -3
  115. package/lib/TapEventPlugin.js +119 -0
  116. package/lib/Transaction.js +16 -10
  117. package/lib/accumulate.js +44 -0
  118. package/lib/accumulateInto.js +2 -2
  119. package/lib/adler32.js +19 -9
  120. package/lib/cloneWithProps.js +12 -7
  121. package/lib/createHierarchyRenderer.js +85 -0
  122. package/lib/dangerousStyleValue.js +1 -1
  123. package/lib/deprecated.js +47 -0
  124. package/lib/findDOMNode.js +11 -12
  125. package/lib/flattenChildren.js +4 -4
  126. package/lib/forEachAccumulated.js +1 -1
  127. package/lib/getEventCharCode.js +1 -1
  128. package/lib/getEventKey.js +1 -1
  129. package/lib/getEventModifierState.js +0 -1
  130. package/lib/getTestDocument.js +28 -0
  131. package/lib/getTextContentAccessor.js +1 -1
  132. package/lib/instantiateReactComponent.js +24 -20
  133. package/lib/isEventSupported.js +1 -1
  134. package/lib/isTextInputElement.js +2 -1
  135. package/lib/joinClasses.js +1 -1
  136. package/lib/onlyChild.js +3 -3
  137. package/lib/quoteAttributeValueForBrowser.js +1 -1
  138. package/lib/reactComponentExpect.js +210 -0
  139. package/lib/renderSubtreeIntoContainer.js +1 -1
  140. package/lib/setInnerHTML.js +2 -2
  141. package/lib/setTextContent.js +3 -3
  142. package/lib/shallowCompare.js +1 -1
  143. package/lib/sliceChildren.js +51 -0
  144. package/lib/traverseAllChildren.js +24 -27
  145. package/lib/update.js +13 -13
  146. package/lib/validateDOMNesting.js +199 -100
  147. package/lib/webcomponents.js +6379 -0
  148. package/package.json +4 -6
  149. package/react.js +53 -1
  150. package/addons/CSSTransitionGroup.js +0 -1
  151. package/addons/LinkedStateMixin.js +0 -1
  152. package/addons/Perf.js +0 -1
  153. package/addons/PureRenderMixin.js +0 -1
  154. package/addons/TestUtils.js +0 -1
  155. package/addons/TransitionGroup.js +0 -1
  156. package/addons/batchedUpdates.js +0 -1
  157. package/addons/cloneWithProps.js +0 -1
  158. package/addons/createFragment.js +0 -1
  159. package/addons/renderSubtreeIntoContainer.js +0 -1
  160. package/addons/shallowCompare.js +0 -1
  161. package/addons/update.js +0 -1
  162. package/lib/CSSCore.js +0 -97
  163. package/lib/EventListener.js +0 -84
  164. package/lib/ExecutionEnvironment.js +0 -38
  165. package/lib/LocalEventTrapMixin.js +0 -46
  166. package/lib/ReactContext.js +0 -32
  167. package/lib/ReactDOMForm.js +0 -47
  168. package/lib/ReactDOMIframe.js +0 -43
  169. package/lib/ReactDOMImg.js +0 -44
  170. package/lib/ReactLifeCycle.js +0 -35
  171. package/lib/camelize.js +0 -32
  172. package/lib/camelizeStyleName.js +0 -40
  173. package/lib/containsNode.js +0 -55
  174. package/lib/createArrayFromMixed.js +0 -85
  175. package/lib/createFullPageComponent.js +0 -51
  176. package/lib/createNodesFromMarkup.js +0 -84
  177. package/lib/emptyFunction.js +0 -38
  178. package/lib/emptyObject.js +0 -20
  179. package/lib/focusNode.js +0 -26
  180. package/lib/getActiveElement.js +0 -29
  181. package/lib/getMarkupWrap.js +0 -115
  182. package/lib/getUnboundedScrollPosition.js +0 -38
  183. package/lib/hyphenate.js +0 -33
  184. package/lib/hyphenateStyleName.js +0 -39
  185. package/lib/invariant.js +0 -49
  186. package/lib/isNode.js +0 -23
  187. package/lib/isTextNode.js +0 -25
  188. package/lib/keyMirror.js +0 -48
  189. package/lib/keyOf.js +0 -35
  190. package/lib/mapObject.js +0 -51
  191. package/lib/performance.js +0 -23
  192. package/lib/performanceNow.js +0 -28
  193. package/lib/shallowEqual.js +0 -48
  194. package/lib/toArray.js +0 -57
  195. package/lib/warning.js +0 -61
package/README.md CHANGED
@@ -14,7 +14,10 @@ To use React in production mode, set the environment variable `NODE_ENV` to `pro
14
14
  ```js
15
15
  var React = require('react');
16
16
 
17
- // You can also access ReactWithAddons.
18
- var React = require('react/addons');
17
+ // Addons can be accessed individually from the "addons" directory.
18
+ var createFragment = require('react/addons/createFragment');
19
+ var immutabilityHelpers = require('react/addons/update');
20
+ var CSSTransitionGroup = require('react/addons/CSSTransitionGroup');
19
21
  ```
20
22
 
23
+ For a complete list of addons visit the [addons documentation page](https://facebook.github.io/react/docs/addons.html).
package/addons.js CHANGED
@@ -1,8 +1,11 @@
1
1
  var warning = require('./lib/warning');
2
2
  warning(
3
3
  false,
4
- 'require("react/addons") is deprecated. ' +
5
- 'Access using require("react/addons/{addon}") instead.'
4
+ // Require examples in this string must be split to prevent React's
5
+ // build tools from mistaking them for real requires.
6
+ // Otherwise the build tools will attempt to build a 'react-addons-{addon}' module.
7
+ 'require' + "('react/addons') is deprecated. " +
8
+ 'Access using require' + "('react-addons-{addon}') instead."
6
9
  );
7
10
 
8
11
  module.exports = require('./lib/ReactWithAddons');
@@ -1,5 +1,5 @@
1
1
  /**
2
- * JSXTransformer v0.14.0-alpha1
2
+ * JSXTransformer v0.14.0-beta2
3
3
  */
4
4
  (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.JSXTransformer = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
5
5
  /**
@@ -10,7 +10,6 @@
10
10
  * LICENSE file in the root directory of this source tree. An additional grant
11
11
  * of patent rights can be found in the PATENTS file in the same directory.
12
12
  */
13
- /* jshint browser: true */
14
13
  /* jslint evil: true */
15
14
  /*eslint-disable no-eval */
16
15
  /*eslint-disable block-scoped-var */
@@ -164,7 +163,8 @@ function run(code, url, options) {
164
163
  * Load script from the provided url and pass the content to the callback.
165
164
  *
166
165
  * @param {string} url The location of the script src
167
- * @param {function} callback Function to call with the content of url
166
+ * @param {function} successCallback Function to call with the content of url
167
+ * @param {function} errorCallback Function to call if error
168
168
  * @internal
169
169
  */
170
170
  function load(url, successCallback, errorCallback) {
@@ -235,11 +235,10 @@ function loadScripts(scripts) {
235
235
  dummyAnchor.href = script.src;
236
236
  sourceFilename = dummyAnchor.pathname.substr(1);
237
237
  }
238
- console.log(sourceFilename);
239
238
 
240
239
  var options = {
241
240
  sourceMapInline: true,
242
- sourceFilename: sourceFilename
241
+ sourceFilename: sourceFilename,
243
242
  };
244
243
  if (/;harmony=true(;|$)/.test(script.type)) {
245
244
  options.harmony = true;
@@ -259,7 +258,7 @@ function loadScripts(scripts) {
259
258
  content: null,
260
259
  loaded: false,
261
260
  url: script.src,
262
- options: options
261
+ options: options,
263
262
  };
264
263
 
265
264
  load(script.src, function(content) {
@@ -278,7 +277,7 @@ function loadScripts(scripts) {
278
277
  content: script.innerHTML,
279
278
  loaded: true,
280
279
  url: null,
281
- options: options
280
+ options: options,
282
281
  };
283
282
  }
284
283
  });
@@ -330,10 +329,10 @@ if (typeof window !== 'undefined' && window !== null) {
330
329
 
331
330
  module.exports = {
332
331
  transform: transformReact,
333
- exec: exec
332
+ exec: exec,
334
333
  };
335
334
 
336
- },{"jstransform/simple":23}],2:[function(_dereq_,module,exports){
335
+ },{"jstransform/simple":24}],2:[function(_dereq_,module,exports){
337
336
 
338
337
  },{}],3:[function(_dereq_,module,exports){
339
338
  /*!
@@ -352,7 +351,6 @@ exports.SlowBuffer = SlowBuffer
352
351
  exports.INSPECT_MAX_BYTES = 50
353
352
  Buffer.poolSize = 8192 // not used by this implementation
354
353
 
355
- var kMaxLength = 0x3fffffff
356
354
  var rootParent = {}
357
355
 
358
356
  /**
@@ -378,11 +376,14 @@ var rootParent = {}
378
376
  * get the Object implementation, which is slower but will work correctly.
379
377
  */
380
378
  Buffer.TYPED_ARRAY_SUPPORT = (function () {
379
+ function Foo () {}
381
380
  try {
382
381
  var buf = new ArrayBuffer(0)
383
382
  var arr = new Uint8Array(buf)
384
383
  arr.foo = function () { return 42 }
384
+ arr.constructor = Foo
385
385
  return arr.foo() === 42 && // typed array instances can be augmented
386
+ arr.constructor === Foo && // constructor can be set
386
387
  typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
387
388
  new Uint8Array(1).subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
388
389
  } catch (e) {
@@ -390,6 +391,12 @@ Buffer.TYPED_ARRAY_SUPPORT = (function () {
390
391
  }
391
392
  })()
392
393
 
394
+ function kMaxLength () {
395
+ return Buffer.TYPED_ARRAY_SUPPORT
396
+ ? 0x7fffffff
397
+ : 0x3fffffff
398
+ }
399
+
393
400
  /**
394
401
  * Class: Buffer
395
402
  * =============
@@ -540,9 +547,9 @@ function allocate (that, length) {
540
547
  function checked (length) {
541
548
  // Note: cannot use `length < kMaxLength` here because that fails when
542
549
  // length is NaN (which is otherwise coerced to zero.)
543
- if (length >= kMaxLength) {
550
+ if (length >= kMaxLength()) {
544
551
  throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
545
- 'size: 0x' + kMaxLength.toString(16) + ' bytes')
552
+ 'size: 0x' + kMaxLength().toString(16) + ' bytes')
546
553
  }
547
554
  return length | 0
548
555
  }
@@ -634,29 +641,38 @@ Buffer.concat = function concat (list, length) {
634
641
  }
635
642
 
636
643
  function byteLength (string, encoding) {
637
- if (typeof string !== 'string') string = String(string)
644
+ if (typeof string !== 'string') string = '' + string
638
645
 
639
- if (string.length === 0) return 0
646
+ var len = string.length
647
+ if (len === 0) return 0
640
648
 
641
- switch (encoding || 'utf8') {
642
- case 'ascii':
643
- case 'binary':
644
- case 'raw':
645
- return string.length
646
- case 'ucs2':
647
- case 'ucs-2':
648
- case 'utf16le':
649
- case 'utf-16le':
650
- return string.length * 2
651
- case 'hex':
652
- return string.length >>> 1
653
- case 'utf8':
654
- case 'utf-8':
655
- return utf8ToBytes(string).length
656
- case 'base64':
657
- return base64ToBytes(string).length
658
- default:
659
- return string.length
649
+ // Use a for loop to avoid recursion
650
+ var loweredCase = false
651
+ for (;;) {
652
+ switch (encoding) {
653
+ case 'ascii':
654
+ case 'binary':
655
+ // Deprecated
656
+ case 'raw':
657
+ case 'raws':
658
+ return len
659
+ case 'utf8':
660
+ case 'utf-8':
661
+ return utf8ToBytes(string).length
662
+ case 'ucs2':
663
+ case 'ucs-2':
664
+ case 'utf16le':
665
+ case 'utf-16le':
666
+ return len * 2
667
+ case 'hex':
668
+ return len >>> 1
669
+ case 'base64':
670
+ return base64ToBytes(string).length
671
+ default:
672
+ if (loweredCase) return utf8ToBytes(string).length // assume utf8
673
+ encoding = ('' + encoding).toLowerCase()
674
+ loweredCase = true
675
+ }
660
676
  }
661
677
  }
662
678
  Buffer.byteLength = byteLength
@@ -665,8 +681,7 @@ Buffer.byteLength = byteLength
665
681
  Buffer.prototype.length = undefined
666
682
  Buffer.prototype.parent = undefined
667
683
 
668
- // toString(encoding, start=0, end=buffer.length)
669
- Buffer.prototype.toString = function toString (encoding, start, end) {
684
+ function slowToString (encoding, start, end) {
670
685
  var loweredCase = false
671
686
 
672
687
  start = start | 0
@@ -709,6 +724,13 @@ Buffer.prototype.toString = function toString (encoding, start, end) {
709
724
  }
710
725
  }
711
726
 
727
+ Buffer.prototype.toString = function toString () {
728
+ var length = this.length | 0
729
+ if (length === 0) return ''
730
+ if (arguments.length === 0) return utf8Slice(this, 0, length)
731
+ return slowToString.apply(this, arguments)
732
+ }
733
+
712
734
  Buffer.prototype.equals = function equals (b) {
713
735
  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
714
736
  if (this === b) return true
@@ -1879,14 +1901,14 @@ var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
1879
1901
 
1880
1902
  },{}],5:[function(_dereq_,module,exports){
1881
1903
  exports.read = function (buffer, offset, isLE, mLen, nBytes) {
1882
- var e, m,
1883
- eLen = nBytes * 8 - mLen - 1,
1884
- eMax = (1 << eLen) - 1,
1885
- eBias = eMax >> 1,
1886
- nBits = -7,
1887
- i = isLE ? (nBytes - 1) : 0,
1888
- d = isLE ? -1 : 1,
1889
- s = buffer[offset + i]
1904
+ var e, m
1905
+ var eLen = nBytes * 8 - mLen - 1
1906
+ var eMax = (1 << eLen) - 1
1907
+ var eBias = eMax >> 1
1908
+ var nBits = -7
1909
+ var i = isLE ? (nBytes - 1) : 0
1910
+ var d = isLE ? -1 : 1
1911
+ var s = buffer[offset + i]
1890
1912
 
1891
1913
  i += d
1892
1914
 
@@ -1912,14 +1934,14 @@ exports.read = function (buffer, offset, isLE, mLen, nBytes) {
1912
1934
  }
1913
1935
 
1914
1936
  exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
1915
- var e, m, c,
1916
- eLen = nBytes * 8 - mLen - 1,
1917
- eMax = (1 << eLen) - 1,
1918
- eBias = eMax >> 1,
1919
- rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),
1920
- i = isLE ? 0 : (nBytes - 1),
1921
- d = isLE ? 1 : -1,
1922
- s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
1937
+ var e, m, c
1938
+ var eLen = nBytes * 8 - mLen - 1
1939
+ var eMax = (1 << eLen) - 1
1940
+ var eBias = eMax >> 1
1941
+ var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
1942
+ var i = isLE ? 0 : (nBytes - 1)
1943
+ var d = isLE ? 1 : -1
1944
+ var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
1923
1945
 
1924
1946
  value = Math.abs(value)
1925
1947
 
@@ -2287,6 +2309,46 @@ process.chdir = function (dir) {
2287
2309
  process.umask = function() { return 0; };
2288
2310
 
2289
2311
  },{}],9:[function(_dereq_,module,exports){
2312
+ module.exports = (function (Base62) {
2313
+ var DEFAULT_CHARACTER_SET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2314
+
2315
+ Base62.encode = function(integer){
2316
+ if (integer === 0) {return '0';}
2317
+ var s = '';
2318
+ while (integer > 0) {
2319
+ s = Base62.characterSet[integer % 62] + s;
2320
+ integer = Math.floor(integer/62);
2321
+ }
2322
+ return s;
2323
+ };
2324
+
2325
+ Base62.decode = function(base62String){
2326
+ var val = 0, base62Chars = base62String.split("").reverse();
2327
+ base62Chars.forEach(function(character, index){
2328
+ val += Base62.characterSet.indexOf(character) * Math.pow(62, index);
2329
+ });
2330
+ return val;
2331
+ };
2332
+
2333
+ Base62.setCharacterSet = function(chars) {
2334
+ var arrayOfChars = chars.split(""), uniqueCharacters = [];
2335
+
2336
+ if(arrayOfChars.length != 62) throw Error("You must supply 62 characters");
2337
+
2338
+ arrayOfChars.forEach(function(char){
2339
+ if(!~uniqueCharacters.indexOf(char)) uniqueCharacters.push(char);
2340
+ });
2341
+
2342
+ if(uniqueCharacters.length != 62) throw Error("You must use unique characters.");
2343
+
2344
+ Base62.characterSet = arrayOfChars;
2345
+ };
2346
+
2347
+ Base62.setCharacterSet(DEFAULT_CHARACTER_SET);
2348
+ return Base62;
2349
+ }({}));
2350
+
2351
+ },{}],10:[function(_dereq_,module,exports){
2290
2352
  /*
2291
2353
  Copyright (C) 2013 Ariya Hidayat <ariya.hidayat@gmail.com>
2292
2354
  Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com>
@@ -10052,46 +10114,6 @@ process.umask = function() { return 0; };
10052
10114
  }));
10053
10115
  /* vim: set sw=4 ts=4 et tw=80 : */
10054
10116
 
10055
- },{}],10:[function(_dereq_,module,exports){
10056
- module.exports = (function (Base62) {
10057
- var DEFAULT_CHARACTER_SET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
10058
-
10059
- Base62.encode = function(integer){
10060
- if (integer === 0) {return '0';}
10061
- var s = '';
10062
- while (integer > 0) {
10063
- s = Base62.characterSet[integer % 62] + s;
10064
- integer = Math.floor(integer/62);
10065
- }
10066
- return s;
10067
- };
10068
-
10069
- Base62.decode = function(base62String){
10070
- var val = 0, base62Chars = base62String.split("").reverse();
10071
- base62Chars.forEach(function(character, index){
10072
- val += Base62.characterSet.indexOf(character) * Math.pow(62, index);
10073
- });
10074
- return val;
10075
- };
10076
-
10077
- Base62.setCharacterSet = function(chars) {
10078
- var arrayOfChars = chars.split(""), uniqueCharacters = [];
10079
-
10080
- if(arrayOfChars.length != 62) throw Error("You must supply 62 characters");
10081
-
10082
- arrayOfChars.forEach(function(char){
10083
- if(!~uniqueCharacters.indexOf(char)) uniqueCharacters.push(char);
10084
- });
10085
-
10086
- if(uniqueCharacters.length != 62) throw Error("You must use unique characters.");
10087
-
10088
- Base62.characterSet = arrayOfChars;
10089
- };
10090
-
10091
- Base62.setCharacterSet(DEFAULT_CHARACTER_SET);
10092
- return Base62;
10093
- }({}));
10094
-
10095
10117
  },{}],11:[function(_dereq_,module,exports){
10096
10118
  'use strict';
10097
10119
 
@@ -10130,7 +10152,7 @@ exports.SourceMapGenerator = _dereq_('./source-map/source-map-generator').Source
10130
10152
  exports.SourceMapConsumer = _dereq_('./source-map/source-map-consumer').SourceMapConsumer;
10131
10153
  exports.SourceNode = _dereq_('./source-map/source-node').SourceNode;
10132
10154
 
10133
- },{"./source-map/source-map-consumer":18,"./source-map/source-map-generator":19,"./source-map/source-node":20}],13:[function(_dereq_,module,exports){
10155
+ },{"./source-map/source-map-consumer":19,"./source-map/source-map-generator":20,"./source-map/source-node":21}],13:[function(_dereq_,module,exports){
10134
10156
  /* -*- Mode: js; js-indent-level: 2; -*- */
10135
10157
  /*
10136
10158
  * Copyright 2011 Mozilla Foundation and contributors
@@ -10166,6 +10188,16 @@ define(function (_dereq_, exports, module) {
10166
10188
  return set;
10167
10189
  };
10168
10190
 
10191
+ /**
10192
+ * Return how many unique items are in this ArraySet. If duplicates have been
10193
+ * added, than those do not count towards the size.
10194
+ *
10195
+ * @returns Number
10196
+ */
10197
+ ArraySet.prototype.size = function ArraySet_size() {
10198
+ return Object.getOwnPropertyNames(this._set).length;
10199
+ };
10200
+
10169
10201
  /**
10170
10202
  * Add the given string to this set.
10171
10203
  *
@@ -10229,7 +10261,7 @@ define(function (_dereq_, exports, module) {
10229
10261
 
10230
10262
  });
10231
10263
 
10232
- },{"./util":21,"amdefine":22}],14:[function(_dereq_,module,exports){
10264
+ },{"./util":22,"amdefine":23}],14:[function(_dereq_,module,exports){
10233
10265
  /* -*- Mode: js; js-indent-level: 2; -*- */
10234
10266
  /*
10235
10267
  * Copyright 2011 Mozilla Foundation and contributors
@@ -10359,7 +10391,12 @@ define(function (_dereq_, exports, module) {
10359
10391
  if (aIndex >= strLen) {
10360
10392
  throw new Error("Expected more digits in base 64 VLQ value.");
10361
10393
  }
10362
- digit = base64.decode(aStr.charAt(aIndex++));
10394
+
10395
+ digit = base64.decode(aStr.charCodeAt(aIndex++));
10396
+ if (digit === -1) {
10397
+ throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
10398
+ }
10399
+
10363
10400
  continuation = !!(digit & VLQ_CONTINUATION_BIT);
10364
10401
  digit &= VLQ_BASE_MASK;
10365
10402
  result = result + (digit << shift);
@@ -10372,7 +10409,7 @@ define(function (_dereq_, exports, module) {
10372
10409
 
10373
10410
  });
10374
10411
 
10375
- },{"./base64":15,"amdefine":22}],15:[function(_dereq_,module,exports){
10412
+ },{"./base64":15,"amdefine":23}],15:[function(_dereq_,module,exports){
10376
10413
  /* -*- Mode: js; js-indent-level: 2; -*- */
10377
10414
  /*
10378
10415
  * Copyright 2011 Mozilla Foundation and contributors
@@ -10384,39 +10421,70 @@ if (typeof define !== 'function') {
10384
10421
  }
10385
10422
  define(function (_dereq_, exports, module) {
10386
10423
 
10387
- var charToIntMap = {};
10388
- var intToCharMap = {};
10389
-
10390
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
10391
- .split('')
10392
- .forEach(function (ch, index) {
10393
- charToIntMap[ch] = index;
10394
- intToCharMap[index] = ch;
10395
- });
10424
+ var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
10396
10425
 
10397
10426
  /**
10398
10427
  * Encode an integer in the range of 0 to 63 to a single base 64 digit.
10399
10428
  */
10400
- exports.encode = function base64_encode(aNumber) {
10401
- if (aNumber in intToCharMap) {
10402
- return intToCharMap[aNumber];
10429
+ exports.encode = function (number) {
10430
+ if (0 <= number && number < intToCharMap.length) {
10431
+ return intToCharMap[number];
10403
10432
  }
10404
10433
  throw new TypeError("Must be between 0 and 63: " + aNumber);
10405
10434
  };
10406
10435
 
10407
10436
  /**
10408
- * Decode a single base 64 digit to an integer.
10437
+ * Decode a single base 64 character code digit to an integer. Returns -1 on
10438
+ * failure.
10409
10439
  */
10410
- exports.decode = function base64_decode(aChar) {
10411
- if (aChar in charToIntMap) {
10412
- return charToIntMap[aChar];
10440
+ exports.decode = function (charCode) {
10441
+ var bigA = 65; // 'A'
10442
+ var bigZ = 90; // 'Z'
10443
+
10444
+ var littleA = 97; // 'a'
10445
+ var littleZ = 122; // 'z'
10446
+
10447
+ var zero = 48; // '0'
10448
+ var nine = 57; // '9'
10449
+
10450
+ var plus = 43; // '+'
10451
+ var slash = 47; // '/'
10452
+
10453
+ var littleOffset = 26;
10454
+ var numberOffset = 52;
10455
+
10456
+ // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
10457
+ if (bigA <= charCode && charCode <= bigZ) {
10458
+ return (charCode - bigA);
10459
+ }
10460
+
10461
+ // 26 - 51: abcdefghijklmnopqrstuvwxyz
10462
+ if (littleA <= charCode && charCode <= littleZ) {
10463
+ return (charCode - littleA + littleOffset);
10413
10464
  }
10414
- throw new TypeError("Not a valid base 64 digit: " + aChar);
10465
+
10466
+ // 52 - 61: 0123456789
10467
+ if (zero <= charCode && charCode <= nine) {
10468
+ return (charCode - zero + numberOffset);
10469
+ }
10470
+
10471
+ // 62: +
10472
+ if (charCode == plus) {
10473
+ return 62;
10474
+ }
10475
+
10476
+ // 63: /
10477
+ if (charCode == slash) {
10478
+ return 63;
10479
+ }
10480
+
10481
+ // Invalid base64 digit.
10482
+ return -1;
10415
10483
  };
10416
10484
 
10417
10485
  });
10418
10486
 
10419
- },{"amdefine":22}],16:[function(_dereq_,module,exports){
10487
+ },{"amdefine":23}],16:[function(_dereq_,module,exports){
10420
10488
  /* -*- Mode: js; js-indent-level: 2; -*- */
10421
10489
  /*
10422
10490
  * Copyright 2011 Mozilla Foundation and contributors
@@ -10535,7 +10603,7 @@ define(function (_dereq_, exports, module) {
10535
10603
 
10536
10604
  });
10537
10605
 
10538
- },{"amdefine":22}],17:[function(_dereq_,module,exports){
10606
+ },{"amdefine":23}],17:[function(_dereq_,module,exports){
10539
10607
  /* -*- Mode: js; js-indent-level: 2; -*- */
10540
10608
  /*
10541
10609
  * Copyright 2014 Mozilla Foundation and contributors
@@ -10560,7 +10628,7 @@ define(function (_dereq_, exports, module) {
10560
10628
  var columnA = mappingA.generatedColumn;
10561
10629
  var columnB = mappingB.generatedColumn;
10562
10630
  return lineB > lineA || lineB == lineA && columnB >= columnA ||
10563
- util.compareByGeneratedPositions(mappingA, mappingB) <= 0;
10631
+ util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
10564
10632
  }
10565
10633
 
10566
10634
  /**
@@ -10613,7 +10681,7 @@ define(function (_dereq_, exports, module) {
10613
10681
  */
10614
10682
  MappingList.prototype.toArray = function MappingList_toArray() {
10615
10683
  if (!this._sorted) {
10616
- this._array.sort(util.compareByGeneratedPositions);
10684
+ this._array.sort(util.compareByGeneratedPositionsInflated);
10617
10685
  this._sorted = true;
10618
10686
  }
10619
10687
  return this._array;
@@ -10623,7 +10691,129 @@ define(function (_dereq_, exports, module) {
10623
10691
 
10624
10692
  });
10625
10693
 
10626
- },{"./util":21,"amdefine":22}],18:[function(_dereq_,module,exports){
10694
+ },{"./util":22,"amdefine":23}],18:[function(_dereq_,module,exports){
10695
+ /* -*- Mode: js; js-indent-level: 2; -*- */
10696
+ /*
10697
+ * Copyright 2011 Mozilla Foundation and contributors
10698
+ * Licensed under the New BSD license. See LICENSE or:
10699
+ * http://opensource.org/licenses/BSD-3-Clause
10700
+ */
10701
+ if (typeof define !== 'function') {
10702
+ var define = _dereq_('amdefine')(module, _dereq_);
10703
+ }
10704
+ define(function (_dereq_, exports, module) {
10705
+
10706
+ // It turns out that some (most?) JavaScript engines don't self-host
10707
+ // `Array.prototype.sort`. This makes sense because C++ will likely remain
10708
+ // faster than JS when doing raw CPU-intensive sorting. However, when using a
10709
+ // custom comparator function, calling back and forth between the VM's C++ and
10710
+ // JIT'd JS is rather slow *and* loses JIT type information, resulting in
10711
+ // worse generated code for the comparator function than would be optimal. In
10712
+ // fact, when sorting with a comparator, these costs outweigh the benefits of
10713
+ // sorting in C++. By using our own JS-implemented Quick Sort (below), we get
10714
+ // a ~3500ms mean speed-up in `bench/bench.html`.
10715
+
10716
+ /**
10717
+ * Swap the elements indexed by `x` and `y` in the array `ary`.
10718
+ *
10719
+ * @param {Array} ary
10720
+ * The array.
10721
+ * @param {Number} x
10722
+ * The index of the first item.
10723
+ * @param {Number} y
10724
+ * The index of the second item.
10725
+ */
10726
+ function swap(ary, x, y) {
10727
+ var temp = ary[x];
10728
+ ary[x] = ary[y];
10729
+ ary[y] = temp;
10730
+ }
10731
+
10732
+ /**
10733
+ * Returns a random integer within the range `low .. high` inclusive.
10734
+ *
10735
+ * @param {Number} low
10736
+ * The lower bound on the range.
10737
+ * @param {Number} high
10738
+ * The upper bound on the range.
10739
+ */
10740
+ function randomIntInRange(low, high) {
10741
+ return Math.round(low + (Math.random() * (high - low)));
10742
+ }
10743
+
10744
+ /**
10745
+ * The Quick Sort algorithm.
10746
+ *
10747
+ * @param {Array} ary
10748
+ * An array to sort.
10749
+ * @param {function} comparator
10750
+ * Function to use to compare two items.
10751
+ * @param {Number} p
10752
+ * Start index of the array
10753
+ * @param {Number} r
10754
+ * End index of the array
10755
+ */
10756
+ function doQuickSort(ary, comparator, p, r) {
10757
+ // If our lower bound is less than our upper bound, we (1) partition the
10758
+ // array into two pieces and (2) recurse on each half. If it is not, this is
10759
+ // the empty array and our base case.
10760
+
10761
+ if (p < r) {
10762
+ // (1) Partitioning.
10763
+ //
10764
+ // The partitioning chooses a pivot between `p` and `r` and moves all
10765
+ // elements that are less than or equal to the pivot to the before it, and
10766
+ // all the elements that are greater than it after it. The effect is that
10767
+ // once partition is done, the pivot is in the exact place it will be when
10768
+ // the array is put in sorted order, and it will not need to be moved
10769
+ // again. This runs in O(n) time.
10770
+
10771
+ // Always choose a random pivot so that an input array which is reverse
10772
+ // sorted does not cause O(n^2) running time.
10773
+ var pivotIndex = randomIntInRange(p, r);
10774
+ var i = p - 1;
10775
+
10776
+ swap(ary, pivotIndex, r);
10777
+ var pivot = ary[r];
10778
+
10779
+ // Immediately after `j` is incremented in this loop, the following hold
10780
+ // true:
10781
+ //
10782
+ // * Every element in `ary[p .. i]` is less than or equal to the pivot.
10783
+ //
10784
+ // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
10785
+ for (var j = p; j < r; j++) {
10786
+ if (comparator(ary[j], pivot) <= 0) {
10787
+ i += 1;
10788
+ swap(ary, i, j);
10789
+ }
10790
+ }
10791
+
10792
+ swap(ary, i + 1, j);
10793
+ var q = i + 1;
10794
+
10795
+ // (2) Recurse on each half.
10796
+
10797
+ doQuickSort(ary, comparator, p, q - 1);
10798
+ doQuickSort(ary, comparator, q + 1, r);
10799
+ }
10800
+ }
10801
+
10802
+ /**
10803
+ * Sort the given array in-place with the given comparator function.
10804
+ *
10805
+ * @param {Array} ary
10806
+ * An array to sort.
10807
+ * @param {function} comparator
10808
+ * Function to use to compare two items.
10809
+ */
10810
+ exports.quickSort = function (ary, comparator) {
10811
+ doQuickSort(ary, comparator, 0, ary.length - 1);
10812
+ };
10813
+
10814
+ });
10815
+
10816
+ },{"amdefine":23}],19:[function(_dereq_,module,exports){
10627
10817
  /* -*- Mode: js; js-indent-level: 2; -*- */
10628
10818
  /*
10629
10819
  * Copyright 2011 Mozilla Foundation and contributors
@@ -10639,6 +10829,7 @@ define(function (_dereq_, exports, module) {
10639
10829
  var binarySearch = _dereq_('./binary-search');
10640
10830
  var ArraySet = _dereq_('./array-set').ArraySet;
10641
10831
  var base64VLQ = _dereq_('./base64-vlq');
10832
+ var quickSort = _dereq_('./quick-sort').quickSort;
10642
10833
 
10643
10834
  function SourceMapConsumer(aSourceMap) {
10644
10835
  var sourceMap = aSourceMap;
@@ -10694,8 +10885,6 @@ define(function (_dereq_, exports, module) {
10694
10885
  Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
10695
10886
  get: function () {
10696
10887
  if (!this.__generatedMappings) {
10697
- this.__generatedMappings = [];
10698
- this.__originalMappings = [];
10699
10888
  this._parseMappings(this._mappings, this.sourceRoot);
10700
10889
  }
10701
10890
 
@@ -10707,8 +10896,6 @@ define(function (_dereq_, exports, module) {
10707
10896
  Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
10708
10897
  get: function () {
10709
10898
  if (!this.__originalMappings) {
10710
- this.__generatedMappings = [];
10711
- this.__originalMappings = [];
10712
10899
  this._parseMappings(this._mappings, this.sourceRoot);
10713
10900
  }
10714
10901
 
@@ -10716,8 +10903,8 @@ define(function (_dereq_, exports, module) {
10716
10903
  }
10717
10904
  });
10718
10905
 
10719
- SourceMapConsumer.prototype._nextCharIsMappingSeparator =
10720
- function SourceMapConsumer_nextCharIsMappingSeparator(aStr, index) {
10906
+ SourceMapConsumer.prototype._charIsMappingSeparator =
10907
+ function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
10721
10908
  var c = aStr.charAt(index);
10722
10909
  return c === ";" || c === ",";
10723
10910
  };
@@ -10773,7 +10960,7 @@ define(function (_dereq_, exports, module) {
10773
10960
 
10774
10961
  var sourceRoot = this.sourceRoot;
10775
10962
  mappings.map(function (mapping) {
10776
- var source = mapping.source;
10963
+ var source = mapping.source === null ? null : this._sources.at(mapping.source);
10777
10964
  if (source != null && sourceRoot != null) {
10778
10965
  source = util.join(sourceRoot, source);
10779
10966
  }
@@ -10783,16 +10970,18 @@ define(function (_dereq_, exports, module) {
10783
10970
  generatedColumn: mapping.generatedColumn,
10784
10971
  originalLine: mapping.originalLine,
10785
10972
  originalColumn: mapping.originalColumn,
10786
- name: mapping.name
10973
+ name: mapping.name === null ? null : this._names.at(mapping.name)
10787
10974
  };
10788
- }).forEach(aCallback, context);
10975
+ }, this).forEach(aCallback, context);
10789
10976
  };
10790
10977
 
10791
10978
  /**
10792
10979
  * Returns all generated line and column information for the original source,
10793
10980
  * line, and column provided. If no column is provided, returns all mappings
10794
- * corresponding to a single line. Otherwise, returns all mappings
10795
- * corresponding to a single line and column.
10981
+ * corresponding to a either the line we are searching for or the next
10982
+ * closest line that has any mappings. Otherwise, returns all mappings
10983
+ * corresponding to the given line and either the column we are searching for
10984
+ * or the next closest column that has any offsets.
10796
10985
  *
10797
10986
  * The only argument is an object with the following properties:
10798
10987
  *
@@ -10807,19 +10996,25 @@ define(function (_dereq_, exports, module) {
10807
10996
  */
10808
10997
  SourceMapConsumer.prototype.allGeneratedPositionsFor =
10809
10998
  function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
10999
+ var line = util.getArg(aArgs, 'line');
11000
+
10810
11001
  // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping
10811
11002
  // returns the index of the closest mapping less than the needle. By
10812
11003
  // setting needle.originalColumn to 0, we thus find the last mapping for
10813
11004
  // the given line, provided such a mapping exists.
10814
11005
  var needle = {
10815
11006
  source: util.getArg(aArgs, 'source'),
10816
- originalLine: util.getArg(aArgs, 'line'),
11007
+ originalLine: line,
10817
11008
  originalColumn: util.getArg(aArgs, 'column', 0)
10818
11009
  };
10819
11010
 
10820
11011
  if (this.sourceRoot != null) {
10821
11012
  needle.source = util.relative(this.sourceRoot, needle.source);
10822
11013
  }
11014
+ if (!this._sources.has(needle.source)) {
11015
+ return [];
11016
+ }
11017
+ needle.source = this._sources.indexOf(needle.source);
10823
11018
 
10824
11019
  var mappings = [];
10825
11020
 
@@ -10831,22 +11026,41 @@ define(function (_dereq_, exports, module) {
10831
11026
  binarySearch.LEAST_UPPER_BOUND);
10832
11027
  if (index >= 0) {
10833
11028
  var mapping = this._originalMappings[index];
10834
- var originalLine = mapping.originalLine;
10835
- var originalColumn = mapping.originalColumn;
10836
-
10837
- // Iterate until either we run out of mappings, or we run into
10838
- // a mapping for a different line. Since mappings are sorted, this is
10839
- // guaranteed to find all mappings for the line we are searching for.
10840
- while (mapping && mapping.originalLine === originalLine &&
10841
- (aArgs.column === undefined ||
10842
- mapping.originalColumn === originalColumn)) {
10843
- mappings.push({
10844
- line: util.getArg(mapping, 'generatedLine', null),
10845
- column: util.getArg(mapping, 'generatedColumn', null),
10846
- lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
10847
- });
10848
11029
 
10849
- mapping = this._originalMappings[++index];
11030
+ if (aArgs.column === undefined) {
11031
+ var originalLine = mapping.originalLine;
11032
+
11033
+ // Iterate until either we run out of mappings, or we run into
11034
+ // a mapping for a different line than the one we found. Since
11035
+ // mappings are sorted, this is guaranteed to find all mappings for
11036
+ // the line we found.
11037
+ while (mapping && mapping.originalLine === originalLine) {
11038
+ mappings.push({
11039
+ line: util.getArg(mapping, 'generatedLine', null),
11040
+ column: util.getArg(mapping, 'generatedColumn', null),
11041
+ lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
11042
+ });
11043
+
11044
+ mapping = this._originalMappings[++index];
11045
+ }
11046
+ } else {
11047
+ var originalColumn = mapping.originalColumn;
11048
+
11049
+ // Iterate until either we run out of mappings, or we run into
11050
+ // a mapping for a different line than the one we were searching for.
11051
+ // Since mappings are sorted, this is guaranteed to find all mappings for
11052
+ // the line we are searching for.
11053
+ while (mapping &&
11054
+ mapping.originalLine === line &&
11055
+ mapping.originalColumn == originalColumn) {
11056
+ mappings.push({
11057
+ line: util.getArg(mapping, 'generatedLine', null),
11058
+ column: util.getArg(mapping, 'generatedColumn', null),
11059
+ lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
11060
+ });
11061
+
11062
+ mapping = this._originalMappings[++index];
11063
+ }
10850
11064
  }
10851
11065
  }
10852
11066
 
@@ -10939,16 +11153,44 @@ define(function (_dereq_, exports, module) {
10939
11153
  function SourceMapConsumer_fromSourceMap(aSourceMap) {
10940
11154
  var smc = Object.create(BasicSourceMapConsumer.prototype);
10941
11155
 
10942
- smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
10943
- smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
11156
+ var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
11157
+ var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
10944
11158
  smc.sourceRoot = aSourceMap._sourceRoot;
10945
11159
  smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),
10946
11160
  smc.sourceRoot);
10947
11161
  smc.file = aSourceMap._file;
10948
11162
 
10949
- smc.__generatedMappings = aSourceMap._mappings.toArray().slice();
10950
- smc.__originalMappings = aSourceMap._mappings.toArray().slice()
10951
- .sort(util.compareByOriginalPositions);
11163
+ // Because we are modifying the entries (by converting string sources and
11164
+ // names to indices into the sources and names ArraySets), we have to make
11165
+ // a copy of the entry or else bad things happen. Shared mutable state
11166
+ // strikes again! See github issue #191.
11167
+
11168
+ var generatedMappings = aSourceMap._mappings.toArray().slice();
11169
+ var destGeneratedMappings = smc.__generatedMappings = [];
11170
+ var destOriginalMappings = smc.__originalMappings = [];
11171
+
11172
+ for (var i = 0, length = generatedMappings.length; i < length; i++) {
11173
+ var srcMapping = generatedMappings[i];
11174
+ var destMapping = new Mapping;
11175
+ destMapping.generatedLine = srcMapping.generatedLine;
11176
+ destMapping.generatedColumn = srcMapping.generatedColumn;
11177
+
11178
+ if (srcMapping.source) {
11179
+ destMapping.source = sources.indexOf(srcMapping.source);
11180
+ destMapping.originalLine = srcMapping.originalLine;
11181
+ destMapping.originalColumn = srcMapping.originalColumn;
11182
+
11183
+ if (srcMapping.name) {
11184
+ destMapping.name = names.indexOf(srcMapping.name);
11185
+ }
11186
+
11187
+ destOriginalMappings.push(destMapping);
11188
+ }
11189
+
11190
+ destGeneratedMappings.push(destMapping);
11191
+ }
11192
+
11193
+ quickSort(smc.__originalMappings, util.compareByOriginalPositions);
10952
11194
 
10953
11195
  return smc;
10954
11196
  };
@@ -10969,6 +11211,18 @@ define(function (_dereq_, exports, module) {
10969
11211
  }
10970
11212
  });
10971
11213
 
11214
+ /**
11215
+ * Provide the JIT with a nice shape / hidden class.
11216
+ */
11217
+ function Mapping() {
11218
+ this.generatedLine = 0;
11219
+ this.generatedColumn = 0;
11220
+ this.source = null;
11221
+ this.originalLine = null;
11222
+ this.originalColumn = null;
11223
+ this.name = null;
11224
+ }
11225
+
10972
11226
  /**
10973
11227
  * Parse the mappings in a string in to a data structure which we can easily
10974
11228
  * query (the ordered arrays in the `this.__generatedMappings` and
@@ -10984,21 +11238,23 @@ define(function (_dereq_, exports, module) {
10984
11238
  var previousName = 0;
10985
11239
  var length = aStr.length;
10986
11240
  var index = 0;
10987
- var cachedValues = {};
11241
+ var cachedSegments = {};
10988
11242
  var temp = {};
10989
- var mapping, str, values, end, value;
11243
+ var originalMappings = [];
11244
+ var generatedMappings = [];
11245
+ var mapping, str, segment, end, value;
10990
11246
 
10991
11247
  while (index < length) {
10992
11248
  if (aStr.charAt(index) === ';') {
10993
11249
  generatedLine++;
10994
- ++index;
11250
+ index++;
10995
11251
  previousGeneratedColumn = 0;
10996
11252
  }
10997
11253
  else if (aStr.charAt(index) === ',') {
10998
- ++index;
11254
+ index++;
10999
11255
  }
11000
11256
  else {
11001
- mapping = {};
11257
+ mapping = new Mapping();
11002
11258
  mapping.generatedLine = generatedLine;
11003
11259
 
11004
11260
  // Because each offset is encoded relative to the previous one,
@@ -11006,68 +11262,74 @@ define(function (_dereq_, exports, module) {
11006
11262
  // fact by caching the parsed variable length fields of each segment,
11007
11263
  // allowing us to avoid a second parse if we encounter the same
11008
11264
  // segment again.
11009
- for (end = index; end < length; ++end) {
11010
- if (this._nextCharIsMappingSeparator(aStr, end)) {
11265
+ for (end = index; end < length; end++) {
11266
+ if (this._charIsMappingSeparator(aStr, end)) {
11011
11267
  break;
11012
11268
  }
11013
11269
  }
11014
11270
  str = aStr.slice(index, end);
11015
11271
 
11016
- values = cachedValues[str];
11017
- if (values) {
11272
+ segment = cachedSegments[str];
11273
+ if (segment) {
11018
11274
  index += str.length;
11019
11275
  } else {
11020
- values = [];
11276
+ segment = [];
11021
11277
  while (index < end) {
11022
11278
  base64VLQ.decode(aStr, index, temp);
11023
11279
  value = temp.value;
11024
11280
  index = temp.rest;
11025
- values.push(value);
11281
+ segment.push(value);
11026
11282
  }
11027
- cachedValues[str] = values;
11283
+
11284
+ if (segment.length === 2) {
11285
+ throw new Error('Found a source, but no line and column');
11286
+ }
11287
+
11288
+ if (segment.length === 3) {
11289
+ throw new Error('Found a source and line, but no column');
11290
+ }
11291
+
11292
+ cachedSegments[str] = segment;
11028
11293
  }
11029
11294
 
11030
11295
  // Generated column.
11031
- mapping.generatedColumn = previousGeneratedColumn + values[0];
11296
+ mapping.generatedColumn = previousGeneratedColumn + segment[0];
11032
11297
  previousGeneratedColumn = mapping.generatedColumn;
11033
11298
 
11034
- if (values.length > 1) {
11299
+ if (segment.length > 1) {
11035
11300
  // Original source.
11036
- mapping.source = this._sources.at(previousSource + values[1]);
11037
- previousSource += values[1];
11038
- if (values.length === 2) {
11039
- throw new Error('Found a source, but no line and column');
11040
- }
11301
+ mapping.source = previousSource + segment[1];
11302
+ previousSource += segment[1];
11041
11303
 
11042
11304
  // Original line.
11043
- mapping.originalLine = previousOriginalLine + values[2];
11305
+ mapping.originalLine = previousOriginalLine + segment[2];
11044
11306
  previousOriginalLine = mapping.originalLine;
11045
11307
  // Lines are stored 0-based
11046
11308
  mapping.originalLine += 1;
11047
- if (values.length === 3) {
11048
- throw new Error('Found a source and line, but no column');
11049
- }
11050
11309
 
11051
11310
  // Original column.
11052
- mapping.originalColumn = previousOriginalColumn + values[3];
11311
+ mapping.originalColumn = previousOriginalColumn + segment[3];
11053
11312
  previousOriginalColumn = mapping.originalColumn;
11054
11313
 
11055
- if (values.length > 4) {
11314
+ if (segment.length > 4) {
11056
11315
  // Original name.
11057
- mapping.name = this._names.at(previousName + values[4]);
11058
- previousName += values[4];
11316
+ mapping.name = previousName + segment[4];
11317
+ previousName += segment[4];
11059
11318
  }
11060
11319
  }
11061
11320
 
11062
- this.__generatedMappings.push(mapping);
11321
+ generatedMappings.push(mapping);
11063
11322
  if (typeof mapping.originalLine === 'number') {
11064
- this.__originalMappings.push(mapping);
11323
+ originalMappings.push(mapping);
11065
11324
  }
11066
11325
  }
11067
11326
  }
11068
11327
 
11069
- this.__generatedMappings.sort(util.compareByGeneratedPositions);
11070
- this.__originalMappings.sort(util.compareByOriginalPositions);
11328
+ quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);
11329
+ this.__generatedMappings = generatedMappings;
11330
+
11331
+ quickSort(originalMappings, util.compareByOriginalPositions);
11332
+ this.__originalMappings = originalMappings;
11071
11333
  };
11072
11334
 
11073
11335
  /**
@@ -11153,7 +11415,7 @@ define(function (_dereq_, exports, module) {
11153
11415
  this._generatedMappings,
11154
11416
  "generatedLine",
11155
11417
  "generatedColumn",
11156
- util.compareByGeneratedPositions,
11418
+ util.compareByGeneratedPositionsDeflated,
11157
11419
  util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
11158
11420
  );
11159
11421
 
@@ -11162,14 +11424,21 @@ define(function (_dereq_, exports, module) {
11162
11424
 
11163
11425
  if (mapping.generatedLine === needle.generatedLine) {
11164
11426
  var source = util.getArg(mapping, 'source', null);
11165
- if (source != null && this.sourceRoot != null) {
11166
- source = util.join(this.sourceRoot, source);
11427
+ if (source !== null) {
11428
+ source = this._sources.at(source);
11429
+ if (this.sourceRoot != null) {
11430
+ source = util.join(this.sourceRoot, source);
11431
+ }
11432
+ }
11433
+ var name = util.getArg(mapping, 'name', null);
11434
+ if (name !== null) {
11435
+ name = this._names.at(name);
11167
11436
  }
11168
11437
  return {
11169
11438
  source: source,
11170
11439
  line: util.getArg(mapping, 'originalLine', null),
11171
11440
  column: util.getArg(mapping, 'originalColumn', null),
11172
- name: util.getArg(mapping, 'name', null)
11441
+ name: name
11173
11442
  };
11174
11443
  }
11175
11444
  }
@@ -11182,6 +11451,19 @@ define(function (_dereq_, exports, module) {
11182
11451
  };
11183
11452
  };
11184
11453
 
11454
+ /**
11455
+ * Return true if we have the source content for every source in the source
11456
+ * map, false otherwise.
11457
+ */
11458
+ BasicSourceMapConsumer.prototype.hasContentsOfAllSources =
11459
+ function BasicSourceMapConsumer_hasContentsOfAllSources() {
11460
+ if (!this.sourcesContent) {
11461
+ return false;
11462
+ }
11463
+ return this.sourcesContent.length >= this._sources.size() &&
11464
+ !this.sourcesContent.some(function (sc) { return sc == null; });
11465
+ };
11466
+
11185
11467
  /**
11186
11468
  * Returns the original source content. The only argument is the url of the
11187
11469
  * original source file. Returns null if no original source content is
@@ -11253,16 +11535,25 @@ define(function (_dereq_, exports, module) {
11253
11535
  */
11254
11536
  BasicSourceMapConsumer.prototype.generatedPositionFor =
11255
11537
  function SourceMapConsumer_generatedPositionFor(aArgs) {
11538
+ var source = util.getArg(aArgs, 'source');
11539
+ if (this.sourceRoot != null) {
11540
+ source = util.relative(this.sourceRoot, source);
11541
+ }
11542
+ if (!this._sources.has(source)) {
11543
+ return {
11544
+ line: null,
11545
+ column: null,
11546
+ lastColumn: null
11547
+ };
11548
+ }
11549
+ source = this._sources.indexOf(source);
11550
+
11256
11551
  var needle = {
11257
- source: util.getArg(aArgs, 'source'),
11552
+ source: source,
11258
11553
  originalLine: util.getArg(aArgs, 'line'),
11259
11554
  originalColumn: util.getArg(aArgs, 'column')
11260
11555
  };
11261
11556
 
11262
- if (this.sourceRoot != null) {
11263
- needle.source = util.relative(this.sourceRoot, needle.source);
11264
- }
11265
-
11266
11557
  var index = this._findMapping(
11267
11558
  needle,
11268
11559
  this._originalMappings,
@@ -11351,6 +11642,9 @@ define(function (_dereq_, exports, module) {
11351
11642
  throw new Error('Unsupported version: ' + version);
11352
11643
  }
11353
11644
 
11645
+ this._sources = new ArraySet();
11646
+ this._names = new ArraySet();
11647
+
11354
11648
  var lastOffset = {
11355
11649
  line: -1,
11356
11650
  column: 0
@@ -11462,6 +11756,17 @@ define(function (_dereq_, exports, module) {
11462
11756
  });
11463
11757
  };
11464
11758
 
11759
+ /**
11760
+ * Return true if we have the source content for every source in the source
11761
+ * map, false otherwise.
11762
+ */
11763
+ IndexedSourceMapConsumer.prototype.hasContentsOfAllSources =
11764
+ function IndexedSourceMapConsumer_hasContentsOfAllSources() {
11765
+ return this._sections.every(function (s) {
11766
+ return s.consumer.hasContentsOfAllSources();
11767
+ });
11768
+ };
11769
+
11465
11770
  /**
11466
11771
  * Returns the original source content. The only argument is the url of the
11467
11772
  * original source file. Returns null if no original source content is
@@ -11544,12 +11849,16 @@ define(function (_dereq_, exports, module) {
11544
11849
  for (var j = 0; j < sectionMappings.length; j++) {
11545
11850
  var mapping = sectionMappings[i];
11546
11851
 
11547
- var source = mapping.source;
11548
- var sourceRoot = section.consumer.sourceRoot;
11549
-
11550
- if (source != null && sourceRoot != null) {
11551
- source = util.join(sourceRoot, source);
11852
+ var source = section.consumer._sources.at(mapping.source);
11853
+ if (section.consumer.sourceRoot !== null) {
11854
+ source = util.join(section.consumer.sourceRoot, source);
11552
11855
  }
11856
+ this._sources.add(source);
11857
+ source = this._sources.indexOf(source);
11858
+
11859
+ var name = section.consumer._names.at(mapping.name);
11860
+ this._names.add(name);
11861
+ name = this._names.indexOf(name);
11553
11862
 
11554
11863
  // The mappings coming from the consumer for the section have
11555
11864
  // generated positions relative to the start of the section, so we
@@ -11565,7 +11874,7 @@ define(function (_dereq_, exports, module) {
11565
11874
  : 0,
11566
11875
  originalLine: mapping.originalLine,
11567
11876
  originalColumn: mapping.originalColumn,
11568
- name: mapping.name
11877
+ name: name
11569
11878
  };
11570
11879
 
11571
11880
  this.__generatedMappings.push(adjustedMapping);
@@ -11575,15 +11884,15 @@ define(function (_dereq_, exports, module) {
11575
11884
  };
11576
11885
  };
11577
11886
 
11578
- this.__generatedMappings.sort(util.compareByGeneratedPositions);
11579
- this.__originalMappings.sort(util.compareByOriginalPositions);
11580
- };
11887
+ quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);
11888
+ quickSort(this.__originalMappings, util.compareByOriginalPositions);
11889
+ };
11581
11890
 
11582
11891
  exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
11583
11892
 
11584
11893
  });
11585
11894
 
11586
- },{"./array-set":13,"./base64-vlq":14,"./binary-search":16,"./util":21,"amdefine":22}],19:[function(_dereq_,module,exports){
11895
+ },{"./array-set":13,"./base64-vlq":14,"./binary-search":16,"./quick-sort":18,"./util":22,"amdefine":23}],20:[function(_dereq_,module,exports){
11587
11896
  /* -*- Mode: js; js-indent-level: 2; -*- */
11588
11897
  /*
11589
11898
  * Copyright 2011 Mozilla Foundation and contributors
@@ -11883,7 +12192,6 @@ define(function (_dereq_, exports, module) {
11883
12192
  var mapping;
11884
12193
 
11885
12194
  var mappings = this._mappings.toArray();
11886
-
11887
12195
  for (var i = 0, len = mappings.length; i < len; i++) {
11888
12196
  mapping = mappings[i];
11889
12197
 
@@ -11896,7 +12204,7 @@ define(function (_dereq_, exports, module) {
11896
12204
  }
11897
12205
  else {
11898
12206
  if (i > 0) {
11899
- if (!util.compareByGeneratedPositions(mapping, mappings[i - 1])) {
12207
+ if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
11900
12208
  continue;
11901
12209
  }
11902
12210
  result += ',';
@@ -11985,7 +12293,7 @@ define(function (_dereq_, exports, module) {
11985
12293
 
11986
12294
  });
11987
12295
 
11988
- },{"./array-set":13,"./base64-vlq":14,"./mapping-list":17,"./util":21,"amdefine":22}],20:[function(_dereq_,module,exports){
12296
+ },{"./array-set":13,"./base64-vlq":14,"./mapping-list":17,"./util":22,"amdefine":23}],21:[function(_dereq_,module,exports){
11989
12297
  /* -*- Mode: js; js-indent-level: 2; -*- */
11990
12298
  /*
11991
12299
  * Copyright 2011 Mozilla Foundation and contributors
@@ -12401,7 +12709,7 @@ define(function (_dereq_, exports, module) {
12401
12709
 
12402
12710
  });
12403
12711
 
12404
- },{"./source-map-generator":19,"./util":21,"amdefine":22}],21:[function(_dereq_,module,exports){
12712
+ },{"./source-map-generator":20,"./util":22,"amdefine":23}],22:[function(_dereq_,module,exports){
12405
12713
  /* -*- Mode: js; js-indent-level: 2; -*- */
12406
12714
  /*
12407
12715
  * Copyright 2011 Mozilla Foundation and contributors
@@ -12602,15 +12910,30 @@ define(function (_dereq_, exports, module) {
12602
12910
 
12603
12911
  aRoot = aRoot.replace(/\/$/, '');
12604
12912
 
12605
- // XXX: It is possible to remove this block, and the tests still pass!
12606
- var url = urlParse(aRoot);
12607
- if (aPath.charAt(0) == "/" && url && url.path == "/") {
12608
- return aPath.slice(1);
12913
+ // It is possible for the path to be above the root. In this case, simply
12914
+ // checking whether the root is a prefix of the path won't work. Instead, we
12915
+ // need to remove components from the root one by one, until either we find
12916
+ // a prefix that fits, or we run out of components to remove.
12917
+ var level = 0;
12918
+ while (aPath.indexOf(aRoot + '/') !== 0) {
12919
+ var index = aRoot.lastIndexOf("/");
12920
+ if (index < 0) {
12921
+ return aPath;
12922
+ }
12923
+
12924
+ // If the only part of the root that is left is the scheme (i.e. http://,
12925
+ // file:///, etc.), one or more slashes (/), or simply nothing at all, we
12926
+ // have exhausted all components, so the path is not relative to the root.
12927
+ aRoot = aRoot.slice(0, index);
12928
+ if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
12929
+ return aPath;
12930
+ }
12931
+
12932
+ ++level;
12609
12933
  }
12610
12934
 
12611
- return aPath.indexOf(aRoot + '/') === 0
12612
- ? aPath.substr(aRoot.length + 1)
12613
- : aPath;
12935
+ // Make sure we add a "../" for each component we removed from the root.
12936
+ return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
12614
12937
  }
12615
12938
  exports.relative = relative;
12616
12939
 
@@ -12633,12 +12956,6 @@ define(function (_dereq_, exports, module) {
12633
12956
  }
12634
12957
  exports.fromSetString = fromSetString;
12635
12958
 
12636
- function strcmp(aStr1, aStr2) {
12637
- var s1 = aStr1 || "";
12638
- var s2 = aStr2 || "";
12639
- return (s1 > s2) - (s1 < s2);
12640
- }
12641
-
12642
12959
  /**
12643
12960
  * Comparator between two mappings where the original positions are compared.
12644
12961
  *
@@ -12648,84 +12965,126 @@ define(function (_dereq_, exports, module) {
12648
12965
  * stubbed out mapping.
12649
12966
  */
12650
12967
  function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
12651
- var cmp;
12652
-
12653
- cmp = strcmp(mappingA.source, mappingB.source);
12654
- if (cmp) {
12968
+ var cmp = mappingA.source - mappingB.source;
12969
+ if (cmp !== 0) {
12655
12970
  return cmp;
12656
12971
  }
12657
12972
 
12658
12973
  cmp = mappingA.originalLine - mappingB.originalLine;
12659
- if (cmp) {
12974
+ if (cmp !== 0) {
12660
12975
  return cmp;
12661
12976
  }
12662
12977
 
12663
12978
  cmp = mappingA.originalColumn - mappingB.originalColumn;
12664
- if (cmp || onlyCompareOriginal) {
12979
+ if (cmp !== 0 || onlyCompareOriginal) {
12665
12980
  return cmp;
12666
12981
  }
12667
12982
 
12668
12983
  cmp = mappingA.generatedColumn - mappingB.generatedColumn;
12669
- if (cmp) {
12984
+ if (cmp !== 0) {
12670
12985
  return cmp;
12671
12986
  }
12672
12987
 
12673
12988
  cmp = mappingA.generatedLine - mappingB.generatedLine;
12674
- if (cmp) {
12989
+ if (cmp !== 0) {
12675
12990
  return cmp;
12676
12991
  }
12677
12992
 
12678
- return strcmp(mappingA.name, mappingB.name);
12993
+ return mappingA.name - mappingB.name;
12679
12994
  };
12680
12995
  exports.compareByOriginalPositions = compareByOriginalPositions;
12681
12996
 
12682
12997
  /**
12683
- * Comparator between two mappings where the generated positions are
12684
- * compared.
12998
+ * Comparator between two mappings with deflated source and name indices where
12999
+ * the generated positions are compared.
12685
13000
  *
12686
13001
  * Optionally pass in `true` as `onlyCompareGenerated` to consider two
12687
13002
  * mappings with the same generated line and column, but different
12688
13003
  * source/name/original line and column the same. Useful when searching for a
12689
13004
  * mapping with a stubbed out mapping.
12690
13005
  */
12691
- function compareByGeneratedPositions(mappingA, mappingB, onlyCompareGenerated) {
12692
- var cmp;
13006
+ function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
13007
+ var cmp = mappingA.generatedLine - mappingB.generatedLine;
13008
+ if (cmp !== 0) {
13009
+ return cmp;
13010
+ }
12693
13011
 
12694
- cmp = mappingA.generatedLine - mappingB.generatedLine;
12695
- if (cmp) {
13012
+ cmp = mappingA.generatedColumn - mappingB.generatedColumn;
13013
+ if (cmp !== 0 || onlyCompareGenerated) {
13014
+ return cmp;
13015
+ }
13016
+
13017
+ cmp = mappingA.source - mappingB.source;
13018
+ if (cmp !== 0) {
13019
+ return cmp;
13020
+ }
13021
+
13022
+ cmp = mappingA.originalLine - mappingB.originalLine;
13023
+ if (cmp !== 0) {
13024
+ return cmp;
13025
+ }
13026
+
13027
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
13028
+ if (cmp !== 0) {
13029
+ return cmp;
13030
+ }
13031
+
13032
+ return mappingA.name - mappingB.name;
13033
+ };
13034
+ exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
13035
+
13036
+ function strcmp(aStr1, aStr2) {
13037
+ if (aStr1 === aStr2) {
13038
+ return 0;
13039
+ }
13040
+
13041
+ if (aStr1 > aStr2) {
13042
+ return 1;
13043
+ }
13044
+
13045
+ return -1;
13046
+ }
13047
+
13048
+ /**
13049
+ * Comparator between two mappings with inflated source and name strings where
13050
+ * the generated positions are compared.
13051
+ */
13052
+ function compareByGeneratedPositionsInflated(mappingA, mappingB) {
13053
+ var cmp = mappingA.generatedLine - mappingB.generatedLine;
13054
+ if (cmp !== 0) {
12696
13055
  return cmp;
12697
13056
  }
12698
13057
 
12699
13058
  cmp = mappingA.generatedColumn - mappingB.generatedColumn;
12700
- if (cmp || onlyCompareGenerated) {
13059
+ if (cmp !== 0) {
12701
13060
  return cmp;
12702
13061
  }
12703
13062
 
12704
13063
  cmp = strcmp(mappingA.source, mappingB.source);
12705
- if (cmp) {
13064
+ if (cmp !== 0) {
12706
13065
  return cmp;
12707
13066
  }
12708
13067
 
12709
13068
  cmp = mappingA.originalLine - mappingB.originalLine;
12710
- if (cmp) {
13069
+ if (cmp !== 0) {
12711
13070
  return cmp;
12712
13071
  }
12713
13072
 
12714
13073
  cmp = mappingA.originalColumn - mappingB.originalColumn;
12715
- if (cmp) {
13074
+ if (cmp !== 0) {
12716
13075
  return cmp;
12717
13076
  }
12718
13077
 
12719
13078
  return strcmp(mappingA.name, mappingB.name);
12720
13079
  };
12721
- exports.compareByGeneratedPositions = compareByGeneratedPositions;
13080
+ exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
12722
13081
 
12723
13082
  });
12724
13083
 
12725
- },{"amdefine":22}],22:[function(_dereq_,module,exports){
13084
+ },{"amdefine":23}],23:[function(_dereq_,module,exports){
12726
13085
  (function (process,__filename){
12727
13086
  /** vim: et:ts=4:sw=4:sts=4
12728
- * @license amdefine 0.1.0 Copyright (c) 2011, The Dojo Foundation All Rights Reserved.
13087
+ * @license amdefine 1.0.0 Copyright (c) 2011-2015, The Dojo Foundation All Rights Reserved.
12729
13088
  * Available via the MIT or new BSD license.
12730
13089
  * see: http://github.com/jrburke/amdefine for details
12731
13090
  */
@@ -12846,9 +13205,11 @@ function amdefine(module, requireFn) {
12846
13205
  });
12847
13206
 
12848
13207
  //Wait for next tick to call back the require call.
12849
- process.nextTick(function () {
12850
- callback.apply(null, deps);
12851
- });
13208
+ if (callback) {
13209
+ process.nextTick(function () {
13210
+ callback.apply(null, deps);
13211
+ });
13212
+ }
12852
13213
  }
12853
13214
  }
12854
13215
 
@@ -13025,7 +13386,7 @@ function amdefine(module, requireFn) {
13025
13386
  module.exports = amdefine;
13026
13387
 
13027
13388
  }).call(this,_dereq_('_process'),"/node_modules/jstransform/node_modules/source-map/node_modules/amdefine/amdefine.js")
13028
- },{"_process":8,"path":7}],23:[function(_dereq_,module,exports){
13389
+ },{"_process":8,"path":7}],24:[function(_dereq_,module,exports){
13029
13390
  /**
13030
13391
  * Copyright 2013-present, Facebook, Inc.
13031
13392
  * All rights reserved.
@@ -13040,7 +13401,7 @@ module.exports = amdefine;
13040
13401
  // moved to something else (perhaps 'jstranform/advanced')
13041
13402
  module.exports = _dereq_('./src/simple');
13042
13403
 
13043
- },{"./src/simple":27}],24:[function(_dereq_,module,exports){
13404
+ },{"./src/simple":28}],25:[function(_dereq_,module,exports){
13044
13405
  /**
13045
13406
  * Copyright 2013-present, Facebook, Inc.
13046
13407
  * All rights reserved.
@@ -13121,7 +13482,7 @@ exports.extract = extract;
13121
13482
  exports.parse = parse;
13122
13483
  exports.parseAsObject = parseAsObject;
13123
13484
 
13124
- },{}],25:[function(_dereq_,module,exports){
13485
+ },{}],26:[function(_dereq_,module,exports){
13125
13486
  /**
13126
13487
  * Copyright 2013-present, Facebook, Inc.
13127
13488
  * All rights reserved.
@@ -13150,7 +13511,7 @@ function inlineSourceMap(sourceMap, sourceCode, sourceFilename) {
13150
13511
 
13151
13512
  module.exports = inlineSourceMap;
13152
13513
 
13153
- },{"buffer":3}],26:[function(_dereq_,module,exports){
13514
+ },{"buffer":3}],27:[function(_dereq_,module,exports){
13154
13515
  /**
13155
13516
  * Copyright 2013-present, Facebook, Inc.
13156
13517
  * All rights reserved.
@@ -13444,7 +13805,7 @@ function transform(visitors, source, options) {
13444
13805
  exports.transform = transform;
13445
13806
  exports.Syntax = Syntax;
13446
13807
 
13447
- },{"./utils":28,"esprima-fb":9,"source-map":12}],27:[function(_dereq_,module,exports){
13808
+ },{"./utils":29,"esprima-fb":10,"source-map":12}],28:[function(_dereq_,module,exports){
13448
13809
  /**
13449
13810
  * Copyright 2013-present, Facebook, Inc.
13450
13811
  * All rights reserved.
@@ -13561,7 +13922,7 @@ function transform(code, options) {
13561
13922
  var sourceMap;
13562
13923
  if (result.sourceMap) {
13563
13924
  sourceMap = result.sourceMap.toJSON();
13564
- sourceMap.sources = transformOptions.filename;
13925
+ sourceMap.sources = [transformOptions.filename];
13565
13926
  sourceMap.sourcesContent = [code];
13566
13927
  }
13567
13928
 
@@ -13611,8 +13972,7 @@ module.exports = {
13611
13972
  transformFileSync: transformFileSync
13612
13973
  };
13613
13974
 
13614
-
13615
- },{"../visitors":42,"../visitors/type-syntax":49,"./inline-source-map":25,"./jstransform":26,"fs":2,"object-assign":11}],28:[function(_dereq_,module,exports){
13975
+ },{"../visitors":43,"../visitors/type-syntax":50,"./inline-source-map":26,"./jstransform":27,"fs":2,"object-assign":11}],29:[function(_dereq_,module,exports){
13616
13976
  /**
13617
13977
  * Copyright 2013-present, Facebook, Inc.
13618
13978
  * All rights reserved.
@@ -14315,7 +14675,7 @@ exports.scopeTypes = scopeTypes;
14315
14675
  exports.updateIndent = updateIndent;
14316
14676
  exports.updateState = updateState;
14317
14677
 
14318
- },{"./docblock":24,"esprima-fb":9}],29:[function(_dereq_,module,exports){
14678
+ },{"./docblock":25,"esprima-fb":10}],30:[function(_dereq_,module,exports){
14319
14679
  /**
14320
14680
  * Copyright 2013-present, Facebook, Inc.
14321
14681
  * All rights reserved.
@@ -14470,7 +14830,7 @@ exports.visitorList = [
14470
14830
  ];
14471
14831
 
14472
14832
 
14473
- },{"../src/utils":28,"./es6-destructuring-visitors":32,"./es6-rest-param-visitors":37,"esprima-fb":9}],30:[function(_dereq_,module,exports){
14833
+ },{"../src/utils":29,"./es6-destructuring-visitors":33,"./es6-rest-param-visitors":38,"esprima-fb":10}],31:[function(_dereq_,module,exports){
14474
14834
  /**
14475
14835
  * Copyright 2013-present, Facebook, Inc.
14476
14836
  * All rights reserved.
@@ -14581,10 +14941,10 @@ visitCallSpread.test = function(node, path, state) {
14581
14941
  };
14582
14942
 
14583
14943
  exports.visitorList = [
14584
- visitCallSpread,
14944
+ visitCallSpread
14585
14945
  ];
14586
14946
 
14587
- },{"../src/utils":28,"esprima-fb":9}],31:[function(_dereq_,module,exports){
14947
+ },{"../src/utils":29,"esprima-fb":10}],32:[function(_dereq_,module,exports){
14588
14948
  /**
14589
14949
  * Copyright 2013-present, Facebook, Inc.
14590
14950
  * All rights reserved.
@@ -15167,7 +15527,7 @@ exports.visitorList = [
15167
15527
  visitSuperMemberExpression
15168
15528
  ];
15169
15529
 
15170
- },{"../src/utils":28,"./reserved-words-helper":46,"base62":10,"esprima-fb":9}],32:[function(_dereq_,module,exports){
15530
+ },{"../src/utils":29,"./reserved-words-helper":47,"base62":9,"esprima-fb":10}],33:[function(_dereq_,module,exports){
15171
15531
  /**
15172
15532
  * Copyright 2013-present, Facebook, Inc.
15173
15533
  * All rights reserved.
@@ -15443,7 +15803,7 @@ exports.visitorList = [
15443
15803
  exports.renderDestructuredComponents = renderDestructuredComponents;
15444
15804
 
15445
15805
 
15446
- },{"../src/utils":28,"./es6-rest-param-visitors":37,"./es7-rest-property-helpers":39,"./reserved-words-helper":46,"esprima-fb":9}],33:[function(_dereq_,module,exports){
15806
+ },{"../src/utils":29,"./es6-rest-param-visitors":38,"./es7-rest-property-helpers":40,"./reserved-words-helper":47,"esprima-fb":10}],34:[function(_dereq_,module,exports){
15447
15807
  /**
15448
15808
  * Copyright 2013-present, Facebook, Inc.
15449
15809
  * All rights reserved.
@@ -15568,7 +15928,7 @@ exports.visitorList = [
15568
15928
  visitForOfStatement,
15569
15929
  ];
15570
15930
 
15571
- },{"../src/utils":28,"esprima-fb":9}],34:[function(_dereq_,module,exports){
15931
+ },{"../src/utils":29,"esprima-fb":10}],35:[function(_dereq_,module,exports){
15572
15932
  /**
15573
15933
  * Copyright 2013-present, Facebook, Inc.
15574
15934
  * All rights reserved.
@@ -15676,7 +16036,7 @@ exports.visitorList = [
15676
16036
  es6ObjectComputedProperties,
15677
16037
  ];
15678
16038
 
15679
- },{"../src/utils":28,"./es6-object-concise-method-visitors":35,"./es7-spread-property-visitors":40,"esprima-fb":9}],35:[function(_dereq_,module,exports){
16039
+ },{"../src/utils":29,"./es6-object-concise-method-visitors":36,"./es7-spread-property-visitors":41,"esprima-fb":10}],36:[function(_dereq_,module,exports){
15680
16040
  /**
15681
16041
  * Copyright 2013-present, Facebook, Inc.
15682
16042
  * All rights reserved.
@@ -15748,7 +16108,7 @@ exports.visitorList = [
15748
16108
  visitObjectConciseMethod
15749
16109
  ];
15750
16110
 
15751
- },{"../src/utils":28,"./reserved-words-helper":46,"esprima-fb":9}],36:[function(_dereq_,module,exports){
16111
+ },{"../src/utils":29,"./reserved-words-helper":47,"esprima-fb":10}],37:[function(_dereq_,module,exports){
15752
16112
  /**
15753
16113
  * Copyright 2013-present, Facebook, Inc.
15754
16114
  * All rights reserved.
@@ -15796,7 +16156,7 @@ exports.visitorList = [
15796
16156
  ];
15797
16157
 
15798
16158
 
15799
- },{"../src/utils":28,"esprima-fb":9}],37:[function(_dereq_,module,exports){
16159
+ },{"../src/utils":29,"esprima-fb":10}],38:[function(_dereq_,module,exports){
15800
16160
  /**
15801
16161
  * Copyright 2013-present, Facebook, Inc.
15802
16162
  * All rights reserved.
@@ -15898,7 +16258,7 @@ exports.visitorList = [
15898
16258
  visitFunctionBodyWithRestParam
15899
16259
  ];
15900
16260
 
15901
- },{"../src/utils":28,"esprima-fb":9}],38:[function(_dereq_,module,exports){
16261
+ },{"../src/utils":29,"esprima-fb":10}],39:[function(_dereq_,module,exports){
15902
16262
  /**
15903
16263
  * Copyright 2013-present, Facebook, Inc.
15904
16264
  * All rights reserved.
@@ -16053,7 +16413,7 @@ exports.visitorList = [
16053
16413
  visitTaggedTemplateExpression
16054
16414
  ];
16055
16415
 
16056
- },{"../src/utils":28,"esprima-fb":9}],39:[function(_dereq_,module,exports){
16416
+ },{"../src/utils":29,"esprima-fb":10}],40:[function(_dereq_,module,exports){
16057
16417
  /**
16058
16418
  * Copyright 2013-present, Facebook, Inc.
16059
16419
  * All rights reserved.
@@ -16128,7 +16488,7 @@ function renderRestExpression(accessorExpression, excludedProperties) {
16128
16488
 
16129
16489
  exports.renderRestExpression = renderRestExpression;
16130
16490
 
16131
- },{"esprima-fb":9}],40:[function(_dereq_,module,exports){
16491
+ },{"esprima-fb":10}],41:[function(_dereq_,module,exports){
16132
16492
  /**
16133
16493
  * Copyright 2013-present, Facebook, Inc.
16134
16494
  * All rights reserved.
@@ -16256,7 +16616,7 @@ exports.visitorList = [
16256
16616
  visitObjectLiteralSpread
16257
16617
  ];
16258
16618
 
16259
- },{"../src/utils":28,"esprima-fb":9}],41:[function(_dereq_,module,exports){
16619
+ },{"../src/utils":29,"esprima-fb":10}],42:[function(_dereq_,module,exports){
16260
16620
  /**
16261
16621
  * Copyright 2013-present, Facebook, Inc.
16262
16622
  * All rights reserved.
@@ -16361,7 +16721,7 @@ exports.visitorList = [
16361
16721
  visitFunctionDefinitionArguments,
16362
16722
  ];
16363
16723
 
16364
- },{"../src/utils":28,"esprima-fb":9}],42:[function(_dereq_,module,exports){
16724
+ },{"../src/utils":29,"esprima-fb":10}],43:[function(_dereq_,module,exports){
16365
16725
  /**
16366
16726
  * Copyright 2013-present, Facebook, Inc.
16367
16727
  * All rights reserved.
@@ -16524,7 +16884,7 @@ exports.getAllVisitors = getAllVisitors;
16524
16884
  exports.transformVisitors = transformVisitors;
16525
16885
 
16526
16886
 
16527
- },{"./es6-arrow-function-visitors":29,"./es6-call-spread-visitors":30,"./es6-class-visitors":31,"./es6-destructuring-visitors":32,"./es6-for-of-visitors":33,"./es6-object-computed-property-visitors":34,"./es6-object-concise-method-visitors":35,"./es6-object-short-notation-visitors":36,"./es6-rest-param-visitors":37,"./es6-template-visitors":38,"./es7-spread-property-visitors":40,"./es7-trailing-comma-visitors":41,"./react-display-name-visitors":44,"./react-jsx-visitors":45,"./reserved-words-visitors":47,"./trailing-comma-visitors":48,"./undefined-to-void-0-visitors":50}],43:[function(_dereq_,module,exports){
16887
+ },{"./es6-arrow-function-visitors":30,"./es6-call-spread-visitors":31,"./es6-class-visitors":32,"./es6-destructuring-visitors":33,"./es6-for-of-visitors":34,"./es6-object-computed-property-visitors":35,"./es6-object-concise-method-visitors":36,"./es6-object-short-notation-visitors":37,"./es6-rest-param-visitors":38,"./es6-template-visitors":39,"./es7-spread-property-visitors":41,"./es7-trailing-comma-visitors":42,"./react-display-name-visitors":45,"./react-jsx-visitors":46,"./reserved-words-visitors":48,"./trailing-comma-visitors":49,"./undefined-to-void-0-visitors":51}],44:[function(_dereq_,module,exports){
16528
16888
  /**
16529
16889
  * Copyright 2013-present, Facebook, Inc.
16530
16890
  * All rights reserved.
@@ -16603,7 +16963,7 @@ function renderJSXLiteral(object, isLast, state, start, end) {
16603
16963
  if (trimmedLine || isLastNonEmptyLine) {
16604
16964
  utils.append(
16605
16965
  JSON.stringify(trimmedLine) +
16606
- (!isLastNonEmptyLine ? ' + \' \' +' : ''),
16966
+ (!isLastNonEmptyLine ? ' + " " +' : ''),
16607
16967
  state);
16608
16968
 
16609
16969
  if (isLastNonEmptyLine) {
@@ -16664,7 +17024,7 @@ exports.renderJSXLiteral = renderJSXLiteral;
16664
17024
  exports.quoteAttrName = quoteAttrName;
16665
17025
  exports.trimLeft = trimLeft;
16666
17026
 
16667
- },{"../src/utils":28,"esprima-fb":9}],44:[function(_dereq_,module,exports){
17027
+ },{"../src/utils":29,"esprima-fb":10}],45:[function(_dereq_,module,exports){
16668
17028
  /**
16669
17029
  * Copyright 2013-present, Facebook, Inc.
16670
17030
  * All rights reserved.
@@ -16792,7 +17152,7 @@ exports.visitorList = [
16792
17152
  visitReactDisplayName
16793
17153
  ];
16794
17154
 
16795
- },{"../src/utils":28,"esprima-fb":9}],45:[function(_dereq_,module,exports){
17155
+ },{"../src/utils":29,"esprima-fb":10}],46:[function(_dereq_,module,exports){
16796
17156
  /**
16797
17157
  * Copyright 2013-present, Facebook, Inc.
16798
17158
  * All rights reserved.
@@ -17036,7 +17396,7 @@ exports.visitorList = [
17036
17396
  visitReactTag
17037
17397
  ];
17038
17398
 
17039
- },{"../src/utils":28,"./jsx-helpers":43,"esprima-fb":9}],46:[function(_dereq_,module,exports){
17399
+ },{"../src/utils":29,"./jsx-helpers":44,"esprima-fb":10}],47:[function(_dereq_,module,exports){
17040
17400
  /**
17041
17401
  * Copyright 2013-present, Facebook, Inc.
17042
17402
  * All rights reserved.
@@ -17105,7 +17465,7 @@ exports.isES3ReservedWord = function(word) {
17105
17465
  return !!es3ReservedWordsMap[word];
17106
17466
  };
17107
17467
 
17108
- },{}],47:[function(_dereq_,module,exports){
17468
+ },{}],48:[function(_dereq_,module,exports){
17109
17469
  /**
17110
17470
  * Copyright 2013-present, Facebook, Inc.
17111
17471
  * All rights reserved.
@@ -17174,7 +17534,7 @@ exports.visitorList = [
17174
17534
  visitMemberExpression
17175
17535
  ];
17176
17536
 
17177
- },{"../src/utils":28,"./reserved-words-helper":46,"esprima-fb":9}],48:[function(_dereq_,module,exports){
17537
+ },{"../src/utils":29,"./reserved-words-helper":47,"esprima-fb":10}],49:[function(_dereq_,module,exports){
17178
17538
  /**
17179
17539
  * Copyright 2013-present, Facebook, Inc.
17180
17540
  * All rights reserved.
@@ -17250,7 +17610,7 @@ exports.visitorList = [
17250
17610
  visitArrayOrObjectExpression
17251
17611
  ];
17252
17612
 
17253
- },{"../src/utils":28,"esprima-fb":9}],49:[function(_dereq_,module,exports){
17613
+ },{"../src/utils":29,"esprima-fb":10}],50:[function(_dereq_,module,exports){
17254
17614
  /**
17255
17615
  * Copyright 2013-present, Facebook, Inc.
17256
17616
  * All rights reserved.
@@ -17442,7 +17802,7 @@ exports.visitorList = [
17442
17802
  visitTypeAnnotatedObjectOrArrayPattern
17443
17803
  ];
17444
17804
 
17445
- },{"../src/utils":28,"esprima-fb":9}],50:[function(_dereq_,module,exports){
17805
+ },{"../src/utils":29,"esprima-fb":10}],51:[function(_dereq_,module,exports){
17446
17806
  /**
17447
17807
  * Copyright 2013-present, Facebook, Inc.
17448
17808
  * All rights reserved.
@@ -17585,5 +17945,5 @@ exports.visitorList = [
17585
17945
  visitIdentifierUndefined
17586
17946
  ];
17587
17947
 
17588
- },{"../src/utils":28,"esprima-fb":9}]},{},[1])(1)
17948
+ },{"../src/utils":29,"esprima-fb":10}]},{},[1])(1)
17589
17949
  });