vite 5.0.0-beta.9 → 5.0.1

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