react-source 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * JSXTransformer v0.4.1
2
+ * JSXTransformer v0.4.2
3
3
  */
4
4
  (function(e){if("function"==typeof bootstrap)bootstrap("jsxtransformer",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeJSXTransformer=e}else"undefined"!=typeof window?window.JSXTransformer=e():global.JSXTransformer=e()})(function(){var define,ses,bootstrap,module,exports;
5
5
  return (function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0].call(u.exports,function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;s<n.length;s++)i(n[s]);return i})({1:[function(require,module,exports){
@@ -31,7 +31,7 @@ var Base62 = (function (my) {
31
31
 
32
32
  module.exports = Base62
33
33
  },{}],2:[function(require,module,exports){
34
- (function(process){function filter (xs, fn) {
34
+ var process=require("__browserify_process");function filter (xs, fn) {
35
35
  var res = [];
36
36
  for (var i = 0; i < xs.length; i++) {
37
37
  if (fn(xs[i], i, xs)) res.push(xs[i]);
@@ -207,7 +207,8 @@ exports.relative = function(from, to) {
207
207
  return outputParts.join('/');
208
208
  };
209
209
 
210
- })(require("__browserify_process"))
210
+ exports.sep = '/';
211
+
211
212
  },{"__browserify_process":3}],3:[function(require,module,exports){
212
213
  // shim for using process in browser
213
214
 
@@ -263,7 +264,7 @@ process.chdir = function (dir) {
263
264
  };
264
265
 
265
266
  },{}],4:[function(require,module,exports){
266
- (function(){/*
267
+ /*
267
268
  Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com>
268
269
  Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
269
270
  Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be>
@@ -6445,7 +6446,6 @@ parseYieldExpression: true
6445
6446
  }));
6446
6447
  /* vim: set sw=4 ts=4 et tw=80 : */
6447
6448
 
6448
- })()
6449
6449
  },{}],5:[function(require,module,exports){
6450
6450
  /*
6451
6451
  * Copyright 2009-2011 Mozilla Foundation and contributors
@@ -6484,10 +6484,10 @@ define(function (require, exports, module) {
6484
6484
  /**
6485
6485
  * Static method for creating ArraySet instances from an existing array.
6486
6486
  */
6487
- ArraySet.fromArray = function ArraySet_fromArray(aArray) {
6487
+ ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
6488
6488
  var set = new ArraySet();
6489
6489
  for (var i = 0, len = aArray.length; i < len; i++) {
6490
- set.add(aArray[i]);
6490
+ set.add(aArray[i], aAllowDuplicates);
6491
6491
  }
6492
6492
  return set;
6493
6493
  };
@@ -6497,14 +6497,15 @@ define(function (require, exports, module) {
6497
6497
  *
6498
6498
  * @param String aStr
6499
6499
  */
6500
- ArraySet.prototype.add = function ArraySet_add(aStr) {
6501
- if (this.has(aStr)) {
6502
- // Already a member; nothing to do.
6503
- return;
6504
- }
6500
+ ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
6501
+ var isDuplicate = this.has(aStr);
6505
6502
  var idx = this._array.length;
6506
- this._array.push(aStr);
6507
- this._set[util.toSetString(aStr)] = idx;
6503
+ if (!isDuplicate || aAllowDuplicates) {
6504
+ this._array.push(aStr);
6505
+ }
6506
+ if (!isDuplicate) {
6507
+ this._set[util.toSetString(aStr)] = idx;
6508
+ }
6508
6509
  };
6509
6510
 
6510
6511
  /**
@@ -6777,7 +6778,7 @@ define(function (require, exports, module) {
6777
6778
  // element which is less than the one we are searching for, so we
6778
6779
  // return null.
6779
6780
  var mid = Math.floor((aHigh - aLow) / 2) + aLow;
6780
- var cmp = aCompare(aNeedle, aHaystack[mid]);
6781
+ var cmp = aCompare(aNeedle, aHaystack[mid], true);
6781
6782
  if (cmp === 0) {
6782
6783
  // Found the element we are looking for.
6783
6784
  return aHaystack[mid];
@@ -6882,50 +6883,59 @@ define(function (require, exports, module) {
6882
6883
 
6883
6884
  var version = util.getArg(sourceMap, 'version');
6884
6885
  var sources = util.getArg(sourceMap, 'sources');
6885
- var names = util.getArg(sourceMap, 'names');
6886
+ // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
6887
+ // requires the array) to play nice here.
6888
+ var names = util.getArg(sourceMap, 'names', []);
6886
6889
  var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
6887
6890
  var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
6888
6891
  var mappings = util.getArg(sourceMap, 'mappings');
6889
6892
  var file = util.getArg(sourceMap, 'file', null);
6890
6893
 
6891
- if (version !== this._version) {
6894
+ // Once again, Sass deviates from the spec and supplies the version as a
6895
+ // string rather than a number, so we use loose equality checking here.
6896
+ if (version != this._version) {
6892
6897
  throw new Error('Unsupported version: ' + version);
6893
6898
  }
6894
6899
 
6895
- this._names = ArraySet.fromArray(names);
6896
- this._sources = ArraySet.fromArray(sources);
6900
+ // Pass `true` below to allow duplicate names and sources. While source maps
6901
+ // are intended to be compressed and deduplicated, the TypeScript compiler
6902
+ // sometimes generates source maps with duplicates in them. See Github issue
6903
+ // #72 and bugzil.la/889492.
6904
+ this._names = ArraySet.fromArray(names, true);
6905
+ this._sources = ArraySet.fromArray(sources, true);
6906
+
6897
6907
  this.sourceRoot = sourceRoot;
6898
6908
  this.sourcesContent = sourcesContent;
6909
+ this._mappings = mappings;
6899
6910
  this.file = file;
6900
-
6901
- // `this._generatedMappings` and `this._originalMappings` hold the parsed
6902
- // mapping coordinates from the source map's "mappings" attribute. Each
6903
- // object in the array is of the form
6904
- //
6905
- // {
6906
- // generatedLine: The line number in the generated code,
6907
- // generatedColumn: The column number in the generated code,
6908
- // source: The path to the original source file that generated this
6909
- // chunk of code,
6910
- // originalLine: The line number in the original source that
6911
- // corresponds to this chunk of generated code,
6912
- // originalColumn: The column number in the original source that
6913
- // corresponds to this chunk of generated code,
6914
- // name: The name of the original symbol which generated this chunk of
6915
- // code.
6916
- // }
6917
- //
6918
- // All properties except for `generatedLine` and `generatedColumn` can be
6919
- // `null`.
6920
- //
6921
- // `this._generatedMappings` is ordered by the generated positions.
6922
- //
6923
- // `this._originalMappings` is ordered by the original positions.
6924
- this._generatedMappings = [];
6925
- this._originalMappings = [];
6926
- this._parseMappings(mappings, sourceRoot);
6927
6911
  }
6928
6912
 
6913
+ /**
6914
+ * Create a SourceMapConsumer from a SourceMapGenerator.
6915
+ *
6916
+ * @param SourceMapGenerator aSourceMap
6917
+ * The source map that will be consumed.
6918
+ * @returns SourceMapConsumer
6919
+ */
6920
+ SourceMapConsumer.fromSourceMap =
6921
+ function SourceMapConsumer_fromSourceMap(aSourceMap) {
6922
+ var smc = Object.create(SourceMapConsumer.prototype);
6923
+
6924
+ smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
6925
+ smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
6926
+ smc.sourceRoot = aSourceMap._sourceRoot;
6927
+ smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),
6928
+ smc.sourceRoot);
6929
+ smc.file = aSourceMap._file;
6930
+
6931
+ smc.__generatedMappings = aSourceMap._mappings.slice()
6932
+ .sort(util.compareByGeneratedPositions);
6933
+ smc.__originalMappings = aSourceMap._mappings.slice()
6934
+ .sort(util.compareByOriginalPositions);
6935
+
6936
+ return smc;
6937
+ };
6938
+
6929
6939
  /**
6930
6940
  * The version of the source mapping spec that we are consuming.
6931
6941
  */
@@ -6942,9 +6952,66 @@ define(function (require, exports, module) {
6942
6952
  }
6943
6953
  });
6944
6954
 
6955
+ // `__generatedMappings` and `__originalMappings` are arrays that hold the
6956
+ // parsed mapping coordinates from the source map's "mappings" attribute. They
6957
+ // are lazily instantiated, accessed via the `_generatedMappings` and
6958
+ // `_originalMappings` getters respectively, and we only parse the mappings
6959
+ // and create these arrays once queried for a source location. We jump through
6960
+ // these hoops because there can be many thousands of mappings, and parsing
6961
+ // them is expensive, so we only want to do it if we must.
6962
+ //
6963
+ // Each object in the arrays is of the form:
6964
+ //
6965
+ // {
6966
+ // generatedLine: The line number in the generated code,
6967
+ // generatedColumn: The column number in the generated code,
6968
+ // source: The path to the original source file that generated this
6969
+ // chunk of code,
6970
+ // originalLine: The line number in the original source that
6971
+ // corresponds to this chunk of generated code,
6972
+ // originalColumn: The column number in the original source that
6973
+ // corresponds to this chunk of generated code,
6974
+ // name: The name of the original symbol which generated this chunk of
6975
+ // code.
6976
+ // }
6977
+ //
6978
+ // All properties except for `generatedLine` and `generatedColumn` can be
6979
+ // `null`.
6980
+ //
6981
+ // `_generatedMappings` is ordered by the generated positions.
6982
+ //
6983
+ // `_originalMappings` is ordered by the original positions.
6984
+
6985
+ SourceMapConsumer.prototype.__generatedMappings = null;
6986
+ Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
6987
+ get: function () {
6988
+ if (!this.__generatedMappings) {
6989
+ this.__generatedMappings = [];
6990
+ this.__originalMappings = [];
6991
+ this._parseMappings(this._mappings, this.sourceRoot);
6992
+ }
6993
+
6994
+ return this.__generatedMappings;
6995
+ }
6996
+ });
6997
+
6998
+ SourceMapConsumer.prototype.__originalMappings = null;
6999
+ Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
7000
+ get: function () {
7001
+ if (!this.__originalMappings) {
7002
+ this.__generatedMappings = [];
7003
+ this.__originalMappings = [];
7004
+ this._parseMappings(this._mappings, this.sourceRoot);
7005
+ }
7006
+
7007
+ return this.__originalMappings;
7008
+ }
7009
+ });
7010
+
6945
7011
  /**
6946
7012
  * Parse the mappings in a string in to a data structure which we can easily
6947
- * query (an ordered list in this._generatedMappings).
7013
+ * query (the ordered arrays in the `this.__generatedMappings` and
7014
+ * `this.__originalMappings` properties).
6948
7015
  */
6949
7016
  SourceMapConsumer.prototype._parseMappings =
6950
7017
  function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
@@ -7014,44 +7081,14 @@ define(function (require, exports, module) {
7014
7081
  }
7015
7082
  }
7016
7083
 
7017
- this._generatedMappings.push(mapping);
7084
+ this.__generatedMappings.push(mapping);
7018
7085
  if (typeof mapping.originalLine === 'number') {
7019
- this._originalMappings.push(mapping);
7086
+ this.__originalMappings.push(mapping);
7020
7087
  }
7021
7088
  }
7022
7089
  }
7023
7090
 
7024
- this._originalMappings.sort(this._compareOriginalPositions);
7025
- };
7026
-
7027
- /**
7028
- * Comparator between two mappings where the original positions are compared.
7029
- */
7030
- SourceMapConsumer.prototype._compareOriginalPositions =
7031
- function SourceMapConsumer_compareOriginalPositions(mappingA, mappingB) {
7032
- if (mappingA.source > mappingB.source) {
7033
- return 1;
7034
- }
7035
- else if (mappingA.source < mappingB.source) {
7036
- return -1;
7037
- }
7038
- else {
7039
- var cmp = mappingA.originalLine - mappingB.originalLine;
7040
- return cmp === 0
7041
- ? mappingA.originalColumn - mappingB.originalColumn
7042
- : cmp;
7043
- }
7044
- };
7045
-
7046
- /**
7047
- * Comparator between two mappings where the generated positions are compared.
7048
- */
7049
- SourceMapConsumer.prototype._compareGeneratedPositions =
7050
- function SourceMapConsumer_compareGeneratedPositions(mappingA, mappingB) {
7051
- var cmp = mappingA.generatedLine - mappingB.generatedLine;
7052
- return cmp === 0
7053
- ? mappingA.generatedColumn - mappingB.generatedColumn
7054
- : cmp;
7091
+ this.__originalMappings.sort(util.compareByOriginalPositions);
7055
7092
  };
7056
7093
 
7057
7094
  /**
@@ -7104,7 +7141,7 @@ define(function (require, exports, module) {
7104
7141
  this._generatedMappings,
7105
7142
  "generatedLine",
7106
7143
  "generatedColumn",
7107
- this._compareGeneratedPositions);
7144
+ util.compareByGeneratedPositions);
7108
7145
 
7109
7146
  if (mapping) {
7110
7147
  var source = util.getArg(mapping, 'source', null);
@@ -7198,7 +7235,7 @@ define(function (require, exports, module) {
7198
7235
  this._originalMappings,
7199
7236
  "originalLine",
7200
7237
  "originalColumn",
7201
- this._compareOriginalPositions);
7238
+ util.compareByOriginalPositions);
7202
7239
 
7203
7240
  if (mapping) {
7204
7241
  return {
@@ -7380,8 +7417,10 @@ define(function (require, exports, module) {
7380
7417
  }
7381
7418
 
7382
7419
  this._mappings.push({
7383
- generated: generated,
7384
- original: original,
7420
+ generatedLine: generated.line,
7421
+ generatedColumn: generated.column,
7422
+ originalLine: original != null && original.line,
7423
+ originalColumn: original != null && original.column,
7385
7424
  source: source,
7386
7425
  name: name
7387
7426
  });
@@ -7442,11 +7481,11 @@ define(function (require, exports, module) {
7442
7481
 
7443
7482
  // Find mappings for the "aSourceFile"
7444
7483
  this._mappings.forEach(function (mapping) {
7445
- if (mapping.source === aSourceFile && mapping.original) {
7484
+ if (mapping.source === aSourceFile && mapping.originalLine) {
7446
7485
  // Check if it can be mapped by the source map, then update the mapping.
7447
7486
  var original = aSourceMapConsumer.originalPositionFor({
7448
- line: mapping.original.line,
7449
- column: mapping.original.column
7487
+ line: mapping.originalLine,
7488
+ column: mapping.originalColumn
7450
7489
  });
7451
7490
  if (original.source !== null) {
7452
7491
  // Copy mapping
@@ -7455,8 +7494,8 @@ define(function (require, exports, module) {
7455
7494
  } else {
7456
7495
  mapping.source = original.source;
7457
7496
  }
7458
- mapping.original.line = original.line;
7459
- mapping.original.column = original.column;
7497
+ mapping.originalLine = original.line;
7498
+ mapping.originalColumn = original.column;
7460
7499
  if (original.name !== null && mapping.name !== null) {
7461
7500
  // Only use the identifier name if it's an identifier
7462
7501
  // in both SourceMaps
@@ -7520,28 +7559,15 @@ define(function (require, exports, module) {
7520
7559
  return;
7521
7560
  }
7522
7561
  else {
7523
- throw new Error('Invalid mapping.');
7562
+ throw new Error('Invalid mapping: ' + JSON.stringify({
7563
+ generated: aGenerated,
7564
+ source: aSource,
7565
+ orginal: aOriginal,
7566
+ name: aName
7567
+ }));
7524
7568
  }
7525
7569
  };
7526
7570
 
7527
- function cmpLocation(loc1, loc2) {
7528
- var cmp = (loc1 && loc1.line) - (loc2 && loc2.line);
7529
- return cmp ? cmp : (loc1 && loc1.column) - (loc2 && loc2.column);
7530
- }
7531
-
7532
- function strcmp(str1, str2) {
7533
- str1 = str1 || '';
7534
- str2 = str2 || '';
7535
- return (str1 > str2) - (str1 < str2);
7536
- }
7537
-
7538
- function cmpMapping(mappingA, mappingB) {
7539
- return cmpLocation(mappingA.generated, mappingB.generated) ||
7540
- cmpLocation(mappingA.original, mappingB.original) ||
7541
- strcmp(mappingA.source, mappingB.source) ||
7542
- strcmp(mappingA.name, mappingB.name);
7543
- }
7544
-
7545
7571
  /**
7546
7572
  * Serialize the accumulated mappings in to the stream of base 64 VLQs
7547
7573
  * specified by the source map format.
@@ -7562,44 +7588,44 @@ define(function (require, exports, module) {
7562
7588
  // via the ';' separators) will be all messed up. Note: it might be more
7563
7589
  // performant to maintain the sorting as we insert them, rather than as we
7564
7590
  // serialize them, but the big O is the same either way.
7565
- this._mappings.sort(cmpMapping);
7591
+ this._mappings.sort(util.compareByGeneratedPositions);
7566
7592
 
7567
7593
  for (var i = 0, len = this._mappings.length; i < len; i++) {
7568
7594
  mapping = this._mappings[i];
7569
7595
 
7570
- if (mapping.generated.line !== previousGeneratedLine) {
7596
+ if (mapping.generatedLine !== previousGeneratedLine) {
7571
7597
  previousGeneratedColumn = 0;
7572
- while (mapping.generated.line !== previousGeneratedLine) {
7598
+ while (mapping.generatedLine !== previousGeneratedLine) {
7573
7599
  result += ';';
7574
7600
  previousGeneratedLine++;
7575
7601
  }
7576
7602
  }
7577
7603
  else {
7578
7604
  if (i > 0) {
7579
- if (!cmpMapping(mapping, this._mappings[i - 1])) {
7605
+ if (!util.compareByGeneratedPositions(mapping, this._mappings[i - 1])) {
7580
7606
  continue;
7581
7607
  }
7582
7608
  result += ',';
7583
7609
  }
7584
7610
  }
7585
7611
 
7586
- result += base64VLQ.encode(mapping.generated.column
7612
+ result += base64VLQ.encode(mapping.generatedColumn
7587
7613
  - previousGeneratedColumn);
7588
- previousGeneratedColumn = mapping.generated.column;
7614
+ previousGeneratedColumn = mapping.generatedColumn;
7589
7615
 
7590
- if (mapping.source && mapping.original) {
7616
+ if (mapping.source) {
7591
7617
  result += base64VLQ.encode(this._sources.indexOf(mapping.source)
7592
7618
  - previousSource);
7593
7619
  previousSource = this._sources.indexOf(mapping.source);
7594
7620
 
7595
7621
  // lines are stored 0-based in SourceMap spec version 3
7596
- result += base64VLQ.encode(mapping.original.line - 1
7622
+ result += base64VLQ.encode(mapping.originalLine - 1
7597
7623
  - previousOriginalLine);
7598
- previousOriginalLine = mapping.original.line - 1;
7624
+ previousOriginalLine = mapping.originalLine - 1;
7599
7625
 
7600
- result += base64VLQ.encode(mapping.original.column
7626
+ result += base64VLQ.encode(mapping.originalColumn
7601
7627
  - previousOriginalColumn);
7602
- previousOriginalColumn = mapping.original.column;
7628
+ previousOriginalColumn = mapping.originalColumn;
7603
7629
 
7604
7630
  if (mapping.name) {
7605
7631
  result += base64VLQ.encode(this._names.indexOf(mapping.name)
@@ -7612,6 +7638,23 @@ define(function (require, exports, module) {
7612
7638
  return result;
7613
7639
  };
7614
7640
 
7641
+ SourceMapGenerator.prototype._generateSourcesContent =
7642
+ function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
7643
+ return aSources.map(function (source) {
7644
+ if (!this._sourcesContents) {
7645
+ return null;
7646
+ }
7647
+ if (aSourceRoot) {
7648
+ source = util.relative(aSourceRoot, source);
7649
+ }
7650
+ var key = util.toSetString(source);
7651
+ return Object.prototype.hasOwnProperty.call(this._sourcesContents,
7652
+ key)
7653
+ ? this._sourcesContents[key]
7654
+ : null;
7655
+ }, this);
7656
+ };
7657
+
7615
7658
  /**
7616
7659
  * Externalize the source map.
7617
7660
  */
@@ -7628,16 +7671,9 @@ define(function (require, exports, module) {
7628
7671
  map.sourceRoot = this._sourceRoot;
7629
7672
  }
7630
7673
  if (this._sourcesContents) {
7631
- map.sourcesContent = map.sources.map(function (source) {
7632
- if (map.sourceRoot) {
7633
- source = util.relative(map.sourceRoot, source);
7634
- }
7635
- return Object.prototype.hasOwnProperty.call(
7636
- this._sourcesContents, util.toSetString(source))
7637
- ? this._sourcesContents[util.toSetString(source)]
7638
- : null;
7639
- }, this);
7674
+ map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
7640
7675
  }
7676
+
7641
7677
  return map;
7642
7678
  };
7643
7679
 
@@ -7849,7 +7885,9 @@ define(function (require, exports, module) {
7849
7885
  * @param aFn The traversal function.
7850
7886
  */
7851
7887
  SourceNode.prototype.walk = function SourceNode_walk(aFn) {
7852
- this.children.forEach(function (chunk) {
7888
+ var chunk;
7889
+ for (var i = 0, len = this.children.length; i < len; i++) {
7890
+ chunk = this.children[i];
7853
7891
  if (chunk instanceof SourceNode) {
7854
7892
  chunk.walk(aFn);
7855
7893
  }
@@ -7861,7 +7899,7 @@ define(function (require, exports, module) {
7861
7899
  name: this.name });
7862
7900
  }
7863
7901
  }
7864
- }, this);
7902
+ }
7865
7903
  };
7866
7904
 
7867
7905
  /**
@@ -7927,14 +7965,16 @@ define(function (require, exports, module) {
7927
7965
  */
7928
7966
  SourceNode.prototype.walkSourceContents =
7929
7967
  function SourceNode_walkSourceContents(aFn) {
7930
- this.children.forEach(function (chunk) {
7931
- if (chunk instanceof SourceNode) {
7932
- chunk.walkSourceContents(aFn);
7968
+ for (var i = 0, len = this.children.length; i < len; i++) {
7969
+ if (this.children[i] instanceof SourceNode) {
7970
+ this.children[i].walkSourceContents(aFn);
7933
7971
  }
7934
- }, this);
7935
- Object.keys(this.sourceContents).forEach(function (sourceFileKey) {
7936
- aFn(util.fromSetString(sourceFileKey), this.sourceContents[sourceFileKey]);
7937
- }, this);
7972
+ }
7973
+
7974
+ var sources = Object.keys(this.sourceContents);
7975
+ for (var i = 0, len = sources.length; i < len; i++) {
7976
+ aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
7977
+ }
7938
7978
  };
7939
7979
 
7940
7980
  /**
@@ -7961,23 +8001,36 @@ define(function (require, exports, module) {
7961
8001
  };
7962
8002
  var map = new SourceMapGenerator(aArgs);
7963
8003
  var sourceMappingActive = false;
8004
+ var lastOriginalSource = null;
8005
+ var lastOriginalLine = null;
8006
+ var lastOriginalColumn = null;
8007
+ var lastOriginalName = null;
7964
8008
  this.walk(function (chunk, original) {
7965
8009
  generated.code += chunk;
7966
8010
  if (original.source !== null
7967
8011
  && original.line !== null
7968
8012
  && original.column !== null) {
7969
- map.addMapping({
7970
- source: original.source,
7971
- original: {
7972
- line: original.line,
7973
- column: original.column
7974
- },
7975
- generated: {
7976
- line: generated.line,
7977
- column: generated.column
7978
- },
7979
- name: original.name
7980
- });
8013
+ if(lastOriginalSource !== original.source
8014
+ || lastOriginalLine !== original.line
8015
+ || lastOriginalColumn !== original.column
8016
+ || lastOriginalName !== original.name) {
8017
+ map.addMapping({
8018
+ source: original.source,
8019
+ original: {
8020
+ line: original.line,
8021
+ column: original.column
8022
+ },
8023
+ generated: {
8024
+ line: generated.line,
8025
+ column: generated.column
8026
+ },
8027
+ name: original.name
8028
+ });
8029
+ }
8030
+ lastOriginalSource = original.source;
8031
+ lastOriginalLine = original.line;
8032
+ lastOriginalColumn = original.column;
8033
+ lastOriginalName = original.name;
7981
8034
  sourceMappingActive = true;
7982
8035
  } else if (sourceMappingActive) {
7983
8036
  map.addMapping({
@@ -7986,6 +8039,7 @@ define(function (require, exports, module) {
7986
8039
  column: generated.column
7987
8040
  }
7988
8041
  });
8042
+ lastOriginalSource = null;
7989
8043
  sourceMappingActive = false;
7990
8044
  }
7991
8045
  chunk.split('').forEach(function (ch) {
@@ -8042,6 +8096,7 @@ define(function (require, exports, module) {
8042
8096
  exports.getArg = getArg;
8043
8097
 
8044
8098
  var urlRegexp = /([\w+\-.]+):\/\/((\w+:\w+)@)?([\w.]+)?(:(\d+))?(\S+)?/;
8099
+ var dataUrlRegexp = /^data:.+\,.+/;
8045
8100
 
8046
8101
  function urlParse(aUrl) {
8047
8102
  var match = aUrl.match(urlRegexp);
@@ -8079,7 +8134,7 @@ define(function (require, exports, module) {
8079
8134
  function join(aRoot, aPath) {
8080
8135
  var url;
8081
8136
 
8082
- if (aPath.match(urlRegexp)) {
8137
+ if (aPath.match(urlRegexp) || aPath.match(dataUrlRegexp)) {
8083
8138
  return aPath;
8084
8139
  }
8085
8140
 
@@ -8125,11 +8180,98 @@ define(function (require, exports, module) {
8125
8180
  }
8126
8181
  exports.relative = relative;
8127
8182
 
8183
+ function strcmp(aStr1, aStr2) {
8184
+ var s1 = aStr1 || "";
8185
+ var s2 = aStr2 || "";
8186
+ return (s1 > s2) - (s1 < s2);
8187
+ }
8188
+
8189
+ /**
8190
+ * Comparator between two mappings where the original positions are compared.
8191
+ *
8192
+ * Optionally pass in `true` as `onlyCompareGenerated` to consider two
8193
+ * mappings with the same original source/line/column, but different generated
8194
+ * line and column the same. Useful when searching for a mapping with a
8195
+ * stubbed out mapping.
8196
+ */
8197
+ function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
8198
+ var cmp;
8199
+
8200
+ cmp = strcmp(mappingA.source, mappingB.source);
8201
+ if (cmp) {
8202
+ return cmp;
8203
+ }
8204
+
8205
+ cmp = mappingA.originalLine - mappingB.originalLine;
8206
+ if (cmp) {
8207
+ return cmp;
8208
+ }
8209
+
8210
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
8211
+ if (cmp || onlyCompareOriginal) {
8212
+ return cmp;
8213
+ }
8214
+
8215
+ cmp = strcmp(mappingA.name, mappingB.name);
8216
+ if (cmp) {
8217
+ return cmp;
8218
+ }
8219
+
8220
+ cmp = mappingA.generatedLine - mappingB.generatedLine;
8221
+ if (cmp) {
8222
+ return cmp;
8223
+ }
8224
+
8225
+ return mappingA.generatedColumn - mappingB.generatedColumn;
8226
+ };
8227
+ exports.compareByOriginalPositions = compareByOriginalPositions;
8228
+
8229
+ /**
8230
+ * Comparator between two mappings where the generated positions are
8231
+ * compared.
8232
+ *
8233
+ * Optionally pass in `true` as `onlyCompareGenerated` to consider two
8234
+ * mappings with the same generated line and column, but different
8235
+ * source/name/original line and column the same. Useful when searching for a
8236
+ * mapping with a stubbed out mapping.
8237
+ */
8238
+ function compareByGeneratedPositions(mappingA, mappingB, onlyCompareGenerated) {
8239
+ var cmp;
8240
+
8241
+ cmp = mappingA.generatedLine - mappingB.generatedLine;
8242
+ if (cmp) {
8243
+ return cmp;
8244
+ }
8245
+
8246
+ cmp = mappingA.generatedColumn - mappingB.generatedColumn;
8247
+ if (cmp || onlyCompareGenerated) {
8248
+ return cmp;
8249
+ }
8250
+
8251
+ cmp = strcmp(mappingA.source, mappingB.source);
8252
+ if (cmp) {
8253
+ return cmp;
8254
+ }
8255
+
8256
+ cmp = mappingA.originalLine - mappingB.originalLine;
8257
+ if (cmp) {
8258
+ return cmp;
8259
+ }
8260
+
8261
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
8262
+ if (cmp) {
8263
+ return cmp;
8264
+ }
8265
+
8266
+ return strcmp(mappingA.name, mappingB.name);
8267
+ };
8268
+ exports.compareByGeneratedPositions = compareByGeneratedPositions;
8269
+
8128
8270
  });
