vite 5.1.5 → 5.2.0-beta.0

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.
@@ -185,7 +185,7 @@ var colors = /*@__PURE__*/getDefaultExportFromCjs(picocolorsExports);
185
185
 
186
186
  var src = {exports: {}};
187
187
 
188
- var node = {exports: {}};
188
+ var browser$1 = {exports: {}};
189
189
 
190
190
  /**
191
191
  * Helpers.
@@ -640,207 +640,201 @@ function requireCommon () {
640
640
  return common;
641
641
  }
642
642
 
643
- /**
644
- * Module dependencies.
645
- */
643
+ /* eslint-env browser */
646
644
 
647
- var hasRequiredNode;
645
+ var hasRequiredBrowser;
648
646
 
649
- function requireNode () {
650
- if (hasRequiredNode) return node.exports;
651
- hasRequiredNode = 1;
647
+ function requireBrowser () {
648
+ if (hasRequiredBrowser) return browser$1.exports;
649
+ hasRequiredBrowser = 1;
652
650
  (function (module, exports) {
653
- const tty = require$$0;
654
- const util = require$$1;
655
-
656
651
  /**
657
- * This is the Node.js implementation of `debug()`.
652
+ * This is the web browser implementation of `debug()`.
658
653
  */
659
654
 
660
- exports.init = init;
661
- exports.log = log;
662
655
  exports.formatArgs = formatArgs;
663
656
  exports.save = save;
664
657
  exports.load = load;
665
658
  exports.useColors = useColors;
666
- exports.destroy = util.deprecate(
667
- () => {},
668
- 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
669
- );
659
+ exports.storage = localstorage();
660
+ exports.destroy = (() => {
661
+ let warned = false;
662
+
663
+ return () => {
664
+ if (!warned) {
665
+ warned = true;
666
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
667
+ }
668
+ };
669
+ })();
670
670
 
671
671
  /**
672
672
  * Colors.
673
673
  */
674
674
 
675
- exports.colors = [6, 2, 3, 4, 5, 1];
676
-
677
- try {
678
- // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
679
- // eslint-disable-next-line import/no-extraneous-dependencies
680
- const supportsColor = require('supports-color');
681
-
682
- if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
683
- exports.colors = [
684
- 20,
685
- 21,
686
- 26,
687
- 27,
688
- 32,
689
- 33,
690
- 38,
691
- 39,
692
- 40,
693
- 41,
694
- 42,
695
- 43,
696
- 44,
697
- 45,
698
- 56,
699
- 57,
700
- 62,
701
- 63,
702
- 68,
703
- 69,
704
- 74,
705
- 75,
706
- 76,
707
- 77,
708
- 78,
709
- 79,
710
- 80,
711
- 81,
712
- 92,
713
- 93,
714
- 98,
715
- 99,
716
- 112,
717
- 113,
718
- 128,
719
- 129,
720
- 134,
721
- 135,
722
- 148,
723
- 149,
724
- 160,
725
- 161,
726
- 162,
727
- 163,
728
- 164,
729
- 165,
730
- 166,
731
- 167,
732
- 168,
733
- 169,
734
- 170,
735
- 171,
736
- 172,
737
- 173,
738
- 178,
739
- 179,
740
- 184,
741
- 185,
742
- 196,
743
- 197,
744
- 198,
745
- 199,
746
- 200,
747
- 201,
748
- 202,
749
- 203,
750
- 204,
751
- 205,
752
- 206,
753
- 207,
754
- 208,
755
- 209,
756
- 214,
757
- 215,
758
- 220,
759
- 221
760
- ];
761
- }
762
- } catch (error) {
763
- // Swallow - we only care if `supports-color` is available; it doesn't have to be.
764
- }
675
+ exports.colors = [
676
+ '#0000CC',
677
+ '#0000FF',
678
+ '#0033CC',
679
+ '#0033FF',
680
+ '#0066CC',
681
+ '#0066FF',
682
+ '#0099CC',
683
+ '#0099FF',
684
+ '#00CC00',
685
+ '#00CC33',
686
+ '#00CC66',
687
+ '#00CC99',
688
+ '#00CCCC',
689
+ '#00CCFF',
690
+ '#3300CC',
691
+ '#3300FF',
692
+ '#3333CC',
693
+ '#3333FF',
694
+ '#3366CC',
695
+ '#3366FF',
696
+ '#3399CC',
697
+ '#3399FF',
698
+ '#33CC00',
699
+ '#33CC33',
700
+ '#33CC66',
701
+ '#33CC99',
702
+ '#33CCCC',
703
+ '#33CCFF',
704
+ '#6600CC',
705
+ '#6600FF',
706
+ '#6633CC',
707
+ '#6633FF',
708
+ '#66CC00',
709
+ '#66CC33',
710
+ '#9900CC',
711
+ '#9900FF',
712
+ '#9933CC',
713
+ '#9933FF',
714
+ '#99CC00',
715
+ '#99CC33',
716
+ '#CC0000',
717
+ '#CC0033',
718
+ '#CC0066',
719
+ '#CC0099',
720
+ '#CC00CC',
721
+ '#CC00FF',
722
+ '#CC3300',
723
+ '#CC3333',
724
+ '#CC3366',
725
+ '#CC3399',
726
+ '#CC33CC',
727
+ '#CC33FF',
728
+ '#CC6600',
729
+ '#CC6633',
730
+ '#CC9900',
731
+ '#CC9933',
732
+ '#CCCC00',
733
+ '#CCCC33',
734
+ '#FF0000',
735
+ '#FF0033',
736
+ '#FF0066',
737
+ '#FF0099',
738
+ '#FF00CC',
739
+ '#FF00FF',
740
+ '#FF3300',
741
+ '#FF3333',
742
+ '#FF3366',
743
+ '#FF3399',
744
+ '#FF33CC',
745
+ '#FF33FF',
746
+ '#FF6600',
747
+ '#FF6633',
748
+ '#FF9900',
749
+ '#FF9933',
750
+ '#FFCC00',
751
+ '#FFCC33'
752
+ ];
765
753
 
766
754
  /**
767
- * Build up the default `inspectOpts` object from the environment variables.
755
+ * Currently only WebKit-based Web Inspectors, Firefox >= v31,
756
+ * and the Firebug extension (any Firefox version) are known
757
+ * to support "%c" CSS customizations.
768
758
  *
769
- * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
759
+ * TODO: add a `localStorage` variable to explicitly enable/disable colors
770
760
  */
771
761
 
772
- exports.inspectOpts = Object.keys(process.env).filter(key => {
773
- return /^debug_/i.test(key);
774
- }).reduce((obj, key) => {
775
- // Camel-case
776
- const prop = key
777
- .substring(6)
778
- .toLowerCase()
779
- .replace(/_([a-z])/g, (_, k) => {
780
- return k.toUpperCase();
781
- });
762
+ // eslint-disable-next-line complexity
763
+ function useColors() {
764
+ // NB: In an Electron preload script, document will be defined but not fully
765
+ // initialized. Since we know we're in Chrome, we'll just detect this case
766
+ // explicitly
767
+ if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
768
+ return true;
769
+ }
782
770
 
783
- // Coerce string value into JS value
784
- let val = process.env[key];
785
- if (/^(yes|on|true|enabled)$/i.test(val)) {
786
- val = true;
787
- } else if (/^(no|off|false|disabled)$/i.test(val)) {
788
- val = false;
789
- } else if (val === 'null') {
790
- val = null;
791
- } else {
792
- val = Number(val);
771
+ // Internet Explorer and Edge do not support colors.
772
+ if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
773
+ return false;
793
774
  }
794
775
 
795
- obj[prop] = val;
796
- return obj;
797
- }, {});
776
+ // Is webkit? http://stackoverflow.com/a/16459606/376773
777
+ // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
778
+ return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
779
+ // Is firebug? http://stackoverflow.com/a/398120/376773
780
+ (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
781
+ // Is firefox >= v31?
782
+ // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
783
+ (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
784
+ // Double check webkit in userAgent just in case we are in a worker
785
+ (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
786
+ }
798
787
 
799
788
  /**
800
- * Is stdout a TTY? Colored output is enabled when `true`.
801
- */
802
-
803
- function useColors() {
804
- return 'colors' in exports.inspectOpts ?
805
- Boolean(exports.inspectOpts.colors) :
806
- tty.isatty(process.stderr.fd);
807
- }
808
-
809
- /**
810
- * Adds ANSI color escape codes if enabled.
789
+ * Colorize log arguments if enabled.
811
790
  *
812
791
  * @api public
813
792
  */
814
793
 
815
794
  function formatArgs(args) {
816
- const {namespace: name, useColors} = this;
817
-
818
- if (useColors) {
819
- const c = this.color;
820
- const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
821
- const prefix = ` ${colorCode};1m${name} \u001B[0m`;
795
+ args[0] = (this.useColors ? '%c' : '') +
796
+ this.namespace +
797
+ (this.useColors ? ' %c' : ' ') +
798
+ args[0] +
799
+ (this.useColors ? '%c ' : ' ') +
800
+ '+' + module.exports.humanize(this.diff);
822
801
 
823
- args[0] = prefix + args[0].split('\n').join('\n' + prefix);
824
- args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
825
- } else {
826
- args[0] = getDate() + name + ' ' + args[0];
802
+ if (!this.useColors) {
803
+ return;
827
804
  }
828
- }
829
805
 
830
- function getDate() {
831
- if (exports.inspectOpts.hideDate) {
832
- return '';
833
- }
834
- return new Date().toISOString() + ' ';
806
+ const c = 'color: ' + this.color;
807
+ args.splice(1, 0, c, 'color: inherit');
808
+
809
+ // The final "%c" is somewhat tricky, because there could be other
810
+ // arguments passed either before or after the %c, so we need to
811
+ // figure out the correct index to insert the CSS into
812
+ let index = 0;
813
+ let lastC = 0;
814
+ args[0].replace(/%[a-zA-Z%]/g, match => {
815
+ if (match === '%%') {
816
+ return;
817
+ }
818
+ index++;
819
+ if (match === '%c') {
820
+ // We only are interested in the *last* %c
821
+ // (the user may have provided their own)
822
+ lastC = index;
823
+ }
824
+ });
825
+
826
+ args.splice(lastC, 0, c);
835
827
  }
836
828
 
837
829
  /**
838
- * Invokes `util.format()` with the specified arguments and writes to stderr.
830
+ * Invokes `console.debug()` when available.
831
+ * No-op when `console.debug` is not a "function".
832
+ * If `console.debug` is not available, falls back
833
+ * to `console.log`.
834
+ *
835
+ * @api public
839
836
  */
840
-
841
- function log(...args) {
842
- return process.stderr.write(util.format(...args) + '\n');
843
- }
837
+ exports.log = console.debug || console.log || (() => {});
844
838
 
845
839
  /**
846
840
  * Save `namespaces`.
@@ -849,12 +843,15 @@ function requireNode () {
849
843
  * @api private
850
844
  */
851
845
  function save(namespaces) {
852
- if (namespaces) {
853
- process.env.DEBUG = namespaces;
854
- } else {
855
- // If you set a process.env field to null or undefined, it gets cast to the
856
- // string 'null' or 'undefined'. Just delete instead.
857
- delete process.env.DEBUG;
846
+ try {
847
+ if (namespaces) {
848
+ exports.storage.setItem('debug', namespaces);
849
+ } else {
850
+ exports.storage.removeItem('debug');
851
+ }
852
+ } catch (error) {
853
+ // Swallow
854
+ // XXX (@Qix-) should we be logging these?
858
855
  }
859
856
  }
860
857
 
@@ -864,24 +861,42 @@ function requireNode () {
864
861
  * @return {String} returns the previously persisted debug modes
865
862
  * @api private
866
863
  */
867
-
868
864
  function load() {
869
- return process.env.DEBUG;
865
+ let r;
866
+ try {
867
+ r = exports.storage.getItem('debug');
868
+ } catch (error) {
869
+ // Swallow
870
+ // XXX (@Qix-) should we be logging these?
871
+ }
872
+
873
+ // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
874
+ if (!r && typeof process !== 'undefined' && 'env' in process) {
875
+ r = process.env.DEBUG;
876
+ }
877
+
878
+ return r;
870
879
  }
871
880
 
872
881
  /**
873
- * Init logic for `debug` instances.
882
+ * Localstorage attempts to return the localstorage.
874
883
  *
875
- * Create a new `inspectOpts` object in case `useColors` is set
876
- * differently for a particular `debug` instance.
884
+ * This is necessary because safari throws
885
+ * when a user disables cookies/localstorage
886
+ * and you attempt to access it.
887
+ *
888
+ * @return {LocalStorage}
889
+ * @api private
877
890
  */
878
891
 
879
- function init(debug) {
880
- debug.inspectOpts = {};
881
-
882
- const keys = Object.keys(exports.inspectOpts);
883
- for (let i = 0; i < keys.length; i++) {
884
- debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
892
+ function localstorage() {
893
+ try {
894
+ // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
895
+ // The Browser also has localStorage in the global context.
896
+ return localStorage;
897
+ } catch (error) {
898
+ // Swallow
899
+ // XXX (@Qix-) should we be logging these?
885
900
  }
886
901
  }
887
902
 
@@ -890,226 +905,223 @@ function requireNode () {
890
905
  const {formatters} = module.exports;
891
906
 
892
907
  /**
893
- * Map %o to `util.inspect()`, all on a single line.
894
- */
895
-
896
- formatters.o = function (v) {
897
- this.inspectOpts.colors = this.useColors;
898
- return util.inspect(v, this.inspectOpts)
899
- .split('\n')
900
- .map(str => str.trim())
901
- .join(' ');
902
- };
903
-
904
- /**
905
- * Map %O to `util.inspect()`, allowing multiple lines if needed.
908
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
906
909
  */
907
910
 
908
- formatters.O = function (v) {
909
- this.inspectOpts.colors = this.useColors;
910
- return util.inspect(v, this.inspectOpts);
911
+ formatters.j = function (v) {
912
+ try {
913
+ return JSON.stringify(v);
914
+ } catch (error) {
915
+ return '[UnexpectedJSONParseError]: ' + error.message;
916
+ }
911
917
  };
912
- } (node, node.exports));
913
- return node.exports;
918
+ } (browser$1, browser$1.exports));
919
+ return browser$1.exports;
914
920
  }
915
921
 
916
- var browser$1 = {exports: {}};
922
+ var node = {exports: {}};
917
923
 
918
- /* eslint-env browser */
924
+ /**
925
+ * Module dependencies.
926
+ */
919
927
 
920
- var hasRequiredBrowser;
928
+ var hasRequiredNode;
921
929
 
922
- function requireBrowser () {
923
- if (hasRequiredBrowser) return browser$1.exports;
924
- hasRequiredBrowser = 1;
930
+ function requireNode () {
931
+ if (hasRequiredNode) return node.exports;
932
+ hasRequiredNode = 1;
925
933
  (function (module, exports) {
934
+ const tty = require$$0;
935
+ const util = require$$1;
936
+
926
937
  /**
927
- * This is the web browser implementation of `debug()`.
938
+ * This is the Node.js implementation of `debug()`.
928
939
  */
929
940
 
941
+ exports.init = init;
942
+ exports.log = log;
930
943
  exports.formatArgs = formatArgs;
931
944
  exports.save = save;
932
945
  exports.load = load;
933
946
  exports.useColors = useColors;
934
- exports.storage = localstorage();
935
- exports.destroy = (() => {
936
- let warned = false;
937
-
938
- return () => {
939
- if (!warned) {
940
- warned = true;
941
- console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
942
- }
943
- };
944
- })();
947
+ exports.destroy = util.deprecate(
948
+ () => {},
949
+ 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
950
+ );
945
951
 
946
952
  /**
947
953
  * Colors.
948
954
  */
949
955
 
950
- exports.colors = [
951
- '#0000CC',
952
- '#0000FF',
953
- '#0033CC',
954
- '#0033FF',
955
- '#0066CC',
956
- '#0066FF',
957
- '#0099CC',
958
- '#0099FF',
959
- '#00CC00',
960
- '#00CC33',
961
- '#00CC66',
962
- '#00CC99',
963
- '#00CCCC',
964
- '#00CCFF',
965
- '#3300CC',
966
- '#3300FF',
967
- '#3333CC',
968
- '#3333FF',
969
- '#3366CC',
970
- '#3366FF',
971
- '#3399CC',
972
- '#3399FF',
973
- '#33CC00',
974
- '#33CC33',
975
- '#33CC66',
976
- '#33CC99',
977
- '#33CCCC',
978
- '#33CCFF',
979
- '#6600CC',
980
- '#6600FF',
981
- '#6633CC',
982
- '#6633FF',
983
- '#66CC00',
984
- '#66CC33',
985
- '#9900CC',
986
- '#9900FF',
987
- '#9933CC',
988
- '#9933FF',
989
- '#99CC00',
990
- '#99CC33',
991
- '#CC0000',
992
- '#CC0033',
993
- '#CC0066',
994
- '#CC0099',
995
- '#CC00CC',
996
- '#CC00FF',
997
- '#CC3300',
998
- '#CC3333',
999
- '#CC3366',
1000
- '#CC3399',
1001
- '#CC33CC',
1002
- '#CC33FF',
1003
- '#CC6600',
1004
- '#CC6633',
1005
- '#CC9900',
1006
- '#CC9933',
1007
- '#CCCC00',
1008
- '#CCCC33',
1009
- '#FF0000',
1010
- '#FF0033',
1011
- '#FF0066',
1012
- '#FF0099',
1013
- '#FF00CC',
1014
- '#FF00FF',
1015
- '#FF3300',
1016
- '#FF3333',
1017
- '#FF3366',
1018
- '#FF3399',
1019
- '#FF33CC',
1020
- '#FF33FF',
1021
- '#FF6600',
1022
- '#FF6633',
1023
- '#FF9900',
1024
- '#FF9933',
1025
- '#FFCC00',
1026
- '#FFCC33'
1027
- ];
956
+ exports.colors = [6, 2, 3, 4, 5, 1];
957
+
958
+ try {
959
+ // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
960
+ // eslint-disable-next-line import/no-extraneous-dependencies
961
+ const supportsColor = require('supports-color');
962
+
963
+ if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
964
+ exports.colors = [
965
+ 20,
966
+ 21,
967
+ 26,
968
+ 27,
969
+ 32,
970
+ 33,
971
+ 38,
972
+ 39,
973
+ 40,
974
+ 41,
975
+ 42,
976
+ 43,
977
+ 44,
978
+ 45,
979
+ 56,
980
+ 57,
981
+ 62,
982
+ 63,
983
+ 68,
984
+ 69,
985
+ 74,
986
+ 75,
987
+ 76,
988
+ 77,
989
+ 78,
990
+ 79,
991
+ 80,
992
+ 81,
993
+ 92,
994
+ 93,
995
+ 98,
996
+ 99,
997
+ 112,
998
+ 113,
999
+ 128,
1000
+ 129,
1001
+ 134,
1002
+ 135,
1003
+ 148,
1004
+ 149,
1005
+ 160,
1006
+ 161,
1007
+ 162,
1008
+ 163,
1009
+ 164,
1010
+ 165,
1011
+ 166,
1012
+ 167,
1013
+ 168,
1014
+ 169,
1015
+ 170,
1016
+ 171,
1017
+ 172,
1018
+ 173,
1019
+ 178,
1020
+ 179,
1021
+ 184,
1022
+ 185,
1023
+ 196,
1024
+ 197,
1025
+ 198,
1026
+ 199,
1027
+ 200,
1028
+ 201,
1029
+ 202,
1030
+ 203,
1031
+ 204,
1032
+ 205,
1033
+ 206,
1034
+ 207,
1035
+ 208,
1036
+ 209,
1037
+ 214,
1038
+ 215,
1039
+ 220,
1040
+ 221
1041
+ ];
1042
+ }
1043
+ } catch (error) {
1044
+ // Swallow - we only care if `supports-color` is available; it doesn't have to be.
1045
+ }
1028
1046
 
1029
1047
  /**
1030
- * Currently only WebKit-based Web Inspectors, Firefox >= v31,
1031
- * and the Firebug extension (any Firefox version) are known
1032
- * to support "%c" CSS customizations.
1048
+ * Build up the default `inspectOpts` object from the environment variables.
1033
1049
  *
1034
- * TODO: add a `localStorage` variable to explicitly enable/disable colors
1050
+ * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
1035
1051
  */
1036
1052
 
1037
- // eslint-disable-next-line complexity
1038
- function useColors() {
1039
- // NB: In an Electron preload script, document will be defined but not fully
1040
- // initialized. Since we know we're in Chrome, we'll just detect this case
1041
- // explicitly
1042
- if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
1043
- return true;
1044
- }
1053
+ exports.inspectOpts = Object.keys(process.env).filter(key => {
1054
+ return /^debug_/i.test(key);
1055
+ }).reduce((obj, key) => {
1056
+ // Camel-case
1057
+ const prop = key
1058
+ .substring(6)
1059
+ .toLowerCase()
1060
+ .replace(/_([a-z])/g, (_, k) => {
1061
+ return k.toUpperCase();
1062
+ });
1045
1063
 
1046
- // Internet Explorer and Edge do not support colors.
1047
- if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
1048
- return false;
1064
+ // Coerce string value into JS value
1065
+ let val = process.env[key];
1066
+ if (/^(yes|on|true|enabled)$/i.test(val)) {
1067
+ val = true;
1068
+ } else if (/^(no|off|false|disabled)$/i.test(val)) {
1069
+ val = false;
1070
+ } else if (val === 'null') {
1071
+ val = null;
1072
+ } else {
1073
+ val = Number(val);
1049
1074
  }
1050
1075
 
1051
- // Is webkit? http://stackoverflow.com/a/16459606/376773
1052
- // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
1053
- return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
1054
- // Is firebug? http://stackoverflow.com/a/398120/376773
1055
- (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
1056
- // Is firefox >= v31?
1057
- // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
1058
- (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
1059
- // Double check webkit in userAgent just in case we are in a worker
1060
- (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
1076
+ obj[prop] = val;
1077
+ return obj;
1078
+ }, {});
1079
+
1080
+ /**
1081
+ * Is stdout a TTY? Colored output is enabled when `true`.
1082
+ */
1083
+
1084
+ function useColors() {
1085
+ return 'colors' in exports.inspectOpts ?
1086
+ Boolean(exports.inspectOpts.colors) :
1087
+ tty.isatty(process.stderr.fd);
1061
1088
  }
1062
1089
 
1063
1090
  /**
1064
- * Colorize log arguments if enabled.
1091
+ * Adds ANSI color escape codes if enabled.
1065
1092
  *
1066
1093
  * @api public
1067
1094
  */
1068
1095
 
1069
1096
  function formatArgs(args) {
1070
- args[0] = (this.useColors ? '%c' : '') +
1071
- this.namespace +
1072
- (this.useColors ? ' %c' : ' ') +
1073
- args[0] +
1074
- (this.useColors ? '%c ' : ' ') +
1075
- '+' + module.exports.humanize(this.diff);
1076
-
1077
- if (!this.useColors) {
1078
- return;
1079
- }
1097
+ const {namespace: name, useColors} = this;
1080
1098
 
1081
- const c = 'color: ' + this.color;
1082
- args.splice(1, 0, c, 'color: inherit');
1099
+ if (useColors) {
1100
+ const c = this.color;
1101
+ const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
1102
+ const prefix = ` ${colorCode};1m${name} \u001B[0m`;
1083
1103
 
1084
- // The final "%c" is somewhat tricky, because there could be other
1085
- // arguments passed either before or after the %c, so we need to
1086
- // figure out the correct index to insert the CSS into
1087
- let index = 0;
1088
- let lastC = 0;
1089
- args[0].replace(/%[a-zA-Z%]/g, match => {
1090
- if (match === '%%') {
1091
- return;
1092
- }
1093
- index++;
1094
- if (match === '%c') {
1095
- // We only are interested in the *last* %c
1096
- // (the user may have provided their own)
1097
- lastC = index;
1098
- }
1099
- });
1104
+ args[0] = prefix + args[0].split('\n').join('\n' + prefix);
1105
+ args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
1106
+ } else {
1107
+ args[0] = getDate() + name + ' ' + args[0];
1108
+ }
1109
+ }
1100
1110
 
1101
- args.splice(lastC, 0, c);
1111
+ function getDate() {
1112
+ if (exports.inspectOpts.hideDate) {
1113
+ return '';
1114
+ }
1115
+ return new Date().toISOString() + ' ';
1102
1116
  }
1103
1117
 
1104
1118
  /**
1105
- * Invokes `console.debug()` when available.
1106
- * No-op when `console.debug` is not a "function".
1107
- * If `console.debug` is not available, falls back
1108
- * to `console.log`.
1109
- *
1110
- * @api public
1119
+ * Invokes `util.format()` with the specified arguments and writes to stderr.
1111
1120
  */
1112
- exports.log = console.debug || console.log || (() => {});
1121
+
1122
+ function log(...args) {
1123
+ return process.stderr.write(util.format(...args) + '\n');
1124
+ }
1113
1125
 
1114
1126
  /**
1115
1127
  * Save `namespaces`.
@@ -1118,15 +1130,12 @@ function requireBrowser () {
1118
1130
  * @api private
1119
1131
  */
1120
1132
  function save(namespaces) {
1121
- try {
1122
- if (namespaces) {
1123
- exports.storage.setItem('debug', namespaces);
1124
- } else {
1125
- exports.storage.removeItem('debug');
1126
- }
1127
- } catch (error) {
1128
- // Swallow
1129
- // XXX (@Qix-) should we be logging these?
1133
+ if (namespaces) {
1134
+ process.env.DEBUG = namespaces;
1135
+ } else {
1136
+ // If you set a process.env field to null or undefined, it gets cast to the
1137
+ // string 'null' or 'undefined'. Just delete instead.
1138
+ delete process.env.DEBUG;
1130
1139
  }
1131
1140
  }
1132
1141
 
@@ -1136,42 +1145,24 @@ function requireBrowser () {
1136
1145
  * @return {String} returns the previously persisted debug modes
1137
1146
  * @api private
1138
1147
  */
1139
- function load() {
1140
- let r;
1141
- try {
1142
- r = exports.storage.getItem('debug');
1143
- } catch (error) {
1144
- // Swallow
1145
- // XXX (@Qix-) should we be logging these?
1146
- }
1147
1148
 
1148
- // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
1149
- if (!r && typeof process !== 'undefined' && 'env' in process) {
1150
- r = process.env.DEBUG;
1151
- }
1152
-
1153
- return r;
1149
+ function load() {
1150
+ return process.env.DEBUG;
1154
1151
  }
1155
1152
 
1156
1153
  /**
1157
- * Localstorage attempts to return the localstorage.
1158
- *
1159
- * This is necessary because safari throws
1160
- * when a user disables cookies/localstorage
1161
- * and you attempt to access it.
1154
+ * Init logic for `debug` instances.
1162
1155
  *
1163
- * @return {LocalStorage}
1164
- * @api private
1156
+ * Create a new `inspectOpts` object in case `useColors` is set
1157
+ * differently for a particular `debug` instance.
1165
1158
  */
1166
1159
 
1167
- function localstorage() {
1168
- try {
1169
- // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
1170
- // The Browser also has localStorage in the global context.
1171
- return localStorage;
1172
- } catch (error) {
1173
- // Swallow
1174
- // XXX (@Qix-) should we be logging these?
1160
+ function init(debug) {
1161
+ debug.inspectOpts = {};
1162
+
1163
+ const keys = Object.keys(exports.inspectOpts);
1164
+ for (let i = 0; i < keys.length; i++) {
1165
+ debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
1175
1166
  }
1176
1167
  }
1177
1168
 
@@ -1180,18 +1171,27 @@ function requireBrowser () {
1180
1171
  const {formatters} = module.exports;
1181
1172
 
1182
1173
  /**
1183
- * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
1174
+ * Map %o to `util.inspect()`, all on a single line.
1184
1175
  */
1185
1176
 
1186
- formatters.j = function (v) {
1187
- try {
1188
- return JSON.stringify(v);
1189
- } catch (error) {
1190
- return '[UnexpectedJSONParseError]: ' + error.message;
1191
- }
1177
+ formatters.o = function (v) {
1178
+ this.inspectOpts.colors = this.useColors;
1179
+ return util.inspect(v, this.inspectOpts)
1180
+ .split('\n')
1181
+ .map(str => str.trim())
1182
+ .join(' ');
1183
+ };
1184
+
1185
+ /**
1186
+ * Map %O to `util.inspect()`, allowing multiple lines if needed.
1187
+ */
1188
+
1189
+ formatters.O = function (v) {
1190
+ this.inspectOpts.colors = this.useColors;
1191
+ return util.inspect(v, this.inspectOpts);
1192
1192
  };
1193
- } (browser$1, browser$1.exports));
1194
- return browser$1.exports;
1193
+ } (node, node.exports));
1194
+ return node.exports;
1195
1195
  }
1196
1196
 
1197
1197
  /**
@@ -3524,7 +3524,7 @@ function mergeConfigRecursively(defaults, overrides, rootPath) {
3524
3524
  continue;
3525
3525
  }
3526
3526
  if (Array.isArray(existing) || Array.isArray(value)) {
3527
- merged[key] = [...arraify(existing ?? []), ...arraify(value ?? [])];
3527
+ merged[key] = [...arraify(existing), ...arraify(value)];
3528
3528
  continue;
3529
3529
  }
3530
3530
  if (isObject$1(existing) && isObject$1(value)) {
@@ -4383,9 +4383,12 @@ class Mappings {
4383
4383
 
4384
4384
  addEdit(sourceIndex, content, loc, nameIndex) {
4385
4385
  if (content.length) {
4386
+ const contentLengthMinusOne = content.length - 1;
4386
4387
  let contentLineEnd = content.indexOf('\n', 0);
4387
4388
  let previousContentLineEnd = -1;
4388
- while (contentLineEnd >= 0) {
4389
+ // Loop through each line in the content and add a segment, but stop if the last line is empty,
4390
+ // else code afterwards would fill one line too many
4391
+ while (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) {
4389
4392
  const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
4390
4393
  if (nameIndex >= 0) {
4391
4394
  segment.push(nameIndex);