vite 2.8.0-beta.3 → 2.8.0-beta.4

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.

Potentially problematic release.


This version of vite might be problematic. Click here for more details.

@@ -5358,7 +5358,7 @@ var toRegexRange_1 = toRegexRange$1;
5358
5358
  * Licensed under the MIT License.
5359
5359
  */
5360
5360
 
5361
- const util$9 = require$$0__default$1;
5361
+ const util$6 = require$$0__default$1;
5362
5362
  const toRegexRange = toRegexRange_1;
5363
5363
 
5364
5364
  const isObject$1 = val => val !== null && typeof val === 'object' && !Array.isArray(val);
@@ -5463,7 +5463,7 @@ const toRegex = (start, end, options) => {
5463
5463
  };
5464
5464
 
5465
5465
  const rangeError = (...args) => {
5466
- return new RangeError('Invalid range arguments: ' + util$9.inspect(...args));
5466
+ return new RangeError('Invalid range arguments: ' + util$6.inspect(...args));
5467
5467
  };
5468
5468
 
5469
5469
  const invalidRange = (start, end, options) => {
@@ -8376,7 +8376,7 @@ var picomatch_1 = picomatch$4;
8376
8376
 
8377
8377
  var picomatch$3 = picomatch_1;
8378
8378
 
8379
- const util$8 = require$$0__default$1;
8379
+ const util$5 = require$$0__default$1;
8380
8380
  const braces$1 = braces_1;
8381
8381
  const picomatch$2 = picomatch$3;
8382
8382
  const utils$b = utils$f;
@@ -8563,7 +8563,7 @@ micromatch$1.not = (list, patterns, options = {}) => {
8563
8563
 
8564
8564
  micromatch$1.contains = (str, pattern, options) => {
8565
8565
  if (typeof str !== 'string') {
8566
- throw new TypeError(`Expected a string: "${util$8.inspect(str)}"`);
8566
+ throw new TypeError(`Expected a string: "${util$5.inspect(str)}"`);
8567
8567
  }
8568
8568
 
8569
8569
  if (Array.isArray(pattern)) {
@@ -8709,7 +8709,7 @@ micromatch$1.every = (list, patterns, options) => {
8709
8709
 
8710
8710
  micromatch$1.all = (str, patterns, options) => {
8711
8711
  if (typeof str !== 'string') {
8712
- throw new TypeError(`Expected a string: "${util$8.inspect(str)}"`);
8712
+ throw new TypeError(`Expected a string: "${util$5.inspect(str)}"`);
8713
8713
  }
8714
8714
 
8715
8715
  return [].concat(patterns).every(p => picomatch$2(p, options)(str));
@@ -18679,6 +18679,10 @@ function cssPostPlugin(config) {
18679
18679
  return null;
18680
18680
  },
18681
18681
  async generateBundle(opts, bundle) {
18682
+ // @ts-ignore asset emits are skipped in legacy bundle
18683
+ if (opts.__vite_skip_asset_emit__) {
18684
+ return;
18685
+ }
18682
18686
  // remove empty css chunks and their imports
18683
18687
  if (pureCssChunks.size) {
18684
18688
  const emptyChunkFiles = [...pureCssChunks]
@@ -18853,7 +18857,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
18853
18857
  replacer: urlReplacer
18854
18858
  }));
18855
18859
  if (isModule) {
18856
- postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-84e12b4e.js'); }).then(function (n) { return n.index; })).default({
18860
+ postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-4ef300ce.js'); }).then(function (n) { return n.index; })).default({
18857
18861
  ...modulesOptions,
18858
18862
  getJSON(cssFileName, _modules, outputFileName) {
18859
18863
  modules = _modules;
@@ -19313,7 +19317,7 @@ var unicode = {
19313
19317
  ID_Continue: ID_Continue
19314
19318
  };
19315
19319
 
19316
- var util$7 = {
19320
+ var util$4 = {
19317
19321
  isSpaceSeparator (c) {
19318
19322
  return typeof c === 'string' && unicode.Space_Separator.test(c)
19319
19323
  },
@@ -19480,7 +19484,7 @@ const lexStates = {
19480
19484
  return newToken('eof')
19481
19485
  }
19482
19486
 
19483
- if (util$7.isSpaceSeparator(c)) {
19487
+ if (util$4.isSpaceSeparator(c)) {
19484
19488
  read();
19485
19489
  return
19486
19490
  }
@@ -19647,7 +19651,7 @@ const lexStates = {
19647
19651
  break
19648
19652
 
19649
19653
  default:
19650
- if (!util$7.isIdStartChar(u)) {
19654
+ if (!util$4.isIdStartChar(u)) {
19651
19655
  throw invalidIdentifier()
19652
19656
  }
19653
19657
 
@@ -19673,7 +19677,7 @@ const lexStates = {
19673
19677
  return
19674
19678
  }
19675
19679
 
19676
- if (util$7.isIdContinueChar(c)) {
19680
+ if (util$4.isIdContinueChar(c)) {
19677
19681
  buffer += read();
19678
19682
  return
19679
19683
  }
@@ -19696,7 +19700,7 @@ const lexStates = {
19696
19700
  break
19697
19701
 
19698
19702
  default:
19699
- if (!util$7.isIdContinueChar(u)) {
19703
+ if (!util$4.isIdContinueChar(u)) {
19700
19704
  throw invalidIdentifier()
19701
19705
  }
19702
19706
 
@@ -19783,7 +19787,7 @@ const lexStates = {
19783
19787
  return
19784
19788
  }
19785
19789
 
19786
- if (util$7.isDigit(c)) {
19790
+ if (util$4.isDigit(c)) {
19787
19791
  buffer += read();
19788
19792
  return
19789
19793
  }
@@ -19792,7 +19796,7 @@ const lexStates = {
19792
19796
  },
19793
19797
 
19794
19798
  decimalPointLeading () {
19795
- if (util$7.isDigit(c)) {
19799
+ if (util$4.isDigit(c)) {
19796
19800
  buffer += read();
19797
19801
  lexState = 'decimalFraction';
19798
19802
  return
@@ -19810,7 +19814,7 @@ const lexStates = {
19810
19814
  return
19811
19815
  }
19812
19816
 
19813
- if (util$7.isDigit(c)) {
19817
+ if (util$4.isDigit(c)) {
19814
19818
  buffer += read();
19815
19819
  lexState = 'decimalFraction';
19816
19820
  return
@@ -19828,7 +19832,7 @@ const lexStates = {
19828
19832
  return
19829
19833
  }
19830
19834
 
19831
- if (util$7.isDigit(c)) {
19835
+ if (util$4.isDigit(c)) {
19832
19836
  buffer += read();
19833
19837
  return
19834
19838
  }
@@ -19845,7 +19849,7 @@ const lexStates = {
19845
19849
  return
19846
19850
  }
19847
19851
 
19848
- if (util$7.isDigit(c)) {
19852
+ if (util$4.isDigit(c)) {
19849
19853
  buffer += read();
19850
19854
  lexState = 'decimalExponentInteger';
19851
19855
  return
@@ -19855,7 +19859,7 @@ const lexStates = {
19855
19859
  },
19856
19860
 
19857
19861
  decimalExponentSign () {
19858
- if (util$7.isDigit(c)) {
19862
+ if (util$4.isDigit(c)) {
19859
19863
  buffer += read();
19860
19864
  lexState = 'decimalExponentInteger';
19861
19865
  return
@@ -19865,7 +19869,7 @@ const lexStates = {
19865
19869
  },
19866
19870
 
19867
19871
  decimalExponentInteger () {
19868
- if (util$7.isDigit(c)) {
19872
+ if (util$4.isDigit(c)) {
19869
19873
  buffer += read();
19870
19874
  return
19871
19875
  }
@@ -19874,7 +19878,7 @@ const lexStates = {
19874
19878
  },
19875
19879
 
19876
19880
  hexadecimal () {
19877
- if (util$7.isHexDigit(c)) {
19881
+ if (util$4.isHexDigit(c)) {
19878
19882
  buffer += read();
19879
19883
  lexState = 'hexadecimalInteger';
19880
19884
  return
@@ -19884,7 +19888,7 @@ const lexStates = {
19884
19888
  },
19885
19889
 
19886
19890
  hexadecimalInteger () {
19887
- if (util$7.isHexDigit(c)) {
19891
+ if (util$4.isHexDigit(c)) {
19888
19892
  buffer += read();
19889
19893
  return
19890
19894
  }
@@ -19970,7 +19974,7 @@ const lexStates = {
19970
19974
  return
19971
19975
  }
19972
19976
 
19973
- if (util$7.isIdStartChar(c)) {
19977
+ if (util$4.isIdStartChar(c)) {
19974
19978
  buffer += read();
19975
19979
  lexState = 'identifierName';
19976
19980
  return
@@ -20080,7 +20084,7 @@ function escape$1 () {
20080
20084
 
20081
20085
  case '0':
20082
20086
  read();
20083
- if (util$7.isDigit(peek())) {
20087
+ if (util$4.isDigit(peek())) {
20084
20088
  throw invalidChar(read())
20085
20089
  }
20086
20090
 
@@ -20130,14 +20134,14 @@ function hexEscape () {
20130
20134
  let buffer = '';
20131
20135
  let c = peek();
20132
20136
 
20133
- if (!util$7.isHexDigit(c)) {
20137
+ if (!util$4.isHexDigit(c)) {
20134
20138
  throw invalidChar(read())
20135
20139
  }
20136
20140
 
20137
20141
  buffer += read();
20138
20142
 
20139
20143
  c = peek();
20140
- if (!util$7.isHexDigit(c)) {
20144
+ if (!util$4.isHexDigit(c)) {
20141
20145
  throw invalidChar(read())
20142
20146
  }
20143
20147
 
@@ -20152,7 +20156,7 @@ function unicodeEscape () {
20152
20156
 
20153
20157
  while (count-- > 0) {
20154
20158
  const c = peek();
20155
- if (!util$7.isHexDigit(c)) {
20159
+ if (!util$4.isHexDigit(c)) {
20156
20160
  throw invalidChar(read())
20157
20161
  }
20158
20162
 
@@ -20567,7 +20571,7 @@ var stringify = function stringify (value, replacer, space) {
20567
20571
  continue
20568
20572
 
20569
20573
  case '\0':
20570
- if (util$7.isDigit(value[i + 1])) {
20574
+ if (util$4.isDigit(value[i + 1])) {
20571
20575
  product += '\\x00';
20572
20576
  continue
20573
20577
  }
@@ -20644,12 +20648,12 @@ var stringify = function stringify (value, replacer, space) {
20644
20648
  }
20645
20649
 
20646
20650
  const firstChar = String.fromCodePoint(key.codePointAt(0));
20647
- if (!util$7.isIdStartChar(firstChar)) {
20651
+ if (!util$4.isIdStartChar(firstChar)) {
20648
20652
  return quoteString(key)
20649
20653
  }
20650
20654
 
20651
20655
  for (let i = firstChar.length; i < key.length; i++) {
20652
- if (!util$7.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
20656
+ if (!util$4.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
20653
20657
  return quoteString(key)
20654
20658
  }
20655
20659
  }
@@ -21276,7 +21280,7 @@ const assetAttrsConfig = {
21276
21280
  const isAsyncScriptMap = new WeakMap();
21277
21281
  async function traverseHtml(html, filePath, visitor) {
21278
21282
  // lazy load compiler
21279
- const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-6f0b746c.js'); }).then(function (n) { return n.compilerDom_cjs; });
21283
+ const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-2451c479.js'); }).then(function (n) { return n.compilerDom_cjs; });
21280
21284
  // @vue/compiler-core doesn't like lowercase doctypes
21281
21285
  html = html.replace(/<!doctype\s/i, '<!DOCTYPE ');
21282
21286
  try {
@@ -22484,7 +22488,7 @@ const buildEsbuildPlugin = (config) => {
22484
22488
  const minify = config.build.minify === 'esbuild' &&
22485
22489
  // Do not minify ES lib output since that would remove pure annotations
22486
22490
  // and break tree-shaking
22487
- // https://github.com/vuejs/vue-next/issues/2860#issuecomment-926882793
22491
+ // https://github.com/vuejs/core/issues/2860#issuecomment-926882793
22488
22492
  !(config.build.lib && opts.format === 'es');
22489
22493
  if ((!target || target === 'esnext') && !minify) {
22490
22494
  return null;
@@ -24758,10 +24762,10 @@ if (typeof Object.create === 'function') {
24758
24762
  }
24759
24763
 
24760
24764
  try {
24761
- var util$6 = require('util');
24765
+ var util$3 = require('util');
24762
24766
  /* istanbul ignore next */
24763
- if (typeof util$6.inherits !== 'function') throw '';
24764
- inherits$1.exports = util$6.inherits;
24767
+ if (typeof util$3.inherits !== 'function') throw '';
24768
+ inherits$1.exports = util$3.inherits;
24765
24769
  } catch (e) {
24766
24770
  /* istanbul ignore next */
24767
24771
  inherits$1.exports = inherits_browser.exports;
@@ -35563,224 +35567,7 @@ function errorMiddleware(server, allowNext = false) {
35563
35567
  };
35564
35568
  }
35565
35569
 
35566
- var sourceMapGenerator = {};
35567
-
35568
- var base64Vlq = {};
35569
-
35570
- var base64$1 = {};
35571
-
35572
- /* -*- Mode: js; js-indent-level: 2; -*- */
35573
-
35574
- /*
35575
- * Copyright 2011 Mozilla Foundation and contributors
35576
- * Licensed under the New BSD license. See LICENSE or:
35577
- * http://opensource.org/licenses/BSD-3-Clause
35578
- */
35579
-
35580
- var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
35581
-
35582
- /**
35583
- * Encode an integer in the range of 0 to 63 to a single base 64 digit.
35584
- */
35585
- base64$1.encode = function (number) {
35586
- if (0 <= number && number < intToCharMap.length) {
35587
- return intToCharMap[number];
35588
- }
35589
- throw new TypeError("Must be between 0 and 63: " + number);
35590
- };
35591
-
35592
- /**
35593
- * Decode a single base 64 character code digit to an integer. Returns -1 on
35594
- * failure.
35595
- */
35596
- base64$1.decode = function (charCode) {
35597
- var bigA = 65; // 'A'
35598
- var bigZ = 90; // 'Z'
35599
-
35600
- var littleA = 97; // 'a'
35601
- var littleZ = 122; // 'z'
35602
-
35603
- var zero = 48; // '0'
35604
- var nine = 57; // '9'
35605
-
35606
- var plus = 43; // '+'
35607
- var slash = 47; // '/'
35608
-
35609
- var littleOffset = 26;
35610
- var numberOffset = 52;
35611
-
35612
- // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
35613
- if (bigA <= charCode && charCode <= bigZ) {
35614
- return (charCode - bigA);
35615
- }
35616
-
35617
- // 26 - 51: abcdefghijklmnopqrstuvwxyz
35618
- if (littleA <= charCode && charCode <= littleZ) {
35619
- return (charCode - littleA + littleOffset);
35620
- }
35621
-
35622
- // 52 - 61: 0123456789
35623
- if (zero <= charCode && charCode <= nine) {
35624
- return (charCode - zero + numberOffset);
35625
- }
35626
-
35627
- // 62: +
35628
- if (charCode == plus) {
35629
- return 62;
35630
- }
35631
-
35632
- // 63: /
35633
- if (charCode == slash) {
35634
- return 63;
35635
- }
35636
-
35637
- // Invalid base64 digit.
35638
- return -1;
35639
- };
35640
-
35641
- /* -*- Mode: js; js-indent-level: 2; -*- */
35642
-
35643
- /*
35644
- * Copyright 2011 Mozilla Foundation and contributors
35645
- * Licensed under the New BSD license. See LICENSE or:
35646
- * http://opensource.org/licenses/BSD-3-Clause
35647
- *
35648
- * Based on the Base 64 VLQ implementation in Closure Compiler:
35649
- * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
35650
- *
35651
- * Copyright 2011 The Closure Compiler Authors. All rights reserved.
35652
- * Redistribution and use in source and binary forms, with or without
35653
- * modification, are permitted provided that the following conditions are
35654
- * met:
35655
- *
35656
- * * Redistributions of source code must retain the above copyright
35657
- * notice, this list of conditions and the following disclaimer.
35658
- * * Redistributions in binary form must reproduce the above
35659
- * copyright notice, this list of conditions and the following
35660
- * disclaimer in the documentation and/or other materials provided
35661
- * with the distribution.
35662
- * * Neither the name of Google Inc. nor the names of its
35663
- * contributors may be used to endorse or promote products derived
35664
- * from this software without specific prior written permission.
35665
- *
35666
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
35667
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
35668
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
35669
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35670
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35671
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35672
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35673
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35674
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35675
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35676
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35677
- */
35678
-
35679
- var base64 = base64$1;
35680
-
35681
- // A single base 64 digit can contain 6 bits of data. For the base 64 variable
35682
- // length quantities we use in the source map spec, the first bit is the sign,
35683
- // the next four bits are the actual value, and the 6th bit is the
35684
- // continuation bit. The continuation bit tells us whether there are more
35685
- // digits in this value following this digit.
35686
- //
35687
- // Continuation
35688
- // | Sign
35689
- // | |
35690
- // V V
35691
- // 101011
35692
-
35693
- var VLQ_BASE_SHIFT = 5;
35694
-
35695
- // binary: 100000
35696
- var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
35697
-
35698
- // binary: 011111
35699
- var VLQ_BASE_MASK = VLQ_BASE - 1;
35700
-
35701
- // binary: 100000
35702
- var VLQ_CONTINUATION_BIT = VLQ_BASE;
35703
-
35704
- /**
35705
- * Converts from a two-complement value to a value where the sign bit is
35706
- * placed in the least significant bit. For example, as decimals:
35707
- * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
35708
- * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
35709
- */
35710
- function toVLQSigned(aValue) {
35711
- return aValue < 0
35712
- ? ((-aValue) << 1) + 1
35713
- : (aValue << 1) + 0;
35714
- }
35715
-
35716
- /**
35717
- * Converts to a two-complement value from a value where the sign bit is
35718
- * placed in the least significant bit. For example, as decimals:
35719
- * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
35720
- * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
35721
- */
35722
- function fromVLQSigned(aValue) {
35723
- var isNegative = (aValue & 1) === 1;
35724
- var shifted = aValue >> 1;
35725
- return isNegative
35726
- ? -shifted
35727
- : shifted;
35728
- }
35729
-
35730
- /**
35731
- * Returns the base 64 VLQ encoded value.
35732
- */
35733
- base64Vlq.encode = function base64VLQ_encode(aValue) {
35734
- var encoded = "";
35735
- var digit;
35736
-
35737
- var vlq = toVLQSigned(aValue);
35738
-
35739
- do {
35740
- digit = vlq & VLQ_BASE_MASK;
35741
- vlq >>>= VLQ_BASE_SHIFT;
35742
- if (vlq > 0) {
35743
- // There are still more digits in this value, so we must make sure the
35744
- // continuation bit is marked.
35745
- digit |= VLQ_CONTINUATION_BIT;
35746
- }
35747
- encoded += base64.encode(digit);
35748
- } while (vlq > 0);
35749
-
35750
- return encoded;
35751
- };
35752
-
35753
- /**
35754
- * Decodes the next base 64 VLQ value from the given string and returns the
35755
- * value and the rest of the string via the out parameter.
35756
- */
35757
- base64Vlq.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
35758
- var strLen = aStr.length;
35759
- var result = 0;
35760
- var shift = 0;
35761
- var continuation, digit;
35762
-
35763
- do {
35764
- if (aIndex >= strLen) {
35765
- throw new Error("Expected more digits in base 64 VLQ value.");
35766
- }
35767
-
35768
- digit = base64.decode(aStr.charCodeAt(aIndex++));
35769
- if (digit === -1) {
35770
- throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
35771
- }
35772
-
35773
- continuation = !!(digit & VLQ_CONTINUATION_BIT);
35774
- digit &= VLQ_BASE_MASK;
35775
- result = result + (digit << shift);
35776
- shift += VLQ_BASE_SHIFT;
35777
- } while (continuation);
35778
-
35779
- aOutParam.value = fromVLQSigned(result);
35780
- aOutParam.rest = aIndex;
35781
- };
35782
-
35783
- var util$5 = {};
35570
+ var util$2 = {};
35784
35571
 
35785
35572
  /* -*- Mode: js; js-indent-level: 2; -*- */
35786
35573
 
@@ -35852,6 +35639,43 @@ function urlGenerate(aParsedUrl) {
35852
35639
  }
35853
35640
  exports.urlGenerate = urlGenerate;
35854
35641
 
35642
+ var MAX_CACHED_INPUTS = 32;
35643
+
35644
+ /**
35645
+ * Takes some function `f(input) -> result` and returns a memoized version of
35646
+ * `f`.
35647
+ *
35648
+ * We keep at most `MAX_CACHED_INPUTS` memoized results of `f` alive. The
35649
+ * memoization is a dumb-simple, linear least-recently-used cache.
35650
+ */
35651
+ function lruMemoize(f) {
35652
+ var cache = [];
35653
+
35654
+ return function(input) {
35655
+ for (var i = 0; i < cache.length; i++) {
35656
+ if (cache[i].input === input) {
35657
+ var temp = cache[0];
35658
+ cache[0] = cache[i];
35659
+ cache[i] = temp;
35660
+ return cache[0].result;
35661
+ }
35662
+ }
35663
+
35664
+ var result = f(input);
35665
+
35666
+ cache.unshift({
35667
+ input,
35668
+ result,
35669
+ });
35670
+
35671
+ if (cache.length > MAX_CACHED_INPUTS) {
35672
+ cache.pop();
35673
+ }
35674
+
35675
+ return result;
35676
+ };
35677
+ }
35678
+
35855
35679
  /**
35856
35680
  * Normalizes a path, or the path portion of a URL:
35857
35681
  *
@@ -35863,7 +35687,7 @@ exports.urlGenerate = urlGenerate;
35863
35687
  *
35864
35688
  * @param aPath The path or url to normalize.
35865
35689
  */
35866
- function normalize(aPath) {
35690
+ var normalize = lruMemoize(function normalize(aPath) {
35867
35691
  var path = aPath;
35868
35692
  var url = urlParse(aPath);
35869
35693
  if (url) {
@@ -35873,8 +35697,25 @@ function normalize(aPath) {
35873
35697
  path = url.path;
35874
35698
  }
35875
35699
  var isAbsolute = exports.isAbsolute(path);
35700
+ // Split the path into parts between `/` characters. This is much faster than
35701
+ // using `.split(/\/+/g)`.
35702
+ var parts = [];
35703
+ var start = 0;
35704
+ var i = 0;
35705
+ while (true) {
35706
+ start = i;
35707
+ i = path.indexOf("/", start);
35708
+ if (i === -1) {
35709
+ parts.push(path.slice(start));
35710
+ break;
35711
+ } else {
35712
+ parts.push(path.slice(start, i));
35713
+ while (i < path.length && path[i] === "/") {
35714
+ i++;
35715
+ }
35716
+ }
35717
+ }
35876
35718
 
35877
- var parts = path.split(/\/+/);
35878
35719
  for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
35879
35720
  part = parts[i];
35880
35721
  if (part === '.') {
@@ -35905,7 +35746,7 @@ function normalize(aPath) {
35905
35746
  return urlGenerate(url);
35906
35747
  }
35907
35748
  return path;
35908
- }
35749
+ });
35909
35750
  exports.normalize = normalize;
35910
35751
 
35911
35752
  /**
@@ -36117,6 +35958,33 @@ function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
36117
35958
  }
36118
35959
  exports.compareByOriginalPositions = compareByOriginalPositions;
36119
35960
 
35961
+ function compareByOriginalPositionsNoSource(mappingA, mappingB, onlyCompareOriginal) {
35962
+ var cmp;
35963
+
35964
+ cmp = mappingA.originalLine - mappingB.originalLine;
35965
+ if (cmp !== 0) {
35966
+ return cmp;
35967
+ }
35968
+
35969
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
35970
+ if (cmp !== 0 || onlyCompareOriginal) {
35971
+ return cmp;
35972
+ }
35973
+
35974
+ cmp = mappingA.generatedColumn - mappingB.generatedColumn;
35975
+ if (cmp !== 0) {
35976
+ return cmp;
35977
+ }
35978
+
35979
+ cmp = mappingA.generatedLine - mappingB.generatedLine;
35980
+ if (cmp !== 0) {
35981
+ return cmp;
35982
+ }
35983
+
35984
+ return strcmp(mappingA.name, mappingB.name);
35985
+ }
35986
+ exports.compareByOriginalPositionsNoSource = compareByOriginalPositionsNoSource;
35987
+
36120
35988
  /**
36121
35989
  * Comparator between two mappings with deflated source and name indices where
36122
35990
  * the generated positions are compared.
@@ -36156,6 +36024,31 @@ function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGene
36156
36024
  }
36157
36025
  exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
36158
36026
 
36027
+ function compareByGeneratedPositionsDeflatedNoLine(mappingA, mappingB, onlyCompareGenerated) {
36028
+ var cmp = mappingA.generatedColumn - mappingB.generatedColumn;
36029
+ if (cmp !== 0 || onlyCompareGenerated) {
36030
+ return cmp;
36031
+ }
36032
+
36033
+ cmp = strcmp(mappingA.source, mappingB.source);
36034
+ if (cmp !== 0) {
36035
+ return cmp;
36036
+ }
36037
+
36038
+ cmp = mappingA.originalLine - mappingB.originalLine;
36039
+ if (cmp !== 0) {
36040
+ return cmp;
36041
+ }
36042
+
36043
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
36044
+ if (cmp !== 0) {
36045
+ return cmp;
36046
+ }
36047
+
36048
+ return strcmp(mappingA.name, mappingB.name);
36049
+ }
36050
+ exports.compareByGeneratedPositionsDeflatedNoLine = compareByGeneratedPositionsDeflatedNoLine;
36051
+
36159
36052
  function strcmp(aStr1, aStr2) {
36160
36053
  if (aStr1 === aStr2) {
36161
36054
  return 0;
@@ -36272,7 +36165,124 @@ function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
36272
36165
  return normalize(sourceURL);
36273
36166
  }
36274
36167
  exports.computeSourceURL = computeSourceURL;
36275
- }(util$5));
36168
+ }(util$2));
36169
+
36170
+ var binarySearch$1 = {};
36171
+
36172
+ /* -*- Mode: js; js-indent-level: 2; -*- */
36173
+
36174
+ (function (exports) {
36175
+ /*
36176
+ * Copyright 2011 Mozilla Foundation and contributors
36177
+ * Licensed under the New BSD license. See LICENSE or:
36178
+ * http://opensource.org/licenses/BSD-3-Clause
36179
+ */
36180
+
36181
+ exports.GREATEST_LOWER_BOUND = 1;
36182
+ exports.LEAST_UPPER_BOUND = 2;
36183
+
36184
+ /**
36185
+ * Recursive implementation of binary search.
36186
+ *
36187
+ * @param aLow Indices here and lower do not contain the needle.
36188
+ * @param aHigh Indices here and higher do not contain the needle.
36189
+ * @param aNeedle The element being searched for.
36190
+ * @param aHaystack The non-empty array being searched.
36191
+ * @param aCompare Function which takes two elements and returns -1, 0, or 1.
36192
+ * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
36193
+ * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
36194
+ * closest element that is smaller than or greater than the one we are
36195
+ * searching for, respectively, if the exact element cannot be found.
36196
+ */
36197
+ function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
36198
+ // This function terminates when one of the following is true:
36199
+ //
36200
+ // 1. We find the exact element we are looking for.
36201
+ //
36202
+ // 2. We did not find the exact element, but we can return the index of
36203
+ // the next-closest element.
36204
+ //
36205
+ // 3. We did not find the exact element, and there is no next-closest
36206
+ // element than the one we are searching for, so we return -1.
36207
+ var mid = Math.floor((aHigh - aLow) / 2) + aLow;
36208
+ var cmp = aCompare(aNeedle, aHaystack[mid], true);
36209
+ if (cmp === 0) {
36210
+ // Found the element we are looking for.
36211
+ return mid;
36212
+ }
36213
+ else if (cmp > 0) {
36214
+ // Our needle is greater than aHaystack[mid].
36215
+ if (aHigh - mid > 1) {
36216
+ // The element is in the upper half.
36217
+ return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
36218
+ }
36219
+
36220
+ // The exact needle element was not found in this haystack. Determine if
36221
+ // we are in termination case (3) or (2) and return the appropriate thing.
36222
+ if (aBias == exports.LEAST_UPPER_BOUND) {
36223
+ return aHigh < aHaystack.length ? aHigh : -1;
36224
+ } else {
36225
+ return mid;
36226
+ }
36227
+ }
36228
+ else {
36229
+ // Our needle is less than aHaystack[mid].
36230
+ if (mid - aLow > 1) {
36231
+ // The element is in the lower half.
36232
+ return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
36233
+ }
36234
+
36235
+ // we are in termination case (3) or (2) and return the appropriate thing.
36236
+ if (aBias == exports.LEAST_UPPER_BOUND) {
36237
+ return mid;
36238
+ } else {
36239
+ return aLow < 0 ? -1 : aLow;
36240
+ }
36241
+ }
36242
+ }
36243
+
36244
+ /**
36245
+ * This is an implementation of binary search which will always try and return
36246
+ * the index of the closest element if there is no exact hit. This is because
36247
+ * mappings between original and generated line/col pairs are single points,
36248
+ * and there is an implicit region between each of them, so a miss just means
36249
+ * that you aren't on the very start of a region.
36250
+ *
36251
+ * @param aNeedle The element you are looking for.
36252
+ * @param aHaystack The array that is being searched.
36253
+ * @param aCompare A function which takes the needle and an element in the
36254
+ * array and returns -1, 0, or 1 depending on whether the needle is less
36255
+ * than, equal to, or greater than the element, respectively.
36256
+ * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
36257
+ * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
36258
+ * closest element that is smaller than or greater than the one we are
36259
+ * searching for, respectively, if the exact element cannot be found.
36260
+ * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
36261
+ */
36262
+ exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
36263
+ if (aHaystack.length === 0) {
36264
+ return -1;
36265
+ }
36266
+
36267
+ var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,
36268
+ aCompare, aBias || exports.GREATEST_LOWER_BOUND);
36269
+ if (index < 0) {
36270
+ return -1;
36271
+ }
36272
+
36273
+ // We have found either the exact element, or the next-closest element than
36274
+ // the one we are searching for. However, there may be more than one such
36275
+ // element. Make sure we always return the smallest of these.
36276
+ while (index - 1 >= 0) {
36277
+ if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
36278
+ break;
36279
+ }
36280
+ --index;
36281
+ }
36282
+
36283
+ return index;
36284
+ };
36285
+ }(binarySearch$1));
36276
36286
 
36277
36287
  var arraySet = {};
36278
36288
 
@@ -36284,7 +36294,7 @@ var arraySet = {};
36284
36294
  * http://opensource.org/licenses/BSD-3-Clause
36285
36295
  */
36286
36296
 
36287
- var util$4 = util$5;
36297
+ var util$1 = util$2;
36288
36298
  var has = Object.prototype.hasOwnProperty;
36289
36299
  var hasNativeMap = typeof Map !== "undefined";
36290
36300
 
@@ -36294,7 +36304,7 @@ var hasNativeMap = typeof Map !== "undefined";
36294
36304
  * element is O(1). Removing elements from the set is not supported. Only
36295
36305
  * strings are supported for membership.
36296
36306
  */
36297
- function ArraySet$2() {
36307
+ function ArraySet$1() {
36298
36308
  this._array = [];
36299
36309
  this._set = hasNativeMap ? new Map() : Object.create(null);
36300
36310
  }
@@ -36302,8 +36312,8 @@ function ArraySet$2() {
36302
36312
  /**
36303
36313
  * Static method for creating ArraySet instances from an existing array.
36304
36314
  */
36305
- ArraySet$2.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
36306
- var set = new ArraySet$2();
36315
+ ArraySet$1.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
36316
+ var set = new ArraySet$1();
36307
36317
  for (var i = 0, len = aArray.length; i < len; i++) {
36308
36318
  set.add(aArray[i], aAllowDuplicates);
36309
36319
  }
@@ -36316,7 +36326,7 @@ ArraySet$2.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
36316
36326
  *
36317
36327
  * @returns Number
36318
36328
  */
36319
- ArraySet$2.prototype.size = function ArraySet_size() {
36329
+ ArraySet$1.prototype.size = function ArraySet_size() {
36320
36330
  return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
36321
36331
  };
36322
36332
 
@@ -36325,8 +36335,8 @@ ArraySet$2.prototype.size = function ArraySet_size() {
36325
36335
  *
36326
36336
  * @param String aStr
36327
36337
  */
36328
- ArraySet$2.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
36329
- var sStr = hasNativeMap ? aStr : util$4.toSetString(aStr);
36338
+ ArraySet$1.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
36339
+ var sStr = hasNativeMap ? aStr : util$1.toSetString(aStr);
36330
36340
  var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
36331
36341
  var idx = this._array.length;
36332
36342
  if (!isDuplicate || aAllowDuplicates) {
@@ -36346,11 +36356,11 @@ ArraySet$2.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
36346
36356
  *
36347
36357
  * @param String aStr
36348
36358
  */
36349
- ArraySet$2.prototype.has = function ArraySet_has(aStr) {
36359
+ ArraySet$1.prototype.has = function ArraySet_has(aStr) {
36350
36360
  if (hasNativeMap) {
36351
36361
  return this._set.has(aStr);
36352
36362
  } else {
36353
- var sStr = util$4.toSetString(aStr);
36363
+ var sStr = util$1.toSetString(aStr);
36354
36364
  return has.call(this._set, sStr);
36355
36365
  }
36356
36366
  };
@@ -36360,14 +36370,14 @@ ArraySet$2.prototype.has = function ArraySet_has(aStr) {
36360
36370
  *
36361
36371
  * @param String aStr
36362
36372
  */
36363
- ArraySet$2.prototype.indexOf = function ArraySet_indexOf(aStr) {
36373
+ ArraySet$1.prototype.indexOf = function ArraySet_indexOf(aStr) {
36364
36374
  if (hasNativeMap) {
36365
36375
  var idx = this._set.get(aStr);
36366
36376
  if (idx >= 0) {
36367
36377
  return idx;
36368
36378
  }
36369
36379
  } else {
36370
- var sStr = util$4.toSetString(aStr);
36380
+ var sStr = util$1.toSetString(aStr);
36371
36381
  if (has.call(this._set, sStr)) {
36372
36382
  return this._set[sStr];
36373
36383
  }
@@ -36381,7 +36391,7 @@ ArraySet$2.prototype.indexOf = function ArraySet_indexOf(aStr) {
36381
36391
  *
36382
36392
  * @param Number aIdx
36383
36393
  */
36384
- ArraySet$2.prototype.at = function ArraySet_at(aIdx) {
36394
+ ArraySet$1.prototype.at = function ArraySet_at(aIdx) {
36385
36395
  if (aIdx >= 0 && aIdx < this._array.length) {
36386
36396
  return this._array[aIdx];
36387
36397
  }
@@ -36393,640 +36403,226 @@ ArraySet$2.prototype.at = function ArraySet_at(aIdx) {
36393
36403
  * indicated by indexOf). Note that this is a copy of the internal array used
36394
36404
  * for storing the members so that no one can mess with internal state.
36395
36405
  */
36396
- ArraySet$2.prototype.toArray = function ArraySet_toArray() {
36406
+ ArraySet$1.prototype.toArray = function ArraySet_toArray() {
36397
36407
  return this._array.slice();
36398
36408
  };
36399
36409
 
36400
- arraySet.ArraySet = ArraySet$2;
36410
+ arraySet.ArraySet = ArraySet$1;
36401
36411
 
36402
- var mappingList = {};
36412
+ var base64Vlq = {};
36413
+
36414
+ var base64$1 = {};
36403
36415
 
36404
36416
  /* -*- Mode: js; js-indent-level: 2; -*- */
36405
36417
 
36406
36418
  /*
36407
- * Copyright 2014 Mozilla Foundation and contributors
36419
+ * Copyright 2011 Mozilla Foundation and contributors
36408
36420
  * Licensed under the New BSD license. See LICENSE or:
36409
36421
  * http://opensource.org/licenses/BSD-3-Clause
36410
36422
  */
36411
36423
 
36412
- var util$3 = util$5;
36413
-
36414
- /**
36415
- * Determine whether mappingB is after mappingA with respect to generated
36416
- * position.
36417
- */
36418
- function generatedPositionAfter(mappingA, mappingB) {
36419
- // Optimized for most common case
36420
- var lineA = mappingA.generatedLine;
36421
- var lineB = mappingB.generatedLine;
36422
- var columnA = mappingA.generatedColumn;
36423
- var columnB = mappingB.generatedColumn;
36424
- return lineB > lineA || lineB == lineA && columnB >= columnA ||
36425
- util$3.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
36426
- }
36427
-
36428
- /**
36429
- * A data structure to provide a sorted view of accumulated mappings in a
36430
- * performance conscious manner. It trades a neglibable overhead in general
36431
- * case for a large speedup in case of mappings being added in order.
36432
- */
36433
- function MappingList$1() {
36434
- this._array = [];
36435
- this._sorted = true;
36436
- // Serves as infimum
36437
- this._last = {generatedLine: -1, generatedColumn: 0};
36438
- }
36439
-
36440
- /**
36441
- * Iterate through internal items. This method takes the same arguments that
36442
- * `Array.prototype.forEach` takes.
36443
- *
36444
- * NOTE: The order of the mappings is NOT guaranteed.
36445
- */
36446
- MappingList$1.prototype.unsortedForEach =
36447
- function MappingList_forEach(aCallback, aThisArg) {
36448
- this._array.forEach(aCallback, aThisArg);
36449
- };
36424
+ var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
36450
36425
 
36451
36426
  /**
36452
- * Add the given source mapping.
36453
- *
36454
- * @param Object aMapping
36427
+ * Encode an integer in the range of 0 to 63 to a single base 64 digit.
36455
36428
  */
36456
- MappingList$1.prototype.add = function MappingList_add(aMapping) {
36457
- if (generatedPositionAfter(this._last, aMapping)) {
36458
- this._last = aMapping;
36459
- this._array.push(aMapping);
36460
- } else {
36461
- this._sorted = false;
36462
- this._array.push(aMapping);
36429
+ base64$1.encode = function (number) {
36430
+ if (0 <= number && number < intToCharMap.length) {
36431
+ return intToCharMap[number];
36463
36432
  }
36433
+ throw new TypeError("Must be between 0 and 63: " + number);
36464
36434
  };
36465
36435
 
36466
36436
  /**
36467
- * Returns the flat, sorted array of mappings. The mappings are sorted by
36468
- * generated position.
36469
- *
36470
- * WARNING: This method returns internal data without copying, for
36471
- * performance. The return value must NOT be mutated, and should be treated as
36472
- * an immutable borrow. If you want to take ownership, you must make your own
36473
- * copy.
36437
+ * Decode a single base 64 character code digit to an integer. Returns -1 on
36438
+ * failure.
36474
36439
  */
36475
- MappingList$1.prototype.toArray = function MappingList_toArray() {
36476
- if (!this._sorted) {
36477
- this._array.sort(util$3.compareByGeneratedPositionsInflated);
36478
- this._sorted = true;
36479
- }
36480
- return this._array;
36481
- };
36440
+ base64$1.decode = function (charCode) {
36441
+ var bigA = 65; // 'A'
36442
+ var bigZ = 90; // 'Z'
36482
36443
 
36483
- mappingList.MappingList = MappingList$1;
36444
+ var littleA = 97; // 'a'
36445
+ var littleZ = 122; // 'z'
36484
36446
 
36485
- /* -*- Mode: js; js-indent-level: 2; -*- */
36447
+ var zero = 48; // '0'
36448
+ var nine = 57; // '9'
36486
36449
 
36487
- /*
36488
- * Copyright 2011 Mozilla Foundation and contributors
36489
- * Licensed under the New BSD license. See LICENSE or:
36490
- * http://opensource.org/licenses/BSD-3-Clause
36491
- */
36450
+ var plus = 43; // '+'
36451
+ var slash = 47; // '/'
36492
36452
 
36493
- var base64VLQ$1 = base64Vlq;
36494
- var util$2 = util$5;
36495
- var ArraySet$1 = arraySet.ArraySet;
36496
- var MappingList = mappingList.MappingList;
36453
+ var littleOffset = 26;
36454
+ var numberOffset = 52;
36497
36455
 
36498
- /**
36499
- * An instance of the SourceMapGenerator represents a source map which is
36500
- * being built incrementally. You may pass an object with the following
36501
- * properties:
36502
- *
36503
- * - file: The filename of the generated source.
36504
- * - sourceRoot: A root for all relative URLs in this source map.
36505
- */
36506
- function SourceMapGenerator$1(aArgs) {
36507
- if (!aArgs) {
36508
- aArgs = {};
36456
+ // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
36457
+ if (bigA <= charCode && charCode <= bigZ) {
36458
+ return (charCode - bigA);
36509
36459
  }
36510
- this._file = util$2.getArg(aArgs, 'file', null);
36511
- this._sourceRoot = util$2.getArg(aArgs, 'sourceRoot', null);
36512
- this._skipValidation = util$2.getArg(aArgs, 'skipValidation', false);
36513
- this._sources = new ArraySet$1();
36514
- this._names = new ArraySet$1();
36515
- this._mappings = new MappingList();
36516
- this._sourcesContents = null;
36517
- }
36518
-
36519
- SourceMapGenerator$1.prototype._version = 3;
36520
-
36521
- /**
36522
- * Creates a new SourceMapGenerator based on a SourceMapConsumer
36523
- *
36524
- * @param aSourceMapConsumer The SourceMap.
36525
- */
36526
- SourceMapGenerator$1.fromSourceMap =
36527
- function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
36528
- var sourceRoot = aSourceMapConsumer.sourceRoot;
36529
- var generator = new SourceMapGenerator$1({
36530
- file: aSourceMapConsumer.file,
36531
- sourceRoot: sourceRoot
36532
- });
36533
- aSourceMapConsumer.eachMapping(function (mapping) {
36534
- var newMapping = {
36535
- generated: {
36536
- line: mapping.generatedLine,
36537
- column: mapping.generatedColumn
36538
- }
36539
- };
36540
36460
 
36541
- if (mapping.source != null) {
36542
- newMapping.source = mapping.source;
36543
- if (sourceRoot != null) {
36544
- newMapping.source = util$2.relative(sourceRoot, newMapping.source);
36545
- }
36461
+ // 26 - 51: abcdefghijklmnopqrstuvwxyz
36462
+ if (littleA <= charCode && charCode <= littleZ) {
36463
+ return (charCode - littleA + littleOffset);
36464
+ }
36546
36465
 
36547
- newMapping.original = {
36548
- line: mapping.originalLine,
36549
- column: mapping.originalColumn
36550
- };
36466
+ // 52 - 61: 0123456789
36467
+ if (zero <= charCode && charCode <= nine) {
36468
+ return (charCode - zero + numberOffset);
36469
+ }
36551
36470
 
36552
- if (mapping.name != null) {
36553
- newMapping.name = mapping.name;
36554
- }
36555
- }
36471
+ // 62: +
36472
+ if (charCode == plus) {
36473
+ return 62;
36474
+ }
36556
36475
 
36557
- generator.addMapping(newMapping);
36558
- });
36559
- aSourceMapConsumer.sources.forEach(function (sourceFile) {
36560
- var sourceRelative = sourceFile;
36561
- if (sourceRoot !== null) {
36562
- sourceRelative = util$2.relative(sourceRoot, sourceFile);
36563
- }
36476
+ // 63: /
36477
+ if (charCode == slash) {
36478
+ return 63;
36479
+ }
36564
36480
 
36565
- if (!generator._sources.has(sourceRelative)) {
36566
- generator._sources.add(sourceRelative);
36567
- }
36481
+ // Invalid base64 digit.
36482
+ return -1;
36483
+ };
36568
36484
 
36569
- var content = aSourceMapConsumer.sourceContentFor(sourceFile);
36570
- if (content != null) {
36571
- generator.setSourceContent(sourceFile, content);
36572
- }
36573
- });
36574
- return generator;
36575
- };
36485
+ /* -*- Mode: js; js-indent-level: 2; -*- */
36576
36486
 
36577
- /**
36578
- * Add a single mapping from original source line and column to the generated
36579
- * source's line and column for this source map being created. The mapping
36580
- * object should have the following properties:
36487
+ /*
36488
+ * Copyright 2011 Mozilla Foundation and contributors
36489
+ * Licensed under the New BSD license. See LICENSE or:
36490
+ * http://opensource.org/licenses/BSD-3-Clause
36581
36491
  *
36582
- * - generated: An object with the generated line and column positions.
36583
- * - original: An object with the original line and column positions.
36584
- * - source: The original source file (relative to the sourceRoot).
36585
- * - name: An optional original token name for this mapping.
36586
- */
36587
- SourceMapGenerator$1.prototype.addMapping =
36588
- function SourceMapGenerator_addMapping(aArgs) {
36589
- var generated = util$2.getArg(aArgs, 'generated');
36590
- var original = util$2.getArg(aArgs, 'original', null);
36591
- var source = util$2.getArg(aArgs, 'source', null);
36592
- var name = util$2.getArg(aArgs, 'name', null);
36593
-
36594
- if (!this._skipValidation) {
36595
- this._validateMapping(generated, original, source, name);
36596
- }
36597
-
36598
- if (source != null) {
36599
- source = String(source);
36600
- if (!this._sources.has(source)) {
36601
- this._sources.add(source);
36602
- }
36603
- }
36604
-
36605
- if (name != null) {
36606
- name = String(name);
36607
- if (!this._names.has(name)) {
36608
- this._names.add(name);
36609
- }
36610
- }
36611
-
36612
- this._mappings.add({
36613
- generatedLine: generated.line,
36614
- generatedColumn: generated.column,
36615
- originalLine: original != null && original.line,
36616
- originalColumn: original != null && original.column,
36617
- source: source,
36618
- name: name
36619
- });
36620
- };
36621
-
36622
- /**
36623
- * Set the source content for a source file.
36624
- */
36625
- SourceMapGenerator$1.prototype.setSourceContent =
36626
- function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
36627
- var source = aSourceFile;
36628
- if (this._sourceRoot != null) {
36629
- source = util$2.relative(this._sourceRoot, source);
36630
- }
36631
-
36632
- if (aSourceContent != null) {
36633
- // Add the source content to the _sourcesContents map.
36634
- // Create a new _sourcesContents map if the property is null.
36635
- if (!this._sourcesContents) {
36636
- this._sourcesContents = Object.create(null);
36637
- }
36638
- this._sourcesContents[util$2.toSetString(source)] = aSourceContent;
36639
- } else if (this._sourcesContents) {
36640
- // Remove the source file from the _sourcesContents map.
36641
- // If the _sourcesContents map is empty, set the property to null.
36642
- delete this._sourcesContents[util$2.toSetString(source)];
36643
- if (Object.keys(this._sourcesContents).length === 0) {
36644
- this._sourcesContents = null;
36645
- }
36646
- }
36647
- };
36648
-
36649
- /**
36650
- * Applies the mappings of a sub-source-map for a specific source file to the
36651
- * source map being generated. Each mapping to the supplied source file is
36652
- * rewritten using the supplied source map. Note: The resolution for the
36653
- * resulting mappings is the minimium of this map and the supplied map.
36492
+ * Based on the Base 64 VLQ implementation in Closure Compiler:
36493
+ * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
36654
36494
  *
36655
- * @param aSourceMapConsumer The source map to be applied.
36656
- * @param aSourceFile Optional. The filename of the source file.
36657
- * If omitted, SourceMapConsumer's file property will be used.
36658
- * @param aSourceMapPath Optional. The dirname of the path to the source map
36659
- * to be applied. If relative, it is relative to the SourceMapConsumer.
36660
- * This parameter is needed when the two source maps aren't in the same
36661
- * directory, and the source map to be applied contains relative source
36662
- * paths. If so, those relative source paths need to be rewritten
36663
- * relative to the SourceMapGenerator.
36664
- */
36665
- SourceMapGenerator$1.prototype.applySourceMap =
36666
- function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
36667
- var sourceFile = aSourceFile;
36668
- // If aSourceFile is omitted, we will use the file property of the SourceMap
36669
- if (aSourceFile == null) {
36670
- if (aSourceMapConsumer.file == null) {
36671
- throw new Error(
36672
- 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +
36673
- 'or the source map\'s "file" property. Both were omitted.'
36674
- );
36675
- }
36676
- sourceFile = aSourceMapConsumer.file;
36677
- }
36678
- var sourceRoot = this._sourceRoot;
36679
- // Make "sourceFile" relative if an absolute Url is passed.
36680
- if (sourceRoot != null) {
36681
- sourceFile = util$2.relative(sourceRoot, sourceFile);
36682
- }
36683
- // Applying the SourceMap can add and remove items from the sources and
36684
- // the names array.
36685
- var newSources = new ArraySet$1();
36686
- var newNames = new ArraySet$1();
36687
-
36688
- // Find mappings for the "sourceFile"
36689
- this._mappings.unsortedForEach(function (mapping) {
36690
- if (mapping.source === sourceFile && mapping.originalLine != null) {
36691
- // Check if it can be mapped by the source map, then update the mapping.
36692
- var original = aSourceMapConsumer.originalPositionFor({
36693
- line: mapping.originalLine,
36694
- column: mapping.originalColumn
36695
- });
36696
- if (original.source != null) {
36697
- // Copy mapping
36698
- mapping.source = original.source;
36699
- if (aSourceMapPath != null) {
36700
- mapping.source = util$2.join(aSourceMapPath, mapping.source);
36701
- }
36702
- if (sourceRoot != null) {
36703
- mapping.source = util$2.relative(sourceRoot, mapping.source);
36704
- }
36705
- mapping.originalLine = original.line;
36706
- mapping.originalColumn = original.column;
36707
- if (original.name != null) {
36708
- mapping.name = original.name;
36709
- }
36710
- }
36711
- }
36712
-
36713
- var source = mapping.source;
36714
- if (source != null && !newSources.has(source)) {
36715
- newSources.add(source);
36716
- }
36717
-
36718
- var name = mapping.name;
36719
- if (name != null && !newNames.has(name)) {
36720
- newNames.add(name);
36721
- }
36722
-
36723
- }, this);
36724
- this._sources = newSources;
36725
- this._names = newNames;
36726
-
36727
- // Copy sourcesContents of applied map.
36728
- aSourceMapConsumer.sources.forEach(function (sourceFile) {
36729
- var content = aSourceMapConsumer.sourceContentFor(sourceFile);
36730
- if (content != null) {
36731
- if (aSourceMapPath != null) {
36732
- sourceFile = util$2.join(aSourceMapPath, sourceFile);
36733
- }
36734
- if (sourceRoot != null) {
36735
- sourceFile = util$2.relative(sourceRoot, sourceFile);
36736
- }
36737
- this.setSourceContent(sourceFile, content);
36738
- }
36739
- }, this);
36740
- };
36741
-
36742
- /**
36743
- * A mapping can have one of the three levels of data:
36495
+ * Copyright 2011 The Closure Compiler Authors. All rights reserved.
36496
+ * Redistribution and use in source and binary forms, with or without
36497
+ * modification, are permitted provided that the following conditions are
36498
+ * met:
36744
36499
  *
36745
- * 1. Just the generated position.
36746
- * 2. The Generated position, original position, and original source.
36747
- * 3. Generated and original position, original source, as well as a name
36748
- * token.
36500
+ * * Redistributions of source code must retain the above copyright
36501
+ * notice, this list of conditions and the following disclaimer.
36502
+ * * Redistributions in binary form must reproduce the above
36503
+ * copyright notice, this list of conditions and the following
36504
+ * disclaimer in the documentation and/or other materials provided
36505
+ * with the distribution.
36506
+ * * Neither the name of Google Inc. nor the names of its
36507
+ * contributors may be used to endorse or promote products derived
36508
+ * from this software without specific prior written permission.
36749
36509
  *
36750
- * To maintain consistency, we validate that any new mapping being added falls
36751
- * in to one of these categories.
36752
- */
36753
- SourceMapGenerator$1.prototype._validateMapping =
36754
- function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
36755
- aName) {
36756
- // When aOriginal is truthy but has empty values for .line and .column,
36757
- // it is most likely a programmer error. In this case we throw a very
36758
- // specific error message to try to guide them the right way.
36759
- // For example: https://github.com/Polymer/polymer-bundler/pull/519
36760
- if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
36761
- throw new Error(
36762
- 'original.line and original.column are not numbers -- you probably meant to omit ' +
36763
- 'the original mapping entirely and only map the generated position. If so, pass ' +
36764
- 'null for the original mapping instead of an object with empty or null values.'
36765
- );
36766
- }
36767
-
36768
- if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
36769
- && aGenerated.line > 0 && aGenerated.column >= 0
36770
- && !aOriginal && !aSource && !aName) {
36771
- // Case 1.
36772
- return;
36773
- }
36774
- else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
36775
- && aOriginal && 'line' in aOriginal && 'column' in aOriginal
36776
- && aGenerated.line > 0 && aGenerated.column >= 0
36777
- && aOriginal.line > 0 && aOriginal.column >= 0
36778
- && aSource) {
36779
- // Cases 2 and 3.
36780
- return;
36781
- }
36782
- else {
36783
- throw new Error('Invalid mapping: ' + JSON.stringify({
36784
- generated: aGenerated,
36785
- source: aSource,
36786
- original: aOriginal,
36787
- name: aName
36788
- }));
36789
- }
36790
- };
36791
-
36792
- /**
36793
- * Serialize the accumulated mappings in to the stream of base 64 VLQs
36794
- * specified by the source map format.
36510
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
36511
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
36512
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
36513
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36514
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
36515
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36516
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36517
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36518
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36519
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36520
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36795
36521
  */
36796
- SourceMapGenerator$1.prototype._serializeMappings =
36797
- function SourceMapGenerator_serializeMappings() {
36798
- var previousGeneratedColumn = 0;
36799
- var previousGeneratedLine = 1;
36800
- var previousOriginalColumn = 0;
36801
- var previousOriginalLine = 0;
36802
- var previousName = 0;
36803
- var previousSource = 0;
36804
- var result = '';
36805
- var next;
36806
- var mapping;
36807
- var nameIdx;
36808
- var sourceIdx;
36809
-
36810
- var mappings = this._mappings.toArray();
36811
- for (var i = 0, len = mappings.length; i < len; i++) {
36812
- mapping = mappings[i];
36813
- next = '';
36814
-
36815
- if (mapping.generatedLine !== previousGeneratedLine) {
36816
- previousGeneratedColumn = 0;
36817
- while (mapping.generatedLine !== previousGeneratedLine) {
36818
- next += ';';
36819
- previousGeneratedLine++;
36820
- }
36821
- }
36822
- else {
36823
- if (i > 0) {
36824
- if (!util$2.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
36825
- continue;
36826
- }
36827
- next += ',';
36828
- }
36829
- }
36830
-
36831
- next += base64VLQ$1.encode(mapping.generatedColumn
36832
- - previousGeneratedColumn);
36833
- previousGeneratedColumn = mapping.generatedColumn;
36834
36522
 
36835
- if (mapping.source != null) {
36836
- sourceIdx = this._sources.indexOf(mapping.source);
36837
- next += base64VLQ$1.encode(sourceIdx - previousSource);
36838
- previousSource = sourceIdx;
36839
-
36840
- // lines are stored 0-based in SourceMap spec version 3
36841
- next += base64VLQ$1.encode(mapping.originalLine - 1
36842
- - previousOriginalLine);
36843
- previousOriginalLine = mapping.originalLine - 1;
36523
+ var base64 = base64$1;
36844
36524
 
36845
- next += base64VLQ$1.encode(mapping.originalColumn
36846
- - previousOriginalColumn);
36847
- previousOriginalColumn = mapping.originalColumn;
36525
+ // A single base 64 digit can contain 6 bits of data. For the base 64 variable
36526
+ // length quantities we use in the source map spec, the first bit is the sign,
36527
+ // the next four bits are the actual value, and the 6th bit is the
36528
+ // continuation bit. The continuation bit tells us whether there are more
36529
+ // digits in this value following this digit.
36530
+ //
36531
+ // Continuation
36532
+ // | Sign
36533
+ // | |
36534
+ // V V
36535
+ // 101011
36848
36536
 
36849
- if (mapping.name != null) {
36850
- nameIdx = this._names.indexOf(mapping.name);
36851
- next += base64VLQ$1.encode(nameIdx - previousName);
36852
- previousName = nameIdx;
36853
- }
36854
- }
36537
+ var VLQ_BASE_SHIFT = 5;
36855
36538
 
36856
- result += next;
36857
- }
36539
+ // binary: 100000
36540
+ var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
36858
36541
 
36859
- return result;
36860
- };
36542
+ // binary: 011111
36543
+ var VLQ_BASE_MASK = VLQ_BASE - 1;
36861
36544
 
36862
- SourceMapGenerator$1.prototype._generateSourcesContent =
36863
- function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
36864
- return aSources.map(function (source) {
36865
- if (!this._sourcesContents) {
36866
- return null;
36867
- }
36868
- if (aSourceRoot != null) {
36869
- source = util$2.relative(aSourceRoot, source);
36870
- }
36871
- var key = util$2.toSetString(source);
36872
- return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)
36873
- ? this._sourcesContents[key]
36874
- : null;
36875
- }, this);
36876
- };
36545
+ // binary: 100000
36546
+ var VLQ_CONTINUATION_BIT = VLQ_BASE;
36877
36547
 
36878
36548
  /**
36879
- * Externalize the source map.
36549
+ * Converts from a two-complement value to a value where the sign bit is
36550
+ * placed in the least significant bit. For example, as decimals:
36551
+ * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
36552
+ * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
36880
36553
  */
36881
- SourceMapGenerator$1.prototype.toJSON =
36882
- function SourceMapGenerator_toJSON() {
36883
- var map = {
36884
- version: this._version,
36885
- sources: this._sources.toArray(),
36886
- names: this._names.toArray(),
36887
- mappings: this._serializeMappings()
36888
- };
36889
- if (this._file != null) {
36890
- map.file = this._file;
36891
- }
36892
- if (this._sourceRoot != null) {
36893
- map.sourceRoot = this._sourceRoot;
36894
- }
36895
- if (this._sourcesContents) {
36896
- map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
36897
- }
36898
-
36899
- return map;
36900
- };
36554
+ function toVLQSigned(aValue) {
36555
+ return aValue < 0
36556
+ ? ((-aValue) << 1) + 1
36557
+ : (aValue << 1) + 0;
36558
+ }
36901
36559
 
36902
36560
  /**
36903
- * Render the source map being generated to a string.
36904
- */
36905
- SourceMapGenerator$1.prototype.toString =
36906
- function SourceMapGenerator_toString() {
36907
- return JSON.stringify(this.toJSON());
36908
- };
36909
-
36910
- sourceMapGenerator.SourceMapGenerator = SourceMapGenerator$1;
36911
-
36912
- var sourceMapConsumer = {};
36913
-
36914
- var binarySearch$1 = {};
36915
-
36916
- /* -*- Mode: js; js-indent-level: 2; -*- */
36917
-
36918
- (function (exports) {
36919
- /*
36920
- * Copyright 2011 Mozilla Foundation and contributors
36921
- * Licensed under the New BSD license. See LICENSE or:
36922
- * http://opensource.org/licenses/BSD-3-Clause
36561
+ * Converts to a two-complement value from a value where the sign bit is
36562
+ * placed in the least significant bit. For example, as decimals:
36563
+ * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
36564
+ * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
36923
36565
  */
36924
-
36925
- exports.GREATEST_LOWER_BOUND = 1;
36926
- exports.LEAST_UPPER_BOUND = 2;
36566
+ function fromVLQSigned(aValue) {
36567
+ var isNegative = (aValue & 1) === 1;
36568
+ var shifted = aValue >> 1;
36569
+ return isNegative
36570
+ ? -shifted
36571
+ : shifted;
36572
+ }
36927
36573
 
36928
36574
  /**
36929
- * Recursive implementation of binary search.
36930
- *
36931
- * @param aLow Indices here and lower do not contain the needle.
36932
- * @param aHigh Indices here and higher do not contain the needle.
36933
- * @param aNeedle The element being searched for.
36934
- * @param aHaystack The non-empty array being searched.
36935
- * @param aCompare Function which takes two elements and returns -1, 0, or 1.
36936
- * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
36937
- * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
36938
- * closest element that is smaller than or greater than the one we are
36939
- * searching for, respectively, if the exact element cannot be found.
36575
+ * Returns the base 64 VLQ encoded value.
36940
36576
  */
36941
- function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
36942
- // This function terminates when one of the following is true:
36943
- //
36944
- // 1. We find the exact element we are looking for.
36945
- //
36946
- // 2. We did not find the exact element, but we can return the index of
36947
- // the next-closest element.
36948
- //
36949
- // 3. We did not find the exact element, and there is no next-closest
36950
- // element than the one we are searching for, so we return -1.
36951
- var mid = Math.floor((aHigh - aLow) / 2) + aLow;
36952
- var cmp = aCompare(aNeedle, aHaystack[mid], true);
36953
- if (cmp === 0) {
36954
- // Found the element we are looking for.
36955
- return mid;
36956
- }
36957
- else if (cmp > 0) {
36958
- // Our needle is greater than aHaystack[mid].
36959
- if (aHigh - mid > 1) {
36960
- // The element is in the upper half.
36961
- return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
36962
- }
36577
+ base64Vlq.encode = function base64VLQ_encode(aValue) {
36578
+ var encoded = "";
36579
+ var digit;
36963
36580
 
36964
- // The exact needle element was not found in this haystack. Determine if
36965
- // we are in termination case (3) or (2) and return the appropriate thing.
36966
- if (aBias == exports.LEAST_UPPER_BOUND) {
36967
- return aHigh < aHaystack.length ? aHigh : -1;
36968
- } else {
36969
- return mid;
36970
- }
36971
- }
36972
- else {
36973
- // Our needle is less than aHaystack[mid].
36974
- if (mid - aLow > 1) {
36975
- // The element is in the lower half.
36976
- return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
36977
- }
36581
+ var vlq = toVLQSigned(aValue);
36978
36582
 
36979
- // we are in termination case (3) or (2) and return the appropriate thing.
36980
- if (aBias == exports.LEAST_UPPER_BOUND) {
36981
- return mid;
36982
- } else {
36983
- return aLow < 0 ? -1 : aLow;
36583
+ do {
36584
+ digit = vlq & VLQ_BASE_MASK;
36585
+ vlq >>>= VLQ_BASE_SHIFT;
36586
+ if (vlq > 0) {
36587
+ // There are still more digits in this value, so we must make sure the
36588
+ // continuation bit is marked.
36589
+ digit |= VLQ_CONTINUATION_BIT;
36984
36590
  }
36985
- }
36986
- }
36591
+ encoded += base64.encode(digit);
36592
+ } while (vlq > 0);
36593
+
36594
+ return encoded;
36595
+ };
36987
36596
 
36988
36597
  /**
36989
- * This is an implementation of binary search which will always try and return
36990
- * the index of the closest element if there is no exact hit. This is because
36991
- * mappings between original and generated line/col pairs are single points,
36992
- * and there is an implicit region between each of them, so a miss just means
36993
- * that you aren't on the very start of a region.
36994
- *
36995
- * @param aNeedle The element you are looking for.
36996
- * @param aHaystack The array that is being searched.
36997
- * @param aCompare A function which takes the needle and an element in the
36998
- * array and returns -1, 0, or 1 depending on whether the needle is less
36999
- * than, equal to, or greater than the element, respectively.
37000
- * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
37001
- * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
37002
- * closest element that is smaller than or greater than the one we are
37003
- * searching for, respectively, if the exact element cannot be found.
37004
- * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
36598
+ * Decodes the next base 64 VLQ value from the given string and returns the
36599
+ * value and the rest of the string via the out parameter.
37005
36600
  */
37006
- exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
37007
- if (aHaystack.length === 0) {
37008
- return -1;
37009
- }
36601
+ base64Vlq.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
36602
+ var strLen = aStr.length;
36603
+ var result = 0;
36604
+ var shift = 0;
36605
+ var continuation, digit;
37010
36606
 
37011
- var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,
37012
- aCompare, aBias || exports.GREATEST_LOWER_BOUND);
37013
- if (index < 0) {
37014
- return -1;
37015
- }
36607
+ do {
36608
+ if (aIndex >= strLen) {
36609
+ throw new Error("Expected more digits in base 64 VLQ value.");
36610
+ }
37016
36611
 
37017
- // We have found either the exact element, or the next-closest element than
37018
- // the one we are searching for. However, there may be more than one such
37019
- // element. Make sure we always return the smallest of these.
37020
- while (index - 1 >= 0) {
37021
- if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
37022
- break;
36612
+ digit = base64.decode(aStr.charCodeAt(aIndex++));
36613
+ if (digit === -1) {
36614
+ throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
37023
36615
  }
37024
- --index;
37025
- }
37026
36616
 
37027
- return index;
36617
+ continuation = !!(digit & VLQ_CONTINUATION_BIT);
36618
+ digit &= VLQ_BASE_MASK;
36619
+ result = result + (digit << shift);
36620
+ shift += VLQ_BASE_SHIFT;
36621
+ } while (continuation);
36622
+
36623
+ aOutParam.value = fromVLQSigned(result);
36624
+ aOutParam.rest = aIndex;
37028
36625
  };
37029
- }(binarySearch$1));
37030
36626
 
37031
36627
  var quickSort$1 = {};
37032
36628
 
@@ -37048,6 +36644,8 @@ var quickSort$1 = {};
37048
36644
  // sorting in C++. By using our own JS-implemented Quick Sort (below), we get
37049
36645
  // a ~3500ms mean speed-up in `bench/bench.html`.
37050
36646
 
36647
+ function SortTemplate(comparator) {
36648
+
37051
36649
  /**
37052
36650
  * Swap the elements indexed by `x` and `y` in the array `ary`.
37053
36651
  *
@@ -37118,7 +36716,7 @@ function doQuickSort(ary, comparator, p, r) {
37118
36716
  //
37119
36717
  // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
37120
36718
  for (var j = p; j < r; j++) {
37121
- if (comparator(ary[j], pivot) <= 0) {
36719
+ if (comparator(ary[j], pivot, false) <= 0) {
37122
36720
  i += 1;
37123
36721
  swap(ary, i, j);
37124
36722
  }
@@ -37134,6 +36732,15 @@ function doQuickSort(ary, comparator, p, r) {
37134
36732
  }
37135
36733
  }
37136
36734
 
36735
+ return doQuickSort;
36736
+ }
36737
+
36738
+ function cloneSort(comparator) {
36739
+ let template = SortTemplate.toString();
36740
+ let templateFn = new Function(`return ${template}`)();
36741
+ return templateFn(comparator);
36742
+ }
36743
+
37137
36744
  /**
37138
36745
  * Sort the given array in-place with the given comparator function.
37139
36746
  *
@@ -37142,8 +36749,15 @@ function doQuickSort(ary, comparator, p, r) {
37142
36749
  * @param {function} comparator
37143
36750
  * Function to use to compare two items.
37144
36751
  */
37145
- quickSort$1.quickSort = function (ary, comparator) {
37146
- doQuickSort(ary, comparator, 0, ary.length - 1);
36752
+
36753
+ let sortCache = new WeakMap();
36754
+ quickSort$1.quickSort = function (ary, comparator, start = 0) {
36755
+ let doQuickSort = sortCache.get(comparator);
36756
+ if (doQuickSort === void 0) {
36757
+ doQuickSort = cloneSort(comparator);
36758
+ sortCache.set(comparator, doQuickSort);
36759
+ }
36760
+ doQuickSort(ary, comparator, start, ary.length - 1);
37147
36761
  };
37148
36762
 
37149
36763
  /* -*- Mode: js; js-indent-level: 2; -*- */
@@ -37154,16 +36768,16 @@ quickSort$1.quickSort = function (ary, comparator) {
37154
36768
  * http://opensource.org/licenses/BSD-3-Clause
37155
36769
  */
37156
36770
 
37157
- var util$1 = util$5;
36771
+ var util = util$2;
37158
36772
  var binarySearch = binarySearch$1;
37159
36773
  var ArraySet = arraySet.ArraySet;
37160
36774
  var base64VLQ = base64Vlq;
37161
36775
  var quickSort = quickSort$1.quickSort;
37162
36776
 
37163
- function SourceMapConsumer$1(aSourceMap, aSourceMapURL) {
36777
+ function SourceMapConsumer(aSourceMap, aSourceMapURL) {
37164
36778
  var sourceMap = aSourceMap;
37165
36779
  if (typeof aSourceMap === 'string') {
37166
- sourceMap = util$1.parseSourceMapInput(aSourceMap);
36780
+ sourceMap = util.parseSourceMapInput(aSourceMap);
37167
36781
  }
37168
36782
 
37169
36783
  return sourceMap.sections != null
@@ -37171,14 +36785,14 @@ function SourceMapConsumer$1(aSourceMap, aSourceMapURL) {
37171
36785
  : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
37172
36786
  }
37173
36787
 
37174
- SourceMapConsumer$1.fromSourceMap = function(aSourceMap, aSourceMapURL) {
36788
+ SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) {
37175
36789
  return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
37176
36790
  };
37177
36791
 
37178
36792
  /**
37179
36793
  * The version of the source mapping spec that we are consuming.
37180
36794
  */
37181
- SourceMapConsumer$1.prototype._version = 3;
36795
+ SourceMapConsumer.prototype._version = 3;
37182
36796
 
37183
36797
  // `__generatedMappings` and `__originalMappings` are arrays that hold the
37184
36798
  // parsed mapping coordinates from the source map's "mappings" attribute. They
@@ -37210,8 +36824,8 @@ SourceMapConsumer$1.prototype._version = 3;
37210
36824
  //
37211
36825
  // `_originalMappings` is ordered by the original positions.
37212
36826
 
37213
- SourceMapConsumer$1.prototype.__generatedMappings = null;
37214
- Object.defineProperty(SourceMapConsumer$1.prototype, '_generatedMappings', {
36827
+ SourceMapConsumer.prototype.__generatedMappings = null;
36828
+ Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
37215
36829
  configurable: true,
37216
36830
  enumerable: true,
37217
36831
  get: function () {
@@ -37223,8 +36837,8 @@ Object.defineProperty(SourceMapConsumer$1.prototype, '_generatedMappings', {
37223
36837
  }
37224
36838
  });
37225
36839
 
37226
- SourceMapConsumer$1.prototype.__originalMappings = null;
37227
- Object.defineProperty(SourceMapConsumer$1.prototype, '_originalMappings', {
36840
+ SourceMapConsumer.prototype.__originalMappings = null;
36841
+ Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
37228
36842
  configurable: true,
37229
36843
  enumerable: true,
37230
36844
  get: function () {
@@ -37236,7 +36850,7 @@ Object.defineProperty(SourceMapConsumer$1.prototype, '_originalMappings', {
37236
36850
  }
37237
36851
  });
37238
36852
 
37239
- SourceMapConsumer$1.prototype._charIsMappingSeparator =
36853
+ SourceMapConsumer.prototype._charIsMappingSeparator =
37240
36854
  function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
37241
36855
  var c = aStr.charAt(index);
37242
36856
  return c === ";" || c === ",";
@@ -37247,16 +36861,16 @@ SourceMapConsumer$1.prototype._charIsMappingSeparator =
37247
36861
  * query (the ordered arrays in the `this.__generatedMappings` and
37248
36862
  * `this.__originalMappings` properties).
37249
36863
  */
37250
- SourceMapConsumer$1.prototype._parseMappings =
36864
+ SourceMapConsumer.prototype._parseMappings =
37251
36865
  function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
37252
36866
  throw new Error("Subclasses must implement _parseMappings");
37253
36867
  };
37254
36868
 
37255
- SourceMapConsumer$1.GENERATED_ORDER = 1;
37256
- SourceMapConsumer$1.ORIGINAL_ORDER = 2;
36869
+ SourceMapConsumer.GENERATED_ORDER = 1;
36870
+ SourceMapConsumer.ORIGINAL_ORDER = 2;
37257
36871
 
37258
- SourceMapConsumer$1.GREATEST_LOWER_BOUND = 1;
37259
- SourceMapConsumer$1.LEAST_UPPER_BOUND = 2;
36872
+ SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
36873
+ SourceMapConsumer.LEAST_UPPER_BOUND = 2;
37260
36874
 
37261
36875
  /**
37262
36876
  * Iterate over each mapping between an original source/line/column and a
@@ -37274,17 +36888,17 @@ SourceMapConsumer$1.LEAST_UPPER_BOUND = 2;
37274
36888
  * order or the original's source/line/column order, respectively. Defaults to
37275
36889
  * `SourceMapConsumer.GENERATED_ORDER`.
37276
36890
  */
37277
- SourceMapConsumer$1.prototype.eachMapping =
36891
+ SourceMapConsumer.prototype.eachMapping =
37278
36892
  function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
37279
36893
  var context = aContext || null;
37280
- var order = aOrder || SourceMapConsumer$1.GENERATED_ORDER;
36894
+ var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
37281
36895
 
37282
36896
  var mappings;
37283
36897
  switch (order) {
37284
- case SourceMapConsumer$1.GENERATED_ORDER:
36898
+ case SourceMapConsumer.GENERATED_ORDER:
37285
36899
  mappings = this._generatedMappings;
37286
36900
  break;
37287
- case SourceMapConsumer$1.ORIGINAL_ORDER:
36901
+ case SourceMapConsumer.ORIGINAL_ORDER:
37288
36902
  mappings = this._originalMappings;
37289
36903
  break;
37290
36904
  default:
@@ -37292,18 +36906,24 @@ SourceMapConsumer$1.prototype.eachMapping =
37292
36906
  }
37293
36907
 
37294
36908
  var sourceRoot = this.sourceRoot;
37295
- mappings.map(function (mapping) {
37296
- var source = mapping.source === null ? null : this._sources.at(mapping.source);
37297
- source = util$1.computeSourceURL(sourceRoot, source, this._sourceMapURL);
37298
- return {
36909
+ var boundCallback = aCallback.bind(context);
36910
+ var names = this._names;
36911
+ var sources = this._sources;
36912
+ var sourceMapURL = this._sourceMapURL;
36913
+
36914
+ for (var i = 0, n = mappings.length; i < n; i++) {
36915
+ var mapping = mappings[i];
36916
+ var source = mapping.source === null ? null : sources.at(mapping.source);
36917
+ source = util.computeSourceURL(sourceRoot, source, sourceMapURL);
36918
+ boundCallback({
37299
36919
  source: source,
37300
36920
  generatedLine: mapping.generatedLine,
37301
36921
  generatedColumn: mapping.generatedColumn,
37302
36922
  originalLine: mapping.originalLine,
37303
36923
  originalColumn: mapping.originalColumn,
37304
- name: mapping.name === null ? null : this._names.at(mapping.name)
37305
- };
37306
- }, this).forEach(aCallback, context);
36924
+ name: mapping.name === null ? null : names.at(mapping.name)
36925
+ });
36926
+ }
37307
36927
  };
37308
36928
 
37309
36929
  /**
@@ -37328,18 +36948,18 @@ SourceMapConsumer$1.prototype.eachMapping =
37328
36948
  * - column: The column number in the generated source, or null.
37329
36949
  * The column number is 0-based.
37330
36950
  */
37331
- SourceMapConsumer$1.prototype.allGeneratedPositionsFor =
36951
+ SourceMapConsumer.prototype.allGeneratedPositionsFor =
37332
36952
  function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
37333
- var line = util$1.getArg(aArgs, 'line');
36953
+ var line = util.getArg(aArgs, 'line');
37334
36954
 
37335
36955
  // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping
37336
36956
  // returns the index of the closest mapping less than the needle. By
37337
36957
  // setting needle.originalColumn to 0, we thus find the last mapping for
37338
36958
  // the given line, provided such a mapping exists.
37339
36959
  var needle = {
37340
- source: util$1.getArg(aArgs, 'source'),
36960
+ source: util.getArg(aArgs, 'source'),
37341
36961
  originalLine: line,
37342
- originalColumn: util$1.getArg(aArgs, 'column', 0)
36962
+ originalColumn: util.getArg(aArgs, 'column', 0)
37343
36963
  };
37344
36964
 
37345
36965
  needle.source = this._findSourceIndex(needle.source);
@@ -37353,7 +36973,7 @@ SourceMapConsumer$1.prototype.allGeneratedPositionsFor =
37353
36973
  this._originalMappings,
37354
36974
  "originalLine",
37355
36975
  "originalColumn",
37356
- util$1.compareByOriginalPositions,
36976
+ util.compareByOriginalPositions,
37357
36977
  binarySearch.LEAST_UPPER_BOUND);
37358
36978
  if (index >= 0) {
37359
36979
  var mapping = this._originalMappings[index];
@@ -37367,9 +36987,9 @@ SourceMapConsumer$1.prototype.allGeneratedPositionsFor =
37367
36987
  // the line we found.
37368
36988
  while (mapping && mapping.originalLine === originalLine) {
37369
36989
  mappings.push({
37370
- line: util$1.getArg(mapping, 'generatedLine', null),
37371
- column: util$1.getArg(mapping, 'generatedColumn', null),
37372
- lastColumn: util$1.getArg(mapping, 'lastGeneratedColumn', null)
36990
+ line: util.getArg(mapping, 'generatedLine', null),
36991
+ column: util.getArg(mapping, 'generatedColumn', null),
36992
+ lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
37373
36993
  });
37374
36994
 
37375
36995
  mapping = this._originalMappings[++index];
@@ -37385,9 +37005,9 @@ SourceMapConsumer$1.prototype.allGeneratedPositionsFor =
37385
37005
  mapping.originalLine === line &&
37386
37006
  mapping.originalColumn == originalColumn) {
37387
37007
  mappings.push({
37388
- line: util$1.getArg(mapping, 'generatedLine', null),
37389
- column: util$1.getArg(mapping, 'generatedColumn', null),
37390
- lastColumn: util$1.getArg(mapping, 'lastGeneratedColumn', null)
37008
+ line: util.getArg(mapping, 'generatedLine', null),
37009
+ column: util.getArg(mapping, 'generatedColumn', null),
37010
+ lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
37391
37011
  });
37392
37012
 
37393
37013
  mapping = this._originalMappings[++index];
@@ -37398,7 +37018,7 @@ SourceMapConsumer$1.prototype.allGeneratedPositionsFor =
37398
37018
  return mappings;
37399
37019
  };
37400
37020
 
37401
- sourceMapConsumer.SourceMapConsumer = SourceMapConsumer$1;
37021
+ var SourceMapConsumer_1 = SourceMapConsumer;
37402
37022
 
37403
37023
  /**
37404
37024
  * A BasicSourceMapConsumer instance represents a parsed source map which we can
@@ -37437,18 +37057,18 @@ sourceMapConsumer.SourceMapConsumer = SourceMapConsumer$1;
37437
37057
  function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
37438
37058
  var sourceMap = aSourceMap;
37439
37059
  if (typeof aSourceMap === 'string') {
37440
- sourceMap = util$1.parseSourceMapInput(aSourceMap);
37060
+ sourceMap = util.parseSourceMapInput(aSourceMap);
37441
37061
  }
37442
37062
 
37443
- var version = util$1.getArg(sourceMap, 'version');
37444
- var sources = util$1.getArg(sourceMap, 'sources');
37063
+ var version = util.getArg(sourceMap, 'version');
37064
+ var sources = util.getArg(sourceMap, 'sources');
37445
37065
  // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
37446
37066
  // requires the array) to play nice here.
37447
- var names = util$1.getArg(sourceMap, 'names', []);
37448
- var sourceRoot = util$1.getArg(sourceMap, 'sourceRoot', null);
37449
- var sourcesContent = util$1.getArg(sourceMap, 'sourcesContent', null);
37450
- var mappings = util$1.getArg(sourceMap, 'mappings');
37451
- var file = util$1.getArg(sourceMap, 'file', null);
37067
+ var names = util.getArg(sourceMap, 'names', []);
37068
+ var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
37069
+ var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
37070
+ var mappings = util.getArg(sourceMap, 'mappings');
37071
+ var file = util.getArg(sourceMap, 'file', null);
37452
37072
 
37453
37073
  // Once again, Sass deviates from the spec and supplies the version as a
37454
37074
  // string rather than a number, so we use loose equality checking here.
@@ -37457,7 +37077,7 @@ function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
37457
37077
  }
37458
37078
 
37459
37079
  if (sourceRoot) {
37460
- sourceRoot = util$1.normalize(sourceRoot);
37080
+ sourceRoot = util.normalize(sourceRoot);
37461
37081
  }
37462
37082
 
37463
37083
  sources = sources
@@ -37465,14 +37085,14 @@ function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
37465
37085
  // Some source maps produce relative source paths like "./foo.js" instead of
37466
37086
  // "foo.js". Normalize these first so that future comparisons will succeed.
37467
37087
  // See bugzil.la/1090768.
37468
- .map(util$1.normalize)
37088
+ .map(util.normalize)
37469
37089
  // Always ensure that absolute sources are internally stored relative to
37470
37090
  // the source root, if the source root is absolute. Not doing this would
37471
37091
  // be particularly problematic when the source root is a prefix of the
37472
37092
  // source (valid, but why??). See github issue #199 and bugzil.la/1188982.
37473
37093
  .map(function (source) {
37474
- return sourceRoot && util$1.isAbsolute(sourceRoot) && util$1.isAbsolute(source)
37475
- ? util$1.relative(sourceRoot, source)
37094
+ return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)
37095
+ ? util.relative(sourceRoot, source)
37476
37096
  : source;
37477
37097
  });
37478
37098
 
@@ -37484,7 +37104,7 @@ function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
37484
37104
  this._sources = ArraySet.fromArray(sources, true);
37485
37105
 
37486
37106
  this._absoluteSources = this._sources.toArray().map(function (s) {
37487
- return util$1.computeSourceURL(sourceRoot, s, aSourceMapURL);
37107
+ return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
37488
37108
  });
37489
37109
 
37490
37110
  this.sourceRoot = sourceRoot;
@@ -37494,8 +37114,8 @@ function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
37494
37114
  this.file = file;
37495
37115
  }
37496
37116
 
37497
- BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer$1.prototype);
37498
- BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer$1;
37117
+ BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
37118
+ BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
37499
37119
 
37500
37120
  /**
37501
37121
  * Utility function to find the index of a source. Returns -1 if not
@@ -37504,7 +37124,7 @@ BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer$1;
37504
37124
  BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {
37505
37125
  var relativeSource = aSource;
37506
37126
  if (this.sourceRoot != null) {
37507
- relativeSource = util$1.relative(this.sourceRoot, relativeSource);
37127
+ relativeSource = util.relative(this.sourceRoot, relativeSource);
37508
37128
  }
37509
37129
 
37510
37130
  if (this._sources.has(relativeSource)) {
@@ -37544,7 +37164,7 @@ BasicSourceMapConsumer.fromSourceMap =
37544
37164
  smc.file = aSourceMap._file;
37545
37165
  smc._sourceMapURL = aSourceMapURL;
37546
37166
  smc._absoluteSources = smc._sources.toArray().map(function (s) {
37547
- return util$1.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);
37167
+ return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);
37548
37168
  });
37549
37169
 
37550
37170
  // Because we are modifying the entries (by converting string sources and
@@ -37577,7 +37197,7 @@ BasicSourceMapConsumer.fromSourceMap =
37577
37197
  destGeneratedMappings.push(destMapping);
37578
37198
  }
37579
37199
 
37580
- quickSort(smc.__originalMappings, util$1.compareByOriginalPositions);
37200
+ quickSort(smc.__originalMappings, util.compareByOriginalPositions);
37581
37201
 
37582
37202
  return smc;
37583
37203
  };
@@ -37613,6 +37233,36 @@ function Mapping() {
37613
37233
  * query (the ordered arrays in the `this.__generatedMappings` and
37614
37234
  * `this.__originalMappings` properties).
37615
37235
  */
37236
+
37237
+ const compareGenerated = util.compareByGeneratedPositionsDeflatedNoLine;
37238
+ function sortGenerated(array, start) {
37239
+ let l = array.length;
37240
+ let n = array.length - start;
37241
+ if (n <= 1) {
37242
+ return;
37243
+ } else if (n == 2) {
37244
+ let a = array[start];
37245
+ let b = array[start + 1];
37246
+ if (compareGenerated(a, b) > 0) {
37247
+ array[start] = b;
37248
+ array[start + 1] = a;
37249
+ }
37250
+ } else if (n < 20) {
37251
+ for (let i = start; i < l; i++) {
37252
+ for (let j = i; j > start; j--) {
37253
+ let a = array[j - 1];
37254
+ let b = array[j];
37255
+ if (compareGenerated(a, b) <= 0) {
37256
+ break;
37257
+ }
37258
+ array[j - 1] = b;
37259
+ array[j] = a;
37260
+ }
37261
+ }
37262
+ } else {
37263
+ quickSort(array, compareGenerated, start);
37264
+ }
37265
+ }
37616
37266
  BasicSourceMapConsumer.prototype._parseMappings =
37617
37267
  function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
37618
37268
  var generatedLine = 1;
@@ -37623,17 +37273,20 @@ BasicSourceMapConsumer.prototype._parseMappings =
37623
37273
  var previousName = 0;
37624
37274
  var length = aStr.length;
37625
37275
  var index = 0;
37626
- var cachedSegments = {};
37627
37276
  var temp = {};
37628
37277
  var originalMappings = [];
37629
37278
  var generatedMappings = [];
37630
- var mapping, str, segment, end, value;
37279
+ var mapping, segment, end, value;
37631
37280
 
37281
+ let subarrayStart = 0;
37632
37282
  while (index < length) {
37633
37283
  if (aStr.charAt(index) === ';') {
37634
37284
  generatedLine++;
37635
37285
  index++;
37636
37286
  previousGeneratedColumn = 0;
37287
+
37288
+ sortGenerated(generatedMappings, subarrayStart);
37289
+ subarrayStart = generatedMappings.length;
37637
37290
  }
37638
37291
  else if (aStr.charAt(index) === ',') {
37639
37292
  index++;
@@ -37642,39 +37295,27 @@ BasicSourceMapConsumer.prototype._parseMappings =
37642
37295
  mapping = new Mapping();
37643
37296
  mapping.generatedLine = generatedLine;
37644
37297
 
37645
- // Because each offset is encoded relative to the previous one,
37646
- // many segments often have the same encoding. We can exploit this
37647
- // fact by caching the parsed variable length fields of each segment,
37648
- // allowing us to avoid a second parse if we encounter the same
37649
- // segment again.
37650
37298
  for (end = index; end < length; end++) {
37651
37299
  if (this._charIsMappingSeparator(aStr, end)) {
37652
37300
  break;
37653
37301
  }
37654
37302
  }
37655
- str = aStr.slice(index, end);
37656
-
37657
- segment = cachedSegments[str];
37658
- if (segment) {
37659
- index += str.length;
37660
- } else {
37661
- segment = [];
37662
- while (index < end) {
37663
- base64VLQ.decode(aStr, index, temp);
37664
- value = temp.value;
37665
- index = temp.rest;
37666
- segment.push(value);
37667
- }
37303
+ aStr.slice(index, end);
37668
37304
 
37669
- if (segment.length === 2) {
37670
- throw new Error('Found a source, but no line and column');
37671
- }
37305
+ segment = [];
37306
+ while (index < end) {
37307
+ base64VLQ.decode(aStr, index, temp);
37308
+ value = temp.value;
37309
+ index = temp.rest;
37310
+ segment.push(value);
37311
+ }
37672
37312
 
37673
- if (segment.length === 3) {
37674
- throw new Error('Found a source and line, but no column');
37675
- }
37313
+ if (segment.length === 2) {
37314
+ throw new Error('Found a source, but no line and column');
37315
+ }
37676
37316
 
37677
- cachedSegments[str] = segment;
37317
+ if (segment.length === 3) {
37318
+ throw new Error('Found a source and line, but no column');
37678
37319
  }
37679
37320
 
37680
37321
  // Generated column.
@@ -37705,16 +37346,27 @@ BasicSourceMapConsumer.prototype._parseMappings =
37705
37346
 
37706
37347
  generatedMappings.push(mapping);
37707
37348
  if (typeof mapping.originalLine === 'number') {
37708
- originalMappings.push(mapping);
37349
+ let currentSource = mapping.source;
37350
+ while (originalMappings.length <= currentSource) {
37351
+ originalMappings.push(null);
37352
+ }
37353
+ if (originalMappings[currentSource] === null) {
37354
+ originalMappings[currentSource] = [];
37355
+ }
37356
+ originalMappings[currentSource].push(mapping);
37709
37357
  }
37710
37358
  }
37711
37359
  }
37712
37360
 
37713
- quickSort(generatedMappings, util$1.compareByGeneratedPositionsDeflated);
37361
+ sortGenerated(generatedMappings, subarrayStart);
37714
37362
  this.__generatedMappings = generatedMappings;
37715
37363
 
37716
- quickSort(originalMappings, util$1.compareByOriginalPositions);
37717
- this.__originalMappings = originalMappings;
37364
+ for (var i = 0; i < originalMappings.length; i++) {
37365
+ if (originalMappings[i] != null) {
37366
+ quickSort(originalMappings[i], util.compareByOriginalPositionsNoSource);
37367
+ }
37368
+ }
37369
+ this.__originalMappings = [].concat(...originalMappings);
37718
37370
  };
37719
37371
 
37720
37372
  /**
@@ -37795,8 +37447,8 @@ BasicSourceMapConsumer.prototype.computeColumnSpans =
37795
37447
  BasicSourceMapConsumer.prototype.originalPositionFor =
37796
37448
  function SourceMapConsumer_originalPositionFor(aArgs) {
37797
37449
  var needle = {
37798
- generatedLine: util$1.getArg(aArgs, 'line'),
37799
- generatedColumn: util$1.getArg(aArgs, 'column')
37450
+ generatedLine: util.getArg(aArgs, 'line'),
37451
+ generatedColumn: util.getArg(aArgs, 'column')
37800
37452
  };
37801
37453
 
37802
37454
  var index = this._findMapping(
@@ -37804,27 +37456,27 @@ BasicSourceMapConsumer.prototype.originalPositionFor =
37804
37456
  this._generatedMappings,
37805
37457
  "generatedLine",
37806
37458
  "generatedColumn",
37807
- util$1.compareByGeneratedPositionsDeflated,
37808
- util$1.getArg(aArgs, 'bias', SourceMapConsumer$1.GREATEST_LOWER_BOUND)
37459
+ util.compareByGeneratedPositionsDeflated,
37460
+ util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
37809
37461
  );
37810
37462
 
37811
37463
  if (index >= 0) {
37812
37464
  var mapping = this._generatedMappings[index];
37813
37465
 
37814
37466
  if (mapping.generatedLine === needle.generatedLine) {
37815
- var source = util$1.getArg(mapping, 'source', null);
37467
+ var source = util.getArg(mapping, 'source', null);
37816
37468
  if (source !== null) {
37817
37469
  source = this._sources.at(source);
37818
- source = util$1.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
37470
+ source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
37819
37471
  }
37820
- var name = util$1.getArg(mapping, 'name', null);
37472
+ var name = util.getArg(mapping, 'name', null);
37821
37473
  if (name !== null) {
37822
37474
  name = this._names.at(name);
37823
37475
  }
37824
37476
  return {
37825
37477
  source: source,
37826
- line: util$1.getArg(mapping, 'originalLine', null),
37827
- column: util$1.getArg(mapping, 'originalColumn', null),
37478
+ line: util.getArg(mapping, 'originalLine', null),
37479
+ column: util.getArg(mapping, 'originalColumn', null),
37828
37480
  name: name
37829
37481
  };
37830
37482
  }
@@ -37869,12 +37521,12 @@ BasicSourceMapConsumer.prototype.sourceContentFor =
37869
37521
 
37870
37522
  var relativeSource = aSource;
37871
37523
  if (this.sourceRoot != null) {
37872
- relativeSource = util$1.relative(this.sourceRoot, relativeSource);
37524
+ relativeSource = util.relative(this.sourceRoot, relativeSource);
37873
37525
  }
37874
37526
 
37875
37527
  var url;
37876
37528
  if (this.sourceRoot != null
37877
- && (url = util$1.urlParse(this.sourceRoot))) {
37529
+ && (url = util.urlParse(this.sourceRoot))) {
37878
37530
  // XXX: file:// URIs and absolute paths lead to unexpected behavior for
37879
37531
  // many users. We can help them out when they expect file:// URIs to
37880
37532
  // behave like it would if they were running a local HTTP server. See
@@ -37928,7 +37580,7 @@ BasicSourceMapConsumer.prototype.sourceContentFor =
37928
37580
  */
37929
37581
  BasicSourceMapConsumer.prototype.generatedPositionFor =
37930
37582
  function SourceMapConsumer_generatedPositionFor(aArgs) {
37931
- var source = util$1.getArg(aArgs, 'source');
37583
+ var source = util.getArg(aArgs, 'source');
37932
37584
  source = this._findSourceIndex(source);
37933
37585
  if (source < 0) {
37934
37586
  return {
@@ -37940,8 +37592,8 @@ BasicSourceMapConsumer.prototype.generatedPositionFor =
37940
37592
 
37941
37593
  var needle = {
37942
37594
  source: source,
37943
- originalLine: util$1.getArg(aArgs, 'line'),
37944
- originalColumn: util$1.getArg(aArgs, 'column')
37595
+ originalLine: util.getArg(aArgs, 'line'),
37596
+ originalColumn: util.getArg(aArgs, 'column')
37945
37597
  };
37946
37598
 
37947
37599
  var index = this._findMapping(
@@ -37949,8 +37601,8 @@ BasicSourceMapConsumer.prototype.generatedPositionFor =
37949
37601
  this._originalMappings,
37950
37602
  "originalLine",
37951
37603
  "originalColumn",
37952
- util$1.compareByOriginalPositions,
37953
- util$1.getArg(aArgs, 'bias', SourceMapConsumer$1.GREATEST_LOWER_BOUND)
37604
+ util.compareByOriginalPositions,
37605
+ util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
37954
37606
  );
37955
37607
 
37956
37608
  if (index >= 0) {
@@ -37958,9 +37610,9 @@ BasicSourceMapConsumer.prototype.generatedPositionFor =
37958
37610
 
37959
37611
  if (mapping.source === needle.source) {
37960
37612
  return {
37961
- line: util$1.getArg(mapping, 'generatedLine', null),
37962
- column: util$1.getArg(mapping, 'generatedColumn', null),
37963
- lastColumn: util$1.getArg(mapping, 'lastGeneratedColumn', null)
37613
+ line: util.getArg(mapping, 'generatedLine', null),
37614
+ column: util.getArg(mapping, 'generatedColumn', null),
37615
+ lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
37964
37616
  };
37965
37617
  }
37966
37618
  }
@@ -37972,8 +37624,6 @@ BasicSourceMapConsumer.prototype.generatedPositionFor =
37972
37624
  };
37973
37625
  };
37974
37626
 
37975
- sourceMapConsumer.BasicSourceMapConsumer = BasicSourceMapConsumer;
37976
-
37977
37627
  /**
37978
37628
  * An IndexedSourceMapConsumer instance represents a parsed source map which
37979
37629
  * we can query for information. It differs from BasicSourceMapConsumer in
@@ -38026,11 +37676,11 @@ sourceMapConsumer.BasicSourceMapConsumer = BasicSourceMapConsumer;
38026
37676
  function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
38027
37677
  var sourceMap = aSourceMap;
38028
37678
  if (typeof aSourceMap === 'string') {
38029
- sourceMap = util$1.parseSourceMapInput(aSourceMap);
37679
+ sourceMap = util.parseSourceMapInput(aSourceMap);
38030
37680
  }
38031
37681
 
38032
- var version = util$1.getArg(sourceMap, 'version');
38033
- var sections = util$1.getArg(sourceMap, 'sections');
37682
+ var version = util.getArg(sourceMap, 'version');
37683
+ var sections = util.getArg(sourceMap, 'sections');
38034
37684
 
38035
37685
  if (version != this._version) {
38036
37686
  throw new Error('Unsupported version: ' + version);
@@ -38049,9 +37699,9 @@ function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
38049
37699
  // See https://github.com/mozilla/source-map/issues/16
38050
37700
  throw new Error('Support for url field in sections not implemented.');
38051
37701
  }
38052
- var offset = util$1.getArg(s, 'offset');
38053
- var offsetLine = util$1.getArg(offset, 'line');
38054
- var offsetColumn = util$1.getArg(offset, 'column');
37702
+ var offset = util.getArg(s, 'offset');
37703
+ var offsetLine = util.getArg(offset, 'line');
37704
+ var offsetColumn = util.getArg(offset, 'column');
38055
37705
 
38056
37706
  if (offsetLine < lastOffset.line ||
38057
37707
  (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {
@@ -38066,13 +37716,13 @@ function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
38066
37716
  generatedLine: offsetLine + 1,
38067
37717
  generatedColumn: offsetColumn + 1
38068
37718
  },
38069
- consumer: new SourceMapConsumer$1(util$1.getArg(s, 'map'), aSourceMapURL)
37719
+ consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL)
38070
37720
  }
38071
37721
  });
38072
37722
  }
38073
37723
 
38074
- IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer$1.prototype);
38075
- IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer$1;
37724
+ IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
37725
+ IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;
38076
37726
 
38077
37727
  /**
38078
37728
  * The version of the source mapping spec that we are consuming.
@@ -38116,8 +37766,8 @@ Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {
38116
37766
  IndexedSourceMapConsumer.prototype.originalPositionFor =
38117
37767
  function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
38118
37768
  var needle = {
38119
- generatedLine: util$1.getArg(aArgs, 'line'),
38120
- generatedColumn: util$1.getArg(aArgs, 'column')
37769
+ generatedLine: util.getArg(aArgs, 'line'),
37770
+ generatedColumn: util.getArg(aArgs, 'column')
38121
37771
  };
38122
37772
 
38123
37773
  // Find the section containing the generated position we're trying to map
@@ -38213,7 +37863,7 @@ IndexedSourceMapConsumer.prototype.generatedPositionFor =
38213
37863
 
38214
37864
  // Only consider this section if the requested source is in the list of
38215
37865
  // sources of the consumer.
38216
- if (section.consumer._findSourceIndex(util$1.getArg(aArgs, 'source')) === -1) {
37866
+ if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) {
38217
37867
  continue;
38218
37868
  }
38219
37869
  var generatedPosition = section.consumer.generatedPositionFor(aArgs);
@@ -38252,7 +37902,7 @@ IndexedSourceMapConsumer.prototype._parseMappings =
38252
37902
  var mapping = sectionMappings[j];
38253
37903
 
38254
37904
  var source = section.consumer._sources.at(mapping.source);
38255
- source = util$1.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);
37905
+ source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);
38256
37906
  this._sources.add(source);
38257
37907
  source = this._sources.indexOf(source);
38258
37908
 
@@ -38287,432 +37937,10 @@ IndexedSourceMapConsumer.prototype._parseMappings =
38287
37937
  }
38288
37938
  }
38289
37939
 
38290
- quickSort(this.__generatedMappings, util$1.compareByGeneratedPositionsDeflated);
38291
- quickSort(this.__originalMappings, util$1.compareByOriginalPositions);
38292
- };
38293
-
38294
- sourceMapConsumer.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
38295
-
38296
- /* -*- Mode: js; js-indent-level: 2; -*- */
38297
-
38298
- /*
38299
- * Copyright 2011 Mozilla Foundation and contributors
38300
- * Licensed under the New BSD license. See LICENSE or:
38301
- * http://opensource.org/licenses/BSD-3-Clause
38302
- */
38303
-
38304
- var SourceMapGenerator = sourceMapGenerator.SourceMapGenerator;
38305
- var util = util$5;
38306
-
38307
- // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
38308
- // operating systems these days (capturing the result).
38309
- var REGEX_NEWLINE = /(\r?\n)/;
38310
-
38311
- // Newline character code for charCodeAt() comparisons
38312
- var NEWLINE_CODE = 10;
38313
-
38314
- // Private symbol for identifying `SourceNode`s when multiple versions of
38315
- // the source-map library are loaded. This MUST NOT CHANGE across
38316
- // versions!
38317
- var isSourceNode = "$$$isSourceNode$$$";
38318
-
38319
- /**
38320
- * SourceNodes provide a way to abstract over interpolating/concatenating
38321
- * snippets of generated JavaScript source code while maintaining the line and
38322
- * column information associated with the original source code.
38323
- *
38324
- * @param aLine The original line number.
38325
- * @param aColumn The original column number.
38326
- * @param aSource The original source's filename.
38327
- * @param aChunks Optional. An array of strings which are snippets of
38328
- * generated JS, or other SourceNodes.
38329
- * @param aName The original identifier.
38330
- */
38331
- function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
38332
- this.children = [];
38333
- this.sourceContents = {};
38334
- this.line = aLine == null ? null : aLine;
38335
- this.column = aColumn == null ? null : aColumn;
38336
- this.source = aSource == null ? null : aSource;
38337
- this.name = aName == null ? null : aName;
38338
- this[isSourceNode] = true;
38339
- if (aChunks != null) this.add(aChunks);
38340
- }
38341
-
38342
- /**
38343
- * Creates a SourceNode from generated code and a SourceMapConsumer.
38344
- *
38345
- * @param aGeneratedCode The generated code
38346
- * @param aSourceMapConsumer The SourceMap for the generated code
38347
- * @param aRelativePath Optional. The path that relative sources in the
38348
- * SourceMapConsumer should be relative to.
38349
- */
38350
- SourceNode.fromStringWithSourceMap =
38351
- function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
38352
- // The SourceNode we want to fill with the generated code
38353
- // and the SourceMap
38354
- var node = new SourceNode();
38355
-
38356
- // All even indices of this array are one line of the generated code,
38357
- // while all odd indices are the newlines between two adjacent lines
38358
- // (since `REGEX_NEWLINE` captures its match).
38359
- // Processed fragments are accessed by calling `shiftNextLine`.
38360
- var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
38361
- var remainingLinesIndex = 0;
38362
- var shiftNextLine = function() {
38363
- var lineContents = getNextLine();
38364
- // The last line of a file might not have a newline.
38365
- var newLine = getNextLine() || "";
38366
- return lineContents + newLine;
38367
-
38368
- function getNextLine() {
38369
- return remainingLinesIndex < remainingLines.length ?
38370
- remainingLines[remainingLinesIndex++] : undefined;
38371
- }
38372
- };
38373
-
38374
- // We need to remember the position of "remainingLines"
38375
- var lastGeneratedLine = 1, lastGeneratedColumn = 0;
38376
-
38377
- // The generate SourceNodes we need a code range.
38378
- // To extract it current and last mapping is used.
38379
- // Here we store the last mapping.
38380
- var lastMapping = null;
38381
-
38382
- aSourceMapConsumer.eachMapping(function (mapping) {
38383
- if (lastMapping !== null) {
38384
- // We add the code from "lastMapping" to "mapping":
38385
- // First check if there is a new line in between.
38386
- if (lastGeneratedLine < mapping.generatedLine) {
38387
- // Associate first line with "lastMapping"
38388
- addMappingWithCode(lastMapping, shiftNextLine());
38389
- lastGeneratedLine++;
38390
- lastGeneratedColumn = 0;
38391
- // The remaining code is added without mapping
38392
- } else {
38393
- // There is no new line in between.
38394
- // Associate the code between "lastGeneratedColumn" and
38395
- // "mapping.generatedColumn" with "lastMapping"
38396
- var nextLine = remainingLines[remainingLinesIndex] || '';
38397
- var code = nextLine.substr(0, mapping.generatedColumn -
38398
- lastGeneratedColumn);
38399
- remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -
38400
- lastGeneratedColumn);
38401
- lastGeneratedColumn = mapping.generatedColumn;
38402
- addMappingWithCode(lastMapping, code);
38403
- // No more remaining code, continue
38404
- lastMapping = mapping;
38405
- return;
38406
- }
38407
- }
38408
- // We add the generated code until the first mapping
38409
- // to the SourceNode without any mapping.
38410
- // Each line is added as separate string.
38411
- while (lastGeneratedLine < mapping.generatedLine) {
38412
- node.add(shiftNextLine());
38413
- lastGeneratedLine++;
38414
- }
38415
- if (lastGeneratedColumn < mapping.generatedColumn) {
38416
- var nextLine = remainingLines[remainingLinesIndex] || '';
38417
- node.add(nextLine.substr(0, mapping.generatedColumn));
38418
- remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
38419
- lastGeneratedColumn = mapping.generatedColumn;
38420
- }
38421
- lastMapping = mapping;
38422
- }, this);
38423
- // We have processed all mappings.
38424
- if (remainingLinesIndex < remainingLines.length) {
38425
- if (lastMapping) {
38426
- // Associate the remaining code in the current line with "lastMapping"
38427
- addMappingWithCode(lastMapping, shiftNextLine());
38428
- }
38429
- // and add the remaining lines without any mapping
38430
- node.add(remainingLines.splice(remainingLinesIndex).join(""));
38431
- }
38432
-
38433
- // Copy sourcesContent into SourceNode
38434
- aSourceMapConsumer.sources.forEach(function (sourceFile) {
38435
- var content = aSourceMapConsumer.sourceContentFor(sourceFile);
38436
- if (content != null) {
38437
- if (aRelativePath != null) {
38438
- sourceFile = util.join(aRelativePath, sourceFile);
38439
- }
38440
- node.setSourceContent(sourceFile, content);
38441
- }
38442
- });
38443
-
38444
- return node;
38445
-
38446
- function addMappingWithCode(mapping, code) {
38447
- if (mapping === null || mapping.source === undefined) {
38448
- node.add(code);
38449
- } else {
38450
- var source = aRelativePath
38451
- ? util.join(aRelativePath, mapping.source)
38452
- : mapping.source;
38453
- node.add(new SourceNode(mapping.originalLine,
38454
- mapping.originalColumn,
38455
- source,
38456
- code,
38457
- mapping.name));
38458
- }
38459
- }
38460
- };
38461
-
38462
- /**
38463
- * Add a chunk of generated JS to this source node.
38464
- *
38465
- * @param aChunk A string snippet of generated JS code, another instance of
38466
- * SourceNode, or an array where each member is one of those things.
38467
- */
38468
- SourceNode.prototype.add = function SourceNode_add(aChunk) {
38469
- if (Array.isArray(aChunk)) {
38470
- aChunk.forEach(function (chunk) {
38471
- this.add(chunk);
38472
- }, this);
38473
- }
38474
- else if (aChunk[isSourceNode] || typeof aChunk === "string") {
38475
- if (aChunk) {
38476
- this.children.push(aChunk);
38477
- }
38478
- }
38479
- else {
38480
- throw new TypeError(
38481
- "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
38482
- );
38483
- }
38484
- return this;
38485
- };
38486
-
38487
- /**
38488
- * Add a chunk of generated JS to the beginning of this source node.
38489
- *
38490
- * @param aChunk A string snippet of generated JS code, another instance of
38491
- * SourceNode, or an array where each member is one of those things.
38492
- */
38493
- SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
38494
- if (Array.isArray(aChunk)) {
38495
- for (var i = aChunk.length-1; i >= 0; i--) {
38496
- this.prepend(aChunk[i]);
38497
- }
38498
- }
38499
- else if (aChunk[isSourceNode] || typeof aChunk === "string") {
38500
- this.children.unshift(aChunk);
38501
- }
38502
- else {
38503
- throw new TypeError(
38504
- "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
38505
- );
38506
- }
38507
- return this;
38508
- };
38509
-
38510
- /**
38511
- * Walk over the tree of JS snippets in this node and its children. The
38512
- * walking function is called once for each snippet of JS and is passed that
38513
- * snippet and the its original associated source's line/column location.
38514
- *
38515
- * @param aFn The traversal function.
38516
- */
38517
- SourceNode.prototype.walk = function SourceNode_walk(aFn) {
38518
- var chunk;
38519
- for (var i = 0, len = this.children.length; i < len; i++) {
38520
- chunk = this.children[i];
38521
- if (chunk[isSourceNode]) {
38522
- chunk.walk(aFn);
38523
- }
38524
- else {
38525
- if (chunk !== '') {
38526
- aFn(chunk, { source: this.source,
38527
- line: this.line,
38528
- column: this.column,
38529
- name: this.name });
38530
- }
38531
- }
38532
- }
38533
- };
38534
-
38535
- /**
38536
- * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
38537
- * each of `this.children`.
38538
- *
38539
- * @param aSep The separator.
38540
- */
38541
- SourceNode.prototype.join = function SourceNode_join(aSep) {
38542
- var newChildren;
38543
- var i;
38544
- var len = this.children.length;
38545
- if (len > 0) {
38546
- newChildren = [];
38547
- for (i = 0; i < len-1; i++) {
38548
- newChildren.push(this.children[i]);
38549
- newChildren.push(aSep);
38550
- }
38551
- newChildren.push(this.children[i]);
38552
- this.children = newChildren;
38553
- }
38554
- return this;
38555
- };
38556
-
38557
- /**
38558
- * Call String.prototype.replace on the very right-most source snippet. Useful
38559
- * for trimming whitespace from the end of a source node, etc.
38560
- *
38561
- * @param aPattern The pattern to replace.
38562
- * @param aReplacement The thing to replace the pattern with.
38563
- */
38564
- SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
38565
- var lastChild = this.children[this.children.length - 1];
38566
- if (lastChild[isSourceNode]) {
38567
- lastChild.replaceRight(aPattern, aReplacement);
38568
- }
38569
- else if (typeof lastChild === 'string') {
38570
- this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
38571
- }
38572
- else {
38573
- this.children.push(''.replace(aPattern, aReplacement));
38574
- }
38575
- return this;
38576
- };
38577
-
38578
- /**
38579
- * Set the source content for a source file. This will be added to the SourceMapGenerator
38580
- * in the sourcesContent field.
38581
- *
38582
- * @param aSourceFile The filename of the source file
38583
- * @param aSourceContent The content of the source file
38584
- */
38585
- SourceNode.prototype.setSourceContent =
38586
- function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
38587
- this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
38588
- };
38589
-
38590
- /**
38591
- * Walk over the tree of SourceNodes. The walking function is called for each
38592
- * source file content and is passed the filename and source content.
38593
- *
38594
- * @param aFn The traversal function.
38595
- */
38596
- SourceNode.prototype.walkSourceContents =
38597
- function SourceNode_walkSourceContents(aFn) {
38598
- for (var i = 0, len = this.children.length; i < len; i++) {
38599
- if (this.children[i][isSourceNode]) {
38600
- this.children[i].walkSourceContents(aFn);
38601
- }
38602
- }
38603
-
38604
- var sources = Object.keys(this.sourceContents);
38605
- for (var i = 0, len = sources.length; i < len; i++) {
38606
- aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
38607
- }
37940
+ quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);
37941
+ quickSort(this.__originalMappings, util.compareByOriginalPositions);
38608
37942
  };
38609
37943
 
38610
- /**
38611
- * Return the string representation of this source node. Walks over the tree
38612
- * and concatenates all the various snippets together to one string.
38613
- */
38614
- SourceNode.prototype.toString = function SourceNode_toString() {
38615
- var str = "";
38616
- this.walk(function (chunk) {
38617
- str += chunk;
38618
- });
38619
- return str;
38620
- };
38621
-
38622
- /**
38623
- * Returns the string representation of this source node along with a source
38624
- * map.
38625
- */
38626
- SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
38627
- var generated = {
38628
- code: "",
38629
- line: 1,
38630
- column: 0
38631
- };
38632
- var map = new SourceMapGenerator(aArgs);
38633
- var sourceMappingActive = false;
38634
- var lastOriginalSource = null;
38635
- var lastOriginalLine = null;
38636
- var lastOriginalColumn = null;
38637
- var lastOriginalName = null;
38638
- this.walk(function (chunk, original) {
38639
- generated.code += chunk;
38640
- if (original.source !== null
38641
- && original.line !== null
38642
- && original.column !== null) {
38643
- if(lastOriginalSource !== original.source
38644
- || lastOriginalLine !== original.line
38645
- || lastOriginalColumn !== original.column
38646
- || lastOriginalName !== original.name) {
38647
- map.addMapping({
38648
- source: original.source,
38649
- original: {
38650
- line: original.line,
38651
- column: original.column
38652
- },
38653
- generated: {
38654
- line: generated.line,
38655
- column: generated.column
38656
- },
38657
- name: original.name
38658
- });
38659
- }
38660
- lastOriginalSource = original.source;
38661
- lastOriginalLine = original.line;
38662
- lastOriginalColumn = original.column;
38663
- lastOriginalName = original.name;
38664
- sourceMappingActive = true;
38665
- } else if (sourceMappingActive) {
38666
- map.addMapping({
38667
- generated: {
38668
- line: generated.line,
38669
- column: generated.column
38670
- }
38671
- });
38672
- lastOriginalSource = null;
38673
- sourceMappingActive = false;
38674
- }
38675
- for (var idx = 0, length = chunk.length; idx < length; idx++) {
38676
- if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
38677
- generated.line++;
38678
- generated.column = 0;
38679
- // Mappings end at eol
38680
- if (idx + 1 === length) {
38681
- lastOriginalSource = null;
38682
- sourceMappingActive = false;
38683
- } else if (sourceMappingActive) {
38684
- map.addMapping({
38685
- source: original.source,
38686
- original: {
38687
- line: original.line,
38688
- column: original.column
38689
- },
38690
- generated: {
38691
- line: generated.line,
38692
- column: generated.column
38693
- },
38694
- name: original.name
38695
- });
38696
- }
38697
- } else {
38698
- generated.column++;
38699
- }
38700
- }
38701
- });
38702
- this.walkSourceContents(function (sourceFile, sourceContent) {
38703
- map.setSourceContent(sourceFile, sourceContent);
38704
- });
38705
-
38706
- return { code: generated.code, map: map };
38707
- };
38708
-
38709
- /*
38710
- * Copyright 2009-2011 Mozilla Foundation and contributors
38711
- * Licensed under the New BSD license. See LICENSE.txt or:
38712
- * http://opensource.org/licenses/BSD-3-Clause
38713
- */
38714
- var SourceMapConsumer = sourceMapConsumer.SourceMapConsumer;
38715
-
38716
37944
  /**
38717
37945
  * This file is refactored into TypeScript based on
38718
37946
  * https://github.com/preactjs/wmr/blob/main/packages/wmr/src/lib/rollup-plugin-container.js
@@ -38908,11 +38136,11 @@ async function createPluginContainer({ plugins, logger, root, build: { rollupOpt
38908
38136
  if (err.loc && ctx instanceof TransformContext) {
38909
38137
  const rawSourceMap = ctx._getCombinedSourcemap();
38910
38138
  if (rawSourceMap) {
38911
- const consumer = new SourceMapConsumer(rawSourceMap);
38139
+ const consumer = new SourceMapConsumer_1(rawSourceMap);
38912
38140
  const { source, line, column } = consumer.originalPositionFor({
38913
38141
  line: Number(err.loc.line),
38914
38142
  column: Number(err.loc.column),
38915
- bias: SourceMapConsumer.GREATEST_LOWER_BOUND
38143
+ bias: SourceMapConsumer_1.GREATEST_LOWER_BOUND
38916
38144
  });
38917
38145
  if (source) {
38918
38146
  err.loc = { file: source, line, column };
@@ -39605,8 +38833,7 @@ function loadFallbackPlugin() {
39605
38833
  };
39606
38834
  }
39607
38835
 
39608
- function resolveBuildOptions(root, raw, isBuild) {
39609
- var _a;
38836
+ function resolveBuildOptions(raw) {
39610
38837
  const resolved = {
39611
38838
  target: 'modules',
39612
38839
  polyfillModulePreload: true,
@@ -39641,35 +38868,6 @@ function resolveBuildOptions(root, raw, isBuild) {
39641
38868
  ...raw === null || raw === void 0 ? void 0 : raw.dynamicImportVarsOptions
39642
38869
  }
39643
38870
  };
39644
- const resolve = (p) => p.startsWith('\0') ? p : path__default.resolve(root, p);
39645
- resolved.outDir = resolve(resolved.outDir);
39646
- let input;
39647
- if ((_a = raw === null || raw === void 0 ? void 0 : raw.rollupOptions) === null || _a === void 0 ? void 0 : _a.input) {
39648
- input = Array.isArray(raw.rollupOptions.input)
39649
- ? raw.rollupOptions.input.map((input) => resolve(input))
39650
- : typeof raw.rollupOptions.input === 'object'
39651
- ? Object.fromEntries(Object.entries(raw.rollupOptions.input).map(([key, value]) => [
39652
- key,
39653
- resolve(value)
39654
- ]))
39655
- : resolve(raw.rollupOptions.input);
39656
- }
39657
- else if ((raw === null || raw === void 0 ? void 0 : raw.lib) && isBuild) {
39658
- input = resolve(raw.lib.entry);
39659
- }
39660
- else if (typeof (raw === null || raw === void 0 ? void 0 : raw.ssr) === 'string') {
39661
- input = resolve(raw.ssr);
39662
- }
39663
- else if (isBuild) {
39664
- input = resolve('index.html');
39665
- }
39666
- if (!!(raw === null || raw === void 0 ? void 0 : raw.ssr) && typeof input === 'string' && input.endsWith('.html')) {
39667
- throw new Error(`rollupOptions.input should not be an html file when building for SSR. ` +
39668
- `Please specify a dedicated SSR entry.`);
39669
- }
39670
- if (input) {
39671
- resolved.rollupOptions.input = input;
39672
- }
39673
38871
  // handle special build targets
39674
38872
  if (resolved.target === 'modules') {
39675
38873
  // Support browserslist
@@ -39749,18 +38947,27 @@ async function build(inlineConfig = {}) {
39749
38947
  }
39750
38948
  }
39751
38949
  async function doBuild(inlineConfig = {}) {
39752
- var _a, _b, _c;
38950
+ var _a, _b, _c, _d;
39753
38951
  const config = await resolveConfig(inlineConfig, 'build', 'production');
39754
38952
  const options = config.build;
39755
- const input = options.rollupOptions.input;
39756
- const outDir = options.outDir;
39757
38953
  const ssr = !!options.ssr;
39758
38954
  const libOptions = options.lib;
39759
38955
  config.logger.info(colors$1.cyan(`vite v${require('vite/package.json').version} ${colors$1.green(`building ${ssr ? `SSR bundle ` : ``}for ${config.mode}...`)}`));
38956
+ const resolve = (p) => path__default.resolve(config.root, p);
38957
+ const input = libOptions
38958
+ ? resolve(libOptions.entry)
38959
+ : typeof options.ssr === 'string'
38960
+ ? resolve(options.ssr)
38961
+ : ((_a = options.rollupOptions) === null || _a === void 0 ? void 0 : _a.input) || resolve('index.html');
38962
+ if (ssr && typeof input === 'string' && input.endsWith('.html')) {
38963
+ throw new Error(`rollupOptions.input should not be an html file when building for SSR. ` +
38964
+ `Please specify a dedicated SSR entry.`);
38965
+ }
38966
+ const outDir = resolve(options.outDir);
39760
38967
  // inject ssr arg to plugin load/transform hooks
39761
38968
  const plugins = (ssr ? config.plugins.map((p) => injectSsrFlagToHooks(p)) : config.plugins);
39762
38969
  // inject ssrExternal if present
39763
- const userExternal = (_a = options.rollupOptions) === null || _a === void 0 ? void 0 : _a.external;
38970
+ const userExternal = (_b = options.rollupOptions) === null || _b === void 0 ? void 0 : _b.external;
39764
38971
  let external = userExternal;
39765
38972
  if (ssr) {
39766
38973
  // see if we have cached deps data available
@@ -39779,6 +38986,7 @@ async function doBuild(inlineConfig = {}) {
39779
38986
  }
39780
38987
  const rollup = require('rollup');
39781
38988
  const rollupOptions = {
38989
+ input,
39782
38990
  context: 'globalThis',
39783
38991
  preserveEntrySignatures: ssr
39784
38992
  ? 'allow-extension'
@@ -39841,7 +39049,7 @@ async function doBuild(inlineConfig = {}) {
39841
39049
  };
39842
39050
  };
39843
39051
  // resolve lib mode outputs
39844
- const outputs = resolveBuildOutputs((_b = options.rollupOptions) === null || _b === void 0 ? void 0 : _b.output, libOptions, config.logger);
39052
+ const outputs = resolveBuildOutputs((_c = options.rollupOptions) === null || _c === void 0 ? void 0 : _c.output, libOptions, config.logger);
39845
39053
  // watch file changes with rollup
39846
39054
  if (config.build.watch) {
39847
39055
  config.logger.info(colors$1.cyan(`\nwatching for file changes...`));
@@ -39867,7 +39075,7 @@ async function doBuild(inlineConfig = {}) {
39867
39075
  ignored: [
39868
39076
  '**/node_modules/**',
39869
39077
  '**/.git/**',
39870
- ...(((_c = watcherOptions === null || watcherOptions === void 0 ? void 0 : watcherOptions.chokidar) === null || _c === void 0 ? void 0 : _c.ignored) || [])
39078
+ ...(((_d = watcherOptions === null || watcherOptions === void 0 ? void 0 : watcherOptions.chokidar) === null || _d === void 0 ? void 0 : _d.ignored) || [])
39871
39079
  ]
39872
39080
  }
39873
39081
  }
@@ -45829,7 +45037,7 @@ async function getCertificate(cacheDir) {
45829
45037
  return content;
45830
45038
  }
45831
45039
  catch {
45832
- const content = (await Promise.resolve().then(function () { return require('./dep-885d4c21.js'); })).createCertificate();
45040
+ const content = (await Promise.resolve().then(function () { return require('./dep-778bed46.js'); })).createCertificate();
45833
45041
  fs$n.promises
45834
45042
  .mkdir(cacheDir, { recursive: true })
45835
45043
  .then(() => fs$n.promises.writeFile(cachePath, content))
@@ -56689,13 +55897,11 @@ function ssrRewriteStacktrace(stack, moduleGraph) {
56689
55897
  if (!rawSourceMap) {
56690
55898
  return input;
56691
55899
  }
56692
- // In `source-map:v0.7.0+` this constructor returns a Promise...
56693
- // How can we make this block async?
56694
- const consumer = new SourceMapConsumer(rawSourceMap);
55900
+ const consumer = new SourceMapConsumer_1(rawSourceMap);
56695
55901
  const pos = consumer.originalPositionFor({
56696
55902
  line: Number(line) - offset,
56697
55903
  column: Number(column),
56698
- bias: SourceMapConsumer.LEAST_UPPER_BOUND
55904
+ bias: SourceMapConsumer_1.LEAST_UPPER_BOUND
56699
55905
  });
56700
55906
  if (!pos.source) {
56701
55907
  return input;
@@ -57026,7 +56232,9 @@ function createMissingImporterRegisterFn(server) {
57026
56232
  const newData = (server._optimizeDepsMetadata = await optimizeDeps(server.config, true, false, newDeps, ssr));
57027
56233
  knownOptimized = newData.optimized;
57028
56234
  // update ssr externals
57029
- server._ssrExternals = resolveSSRExternal(server.config, Object.keys(knownOptimized));
56235
+ if (ssr) {
56236
+ server._ssrExternals = resolveSSRExternal(server.config, Object.keys(knownOptimized));
56237
+ }
57030
56238
  logger.info(colors$1.green(`✨ dependencies updated, reloading page...`), {
57031
56239
  timestamp: true
57032
56240
  });
@@ -57073,12 +56281,14 @@ function createMissingImporterRegisterFn(server) {
57073
56281
  const ROOT_FILES = [
57074
56282
  // '.git',
57075
56283
  // https://pnpm.js.org/workspaces/
57076
- 'pnpm-workspace.yaml'
56284
+ 'pnpm-workspace.yaml',
57077
56285
  // https://rushjs.io/pages/advanced/config_files/
57078
56286
  // 'rush.json',
57079
56287
  // https://nx.dev/latest/react/getting-started/nx-setup
57080
56288
  // 'workspace.json',
57081
- // 'nx.json'
56289
+ // 'nx.json',
56290
+ // https://github.com/lerna/lerna#lernajson
56291
+ 'lerna.json'
57082
56292
  ];
57083
56293
  // npm: https://docs.npmjs.com/cli/v7/using-npm/workspaces#installing-workspaces
57084
56294
  // yarn: https://classic.yarnpkg.com/en/docs/workspaces/#toc-how-to-use-it
@@ -71349,52 +70559,33 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
71349
70559
  ].filter(Boolean);
71350
70560
  }
71351
70561
 
71352
- var main$1 = {};
71353
-
71354
- /* @flow */
71355
-
71356
- /*::
71357
-
71358
- type DotenvParseOptions = {
71359
- debug?: boolean
71360
- }
71361
-
71362
- // keys and values from src
71363
- type DotenvParseOutput = { [string]: string }
71364
-
71365
- type DotenvConfigOptions = {
71366
- path?: string, // path to .env file
71367
- encoding?: string, // encoding of .env file
71368
- debug?: string // turn on logging for debugging purposes
71369
- }
71370
-
71371
- type DotenvConfigOutput = {
71372
- parsed?: DotenvParseOutput,
71373
- error?: Error
71374
- }
71375
-
71376
- */
70562
+ var main$1 = {exports: {}};
71377
70563
 
71378
70564
  const fs = fs__default;
71379
70565
  const path = path__default;
71380
70566
  const os = require$$1__default;
71381
70567
 
71382
- function log (message /*: string */) {
70568
+ function log (message) {
71383
70569
  console.log(`[dotenv][DEBUG] ${message}`);
71384
70570
  }
71385
70571
 
71386
70572
  const NEWLINE = '\n';
71387
- const RE_INI_KEY_VAL = /^\s*([\w.-]+)\s*=\s*(.*)?\s*$/;
70573
+ const RE_INI_KEY_VAL = /^\s*([\w.-]+)\s*=\s*("[^"]*"|'[^']*'|.*?)(\s+#.*)?$/;
71388
70574
  const RE_NEWLINES = /\\n/g;
71389
70575
  const NEWLINES_MATCH = /\r\n|\n|\r/;
71390
70576
 
71391
70577
  // Parses src into an Object
71392
- function parse (src /*: string | Buffer */, options /*: ?DotenvParseOptions */) /*: DotenvParseOutput */ {
70578
+ function parse (src, options) {
71393
70579
  const debug = Boolean(options && options.debug);
70580
+ const multiline = Boolean(options && options.multiline);
71394
70581
  const obj = {};
71395
70582
 
71396
70583
  // convert Buffers before splitting into lines and processing
71397
- src.toString().split(NEWLINES_MATCH).forEach(function (line, idx) {
70584
+ const lines = src.toString().split(NEWLINES_MATCH);
70585
+
70586
+ for (let idx = 0; idx < lines.length; idx++) {
70587
+ let line = lines[idx];
70588
+
71398
70589
  // matching "KEY' and 'VAL' in 'KEY=VAL'
71399
70590
  const keyValueArr = line.match(RE_INI_KEY_VAL);
71400
70591
  // matched?
@@ -71402,12 +70593,30 @@ function parse (src /*: string | Buffer */, options /*: ?DotenvParseOptions */)
71402
70593
  const key = keyValueArr[1];
71403
70594
  // default undefined or missing values to empty string
71404
70595
  let val = (keyValueArr[2] || '');
71405
- const end = val.length - 1;
70596
+ let end = val.length - 1;
71406
70597
  const isDoubleQuoted = val[0] === '"' && val[end] === '"';
71407
70598
  const isSingleQuoted = val[0] === "'" && val[end] === "'";
71408
70599
 
70600
+ const isMultilineDoubleQuoted = val[0] === '"' && val[end] !== '"';
70601
+ const isMultilineSingleQuoted = val[0] === "'" && val[end] !== "'";
70602
+
70603
+ // if parsing line breaks and the value starts with a quote
70604
+ if (multiline && (isMultilineDoubleQuoted || isMultilineSingleQuoted)) {
70605
+ const quoteChar = isMultilineDoubleQuoted ? '"' : "'";
70606
+
70607
+ val = val.substring(1);
70608
+
70609
+ while (idx++ < lines.length - 1) {
70610
+ line = lines[idx];
70611
+ end = line.length - 1;
70612
+ if (line[end] === quoteChar) {
70613
+ val += NEWLINE + line.substring(0, end);
70614
+ break
70615
+ }
70616
+ val += NEWLINE + line;
70617
+ }
71409
70618
  // if single or double quoted, remove quotes
71410
- if (isSingleQuoted || isDoubleQuoted) {
70619
+ } else if (isSingleQuoted || isDoubleQuoted) {
71411
70620
  val = val.substring(1, end);
71412
70621
 
71413
70622
  // if double quoted, expand newlines
@@ -71421,9 +70630,14 @@ function parse (src /*: string | Buffer */, options /*: ?DotenvParseOptions */)
71421
70630
 
71422
70631
  obj[key] = val;
71423
70632
  } else if (debug) {
71424
- log(`did not match key and value when parsing line ${idx + 1}: ${line}`);
70633
+ const trimmedLine = line.trim();
70634
+
70635
+ // ignore empty and commented lines
70636
+ if (trimmedLine.length && trimmedLine[0] !== '#') {
70637
+ log(`Failed to match key and value when parsing line ${idx + 1}: ${line}`);
70638
+ }
71425
70639
  }
71426
- });
70640
+ }
71427
70641
 
71428
70642
  return obj
71429
70643
  }
@@ -71433,10 +70647,12 @@ function resolveHome (envPath) {
71433
70647
  }
71434
70648
 
71435
70649
  // Populates process.env from .env file
71436
- function config (options /*: ?DotenvConfigOptions */) /*: DotenvConfigOutput */ {
70650
+ function config (options) {
71437
70651
  let dotenvPath = path.resolve(process.cwd(), '.env');
71438
- let encoding /*: string */ = 'utf8';
71439
- let debug = false;
70652
+ let encoding = 'utf8';
70653
+ const debug = Boolean(options && options.debug);
70654
+ const override = Boolean(options && options.override);
70655
+ const multiline = Boolean(options && options.multiline);
71440
70656
 
71441
70657
  if (options) {
71442
70658
  if (options.path != null) {
@@ -71445,31 +70661,50 @@ function config (options /*: ?DotenvConfigOptions */) /*: DotenvConfigOutput */
71445
70661
  if (options.encoding != null) {
71446
70662
  encoding = options.encoding;
71447
70663
  }
71448
- if (options.debug != null) {
71449
- debug = true;
71450
- }
71451
70664
  }
71452
70665
 
71453
70666
  try {
71454
70667
  // specifying an encoding returns a string instead of a buffer
71455
- const parsed = parse(fs.readFileSync(dotenvPath, { encoding }), { debug });
70668
+ const parsed = DotenvModule.parse(fs.readFileSync(dotenvPath, { encoding }), { debug, multiline });
71456
70669
 
71457
70670
  Object.keys(parsed).forEach(function (key) {
71458
70671
  if (!Object.prototype.hasOwnProperty.call(process.env, key)) {
71459
70672
  process.env[key] = parsed[key];
71460
- } else if (debug) {
71461
- log(`"${key}" is already defined in \`process.env\` and will not be overwritten`);
70673
+ } else {
70674
+ if (override === true) {
70675
+ process.env[key] = parsed[key];
70676
+ }
70677
+
70678
+ if (debug) {
70679
+ if (override === true) {
70680
+ log(`"${key}" is already defined in \`process.env\` and WAS overwritten`);
70681
+ } else {
70682
+ log(`"${key}" is already defined in \`process.env\` and was NOT overwritten`);
70683
+ }
70684
+ }
71462
70685
  }
71463
70686
  });
71464
70687
 
71465
70688
  return { parsed }
71466
70689
  } catch (e) {
70690
+ if (debug) {
70691
+ log(`Failed to load ${dotenvPath} ${e.message}`);
70692
+ }
70693
+
71467
70694
  return { error: e }
71468
70695
  }
71469
70696
  }
71470
70697
 
71471
- main$1.config = config;
71472
- main$1.parse = parse;
70698
+ const DotenvModule = {
70699
+ config,
70700
+ parse
70701
+ };
70702
+
70703
+ main$1.exports.config = DotenvModule.config;
70704
+ main$1.exports.parse = DotenvModule.parse;
70705
+ main$1.exports = DotenvModule;
70706
+
70707
+ var dotenv = main$1.exports;
71473
70708
 
71474
70709
  var dotenvExpand = function (config) {
71475
70710
  // if ignoring process.env, use a blank object
@@ -71622,7 +70857,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development')
71622
70857
  }
71623
70858
  // resolve public base url
71624
70859
  const BASE_URL = resolveBaseUrl(config.base, command === 'build', logger);
71625
- const resolvedBuildOptions = resolveBuildOptions(resolvedRoot, config.build, command === 'build');
70860
+ const resolvedBuildOptions = resolveBuildOptions(config.build);
71626
70861
  // resolve cache directory
71627
70862
  const pkgPath = lookupFile(resolvedRoot, [`package.json`], true /* pathOnly */);
71628
70863
  const cacheDir = config.cacheDir
@@ -72100,6 +71335,7 @@ async function loadConfigFromBundledFile(fileName, bundledCode) {
72100
71335
  return config;
72101
71336
  }
72102
71337
  function loadEnv(mode, envDir, prefixes = 'VITE_') {
71338
+ var _a;
72103
71339
  if (mode === 'local') {
72104
71340
  throw new Error(`"local" cannot be used as a mode name because it conflicts with ` +
72105
71341
  `the .local postfix for .env files.`);
@@ -72123,8 +71359,8 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
72123
71359
  for (const file of envFiles) {
72124
71360
  const path = lookupFile(envDir, [file], true);
72125
71361
  if (path) {
72126
- const parsed = main$1.parse(fs__default.readFileSync(path), {
72127
- debug: !!process.env.DEBUG || undefined
71362
+ const parsed = dotenv.parse(fs__default.readFileSync(path), {
71363
+ debug: ((_a = process.env.DEBUG) === null || _a === void 0 ? void 0 : _a.includes('vite:dotenv')) || undefined
72128
71364
  });
72129
71365
  // let environment variables use each other
72130
71366
  main({
@@ -72138,7 +71374,8 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
72138
71374
  env[key] === undefined) {
72139
71375
  env[key] = value;
72140
71376
  }
72141
- else if (key === 'NODE_ENV') {
71377
+ else if (key === 'NODE_ENV' &&
71378
+ process.env.VITE_USER_NODE_ENV === undefined) {
72142
71379
  // NODE_ENV override in .env file
72143
71380
  process.env.VITE_USER_NODE_ENV = value;
72144
71381
  }