8129
8271
 
8130
8272
  },{"amdefine":14}],14:[function(require,module,exports){
8131
- (function(process,__filename){/** vim: et:ts=4:sw=4:sts=4
8132
- * @license amdefine 0.0.5 Copyright (c) 2011, The Dojo Foundation All Rights Reserved.
8273
+ var process=require("__browserify_process"),__filename="/../node_modules/source-map/node_modules/amdefine/amdefine.js";/** vim: et:ts=4:sw=4:sts=4
8274
+ * @license amdefine 0.1.0 Copyright (c) 2011, The Dojo Foundation All Rights Reserved.
8133
8275
  * Available via the MIT or new BSD license.
8134
8276
  * see: http://github.com/jrburke/amdefine for details
8135
8277
  */
@@ -8138,22 +8280,22 @@ define(function (require, exports, module) {
8138
8280
  /*global module, process */
8139
8281
  'use strict';
8140
8282
 
8141
- var path = require('path');
8142
-
8143
8283
  /**
8144
8284
  * Creates a define for node.
8145
8285
  * @param {Object} module the "module" object that is defined by Node for the
8146
8286
  * current module.
8147
- * @param {Function} [require]. Node's require function for the current module.
8287
+ * @param {Function} [requireFn]. Node's require function for the current module.
8148
8288
  * It only needs to be passed in Node versions before 0.5, when module.require
8149
8289
  * did not exist.
8150
8290
  * @returns {Function} a define function that is usable for the current node
8151
8291
  * module.
8152
8292
  */
8153
- function amdefine(module, require) {
8293
+ function amdefine(module, requireFn) {
8294
+ 'use strict';
8154
8295
  var defineCache = {},
8155
8296
  loaderCache = {},
8156
8297
  alreadyCalled = false,
8298
+ path = require('path'),
8157
8299
  makeRequire, stringRequire;
8158
8300
 
8159
8301
  /**
@@ -8268,7 +8410,7 @@ function amdefine(module, require) {
8268
8410
  };
8269
8411
 
8270
8412
  //Favor explicit value, passed in if the module wants to support Node 0.4.
8271
- require = require || function req() {
8413
+ requireFn = requireFn || function req() {
8272
8414
  return module.require.apply(module, arguments);
8273
8415
  };
8274
8416
 
@@ -8282,7 +8424,7 @@ function amdefine(module, require) {
8282
8424
  uri: __filename,
8283
8425
  exports: e
8284
8426
  };
8285
- r = makeRequire(require, e, m, id);
8427
+ r = makeRequire(requireFn, e, m, id);
8286
8428
  } else {
8287
8429
  //Only support one define call per file
8288
8430
  if (alreadyCalled) {
@@ -8295,7 +8437,7 @@ function amdefine(module, require) {
8295
8437
  //the exports in here is amdefine exports.
8296
8438
  e = module.exports;
8297
8439
  m = module;
8298
- r = makeRequire(require, e, m, module.id);
8440
+ r = makeRequire(requireFn, e, m, module.id);
8299
8441
  }
8300
8442
 
8301
8443
  //If there are dependencies, they are strings, so need
@@ -8308,7 +8450,7 @@ function amdefine(module, require) {
8308
8450
 
8309
8451
  //Call the factory with the right dependencies.
8310
8452
  if (typeof factory === 'function') {
8311
- result = factory.apply(module.exports, deps);
8453
+ result = factory.apply(m.exports, deps);
8312
8454
  } else {
8313
8455
  result = factory;
8314
8456
  }
@@ -8428,7 +8570,6 @@ function amdefine(module, require) {
8428
8570
 
8429
8571
  module.exports = amdefine;
8430
8572
 
8431
- })(require("__browserify_process"),"/../node_modules/source-map/node_modules/amdefine/amdefine.js")
8432
8573
  },{"__browserify_process":3,"path":2}],15:[function(require,module,exports){
8433
8574
  /**
8434
8575
  * Copyright 2013 Facebook, Inc.
@@ -8615,7 +8756,7 @@ exports.parse = parse;
8615
8756
  exports.parseAsObject = parseAsObject;
8616
8757
 
8617
8758
  },{}],17:[function(require,module,exports){
8618
- (function(){/**
8759
+ /**
8619
8760
  * Copyright 2013 Facebook, Inc.
8620
8761
  *
8621
8762
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -8757,9 +8898,8 @@ function transform(visitors, source, options) {
8757
8898
 
8758
8899
  exports.transform = transform;
8759
8900
 
8760
- })()
8761
8901
  },{"./utils":18,"esprima":4,"source-map":5}],18:[function(require,module,exports){
8762
- (function(){/**
8902
+ /**
8763
8903
  * Copyright 2013 Facebook, Inc.
8764
8904
  *
8765
8905
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -9092,9 +9232,8 @@ exports.updateState = updateState;
9092
9232
  exports.createState = createState;
9093
9233
  exports.getDocblock = getDocblock;
9094
9234
 
9095
- })()
9096
9235
  },{"./docblock":16}],19:[function(require,module,exports){
9097
- (function(){/**
9236
+ /**
9098
9237
  * Copyright 2013 Facebook, Inc.
9099
9238
  *
9100
9239
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -9587,9 +9726,8 @@ exports.visitClassExpression = visitClassExpression;
9587
9726
  exports.visitSuperCall = visitSuperCall;
9588
9727
  exports.visitPrivateProperty = visitPrivateProperty;
9589
9728
 
9590
- })()
9591
9729
  },{"../lib/docblock":16,"../lib/utils":18,"base62":1,"esprima":4}],20:[function(require,module,exports){
9592
- (function(){/**
9730
+ /**
9593
9731
  * Copyright 2013 Facebook, Inc.
9594
9732
  *
9595
9733
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -9778,9 +9916,8 @@ visitReactTag.test = function(object, path, state) {
9778
9916
 
9779
9917
  exports.visitReactTag = visitReactTag;
9780
9918
 
9781
- })()
9782
9919
  },{"../lib/utils":18,"./xjs":22,"esprima":4}],21:[function(require,module,exports){
9783
- (function(){/**
9920
+ /**
9784
9921
  * Copyright 2013 Facebook, Inc.
9785
9922
  *
9786
9923
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -9844,9 +9981,8 @@ visitReactDisplayName.test = function(object, path, state) {
9844
9981
 
9845
9982
  exports.visitReactDisplayName = visitReactDisplayName;
9846
9983
 
9847
- })()
9848
9984
  },{"../lib/utils":18,"esprima":4}],22:[function(require,module,exports){
9849
- (function(){/**
9985
+ /**
9850
9986
  * Copyright 2013 Facebook, Inc.
9851
9987
  *
9852
9988
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -10137,9 +10273,8 @@ exports.renderXJSExpressionContainer = renderXJSExpressionContainer;
10137
10273
  exports.renderXJSLiteral = renderXJSLiteral;
10138
10274
  exports.quoteAttrName = quoteAttrName;
10139
10275
 
10140
- })()
10141
10276
  },{"../lib/utils":18,"esprima":4}],23:[function(require,module,exports){
10142
- (function(){/*global exports:true*/
10277
+ /*global exports:true*/
10143
10278
  var classes = require('./transforms/classes');
10144
10279
  var react = require('./transforms/react');
10145
10280
  var reactDisplayName = require('./transforms/reactDisplayName');
@@ -10191,7 +10326,6 @@ function getVisitorsList(excludes) {
10191
10326
  exports.getVisitorsList = getVisitorsList;
10192
10327
  exports.transformVisitors = transformVisitors;
10193
10328
 
10194
- })()
10195
10329
  },{"./transforms/classes":19,"./transforms/react":20,"./transforms/reactDisplayName":21}]},{},[15])(15)
10196
10330
  });
10197
10331
  ;