vite 5.0.0-beta.1 → 5.0.0-beta.11
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.
- package/LICENSE.md +74 -3
- package/client.d.ts +8 -56
- package/dist/client/client.mjs +17 -0
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-6db0c752.js → dep-HpI8v4GP.js} +145 -145
- package/dist/node/chunks/{dep-e31699fa.js → dep-kPX9VBbU.js} +3726 -4094
- package/dist/node/chunks/{dep-c457d7ce.js → dep-rMlk0HEr.js} +2 -2
- package/dist/node/cli.js +15 -13
- package/dist/node/index.d.ts +3274 -3503
- package/dist/node/index.js +8 -6
- package/dist/node-cjs/publicUtils.cjs +816 -510
- package/index.cjs +13 -9
- package/index.d.cts +6 -0
- package/package.json +39 -36
- package/types/hot.d.ts +4 -0
- package/types/import-meta.d.ts +5 -0
- /package/dist/node/chunks/{dep-c423598f.js → dep-8a-6Quh6.js} +0 -0
- /package/dist/node/chunks/{dep-f0c7dae0.js → dep-kjUoH5nk.js} +0 -0
|
@@ -15,7 +15,8 @@ var fs$2 = require('fs');
|
|
|
15
15
|
var readline = require('node:readline');
|
|
16
16
|
var require$$2 = require('os');
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
19
|
+
const { version: version$2 } = JSON.parse(fs$1.readFileSync(new URL('../../package.json', (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href)))).toString());
|
|
19
20
|
const VERSION = version$2;
|
|
20
21
|
/**
|
|
21
22
|
* Prefix for resolved fs paths, since windows paths may not be valid as URLs.
|
|
@@ -23,32 +24,11 @@ const VERSION = version$2;
|
|
|
23
24
|
const FS_PREFIX = `/@fs/`;
|
|
24
25
|
const VITE_PACKAGE_DIR = path$3.resolve(
|
|
25
26
|
// import.meta.url is `dist/node/constants.js` after bundle
|
|
26
|
-
node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (
|
|
27
|
+
node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href))), '../../..');
|
|
27
28
|
const CLIENT_ENTRY = path$3.resolve(VITE_PACKAGE_DIR, 'dist/client/client.mjs');
|
|
28
29
|
path$3.resolve(VITE_PACKAGE_DIR, 'dist/client/env.mjs');
|
|
29
30
|
path$3.dirname(CLIENT_ENTRY);
|
|
30
31
|
|
|
31
|
-
const chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
32
|
-
const intToChar$1 = new Uint8Array(64); // 64 possible chars.
|
|
33
|
-
const charToInt$1 = new Uint8Array(128); // z is 122 in ASCII
|
|
34
|
-
for (let i = 0; i < chars$1.length; i++) {
|
|
35
|
-
const c = chars$1.charCodeAt(i);
|
|
36
|
-
intToChar$1[i] = c;
|
|
37
|
-
charToInt$1[c] = i;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Matches the scheme of a URL, eg "http://"
|
|
41
|
-
var UrlType;
|
|
42
|
-
(function (UrlType) {
|
|
43
|
-
UrlType[UrlType["Empty"] = 1] = "Empty";
|
|
44
|
-
UrlType[UrlType["Hash"] = 2] = "Hash";
|
|
45
|
-
UrlType[UrlType["Query"] = 3] = "Query";
|
|
46
|
-
UrlType[UrlType["RelativePath"] = 4] = "RelativePath";
|
|
47
|
-
UrlType[UrlType["AbsolutePath"] = 5] = "AbsolutePath";
|
|
48
|
-
UrlType[UrlType["SchemeRelative"] = 6] = "SchemeRelative";
|
|
49
|
-
UrlType[UrlType["Absolute"] = 7] = "Absolute";
|
|
50
|
-
})(UrlType || (UrlType = {}));
|
|
51
|
-
|
|
52
32
|
const comma = ','.charCodeAt(0);
|
|
53
33
|
const semicolon = ';'.charCodeAt(0);
|
|
54
34
|
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
@@ -137,6 +117,18 @@ function encodeInteger(buf, pos, state, segment, j) {
|
|
|
137
117
|
return pos;
|
|
138
118
|
}
|
|
139
119
|
|
|
120
|
+
// Matches the scheme of a URL, eg "http://"
|
|
121
|
+
var UrlType;
|
|
122
|
+
(function (UrlType) {
|
|
123
|
+
UrlType[UrlType["Empty"] = 1] = "Empty";
|
|
124
|
+
UrlType[UrlType["Hash"] = 2] = "Hash";
|
|
125
|
+
UrlType[UrlType["Query"] = 3] = "Query";
|
|
126
|
+
UrlType[UrlType["RelativePath"] = 4] = "RelativePath";
|
|
127
|
+
UrlType[UrlType["AbsolutePath"] = 5] = "AbsolutePath";
|
|
128
|
+
UrlType[UrlType["SchemeRelative"] = 6] = "SchemeRelative";
|
|
129
|
+
UrlType[UrlType["Absolute"] = 7] = "Absolute";
|
|
130
|
+
})(UrlType || (UrlType = {}));
|
|
131
|
+
|
|
140
132
|
function getDefaultExportFromCjs (x) {
|
|
141
133
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
142
134
|
}
|
|
@@ -207,7 +199,7 @@ var colors = /*@__PURE__*/getDefaultExportFromCjs(picocolorsExports);
|
|
|
207
199
|
|
|
208
200
|
var src = {exports: {}};
|
|
209
201
|
|
|
210
|
-
var
|
|
202
|
+
var node = {exports: {}};
|
|
211
203
|
|
|
212
204
|
/**
|
|
213
205
|
* Helpers.
|
|
@@ -662,201 +654,207 @@ function requireCommon () {
|
|
|
662
654
|
return common;
|
|
663
655
|
}
|
|
664
656
|
|
|
665
|
-
|
|
657
|
+
/**
|
|
658
|
+
* Module dependencies.
|
|
659
|
+
*/
|
|
666
660
|
|
|
667
|
-
var
|
|
661
|
+
var hasRequiredNode;
|
|
668
662
|
|
|
669
|
-
function
|
|
670
|
-
if (
|
|
671
|
-
|
|
663
|
+
function requireNode () {
|
|
664
|
+
if (hasRequiredNode) return node.exports;
|
|
665
|
+
hasRequiredNode = 1;
|
|
672
666
|
(function (module, exports) {
|
|
667
|
+
const tty = require$$0;
|
|
668
|
+
const util = require$$1;
|
|
669
|
+
|
|
673
670
|
/**
|
|
674
|
-
* This is the
|
|
671
|
+
* This is the Node.js implementation of `debug()`.
|
|
675
672
|
*/
|
|
676
673
|
|
|
674
|
+
exports.init = init;
|
|
675
|
+
exports.log = log;
|
|
677
676
|
exports.formatArgs = formatArgs;
|
|
678
677
|
exports.save = save;
|
|
679
678
|
exports.load = load;
|
|
680
679
|
exports.useColors = useColors;
|
|
681
|
-
exports.
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
return () => {
|
|
686
|
-
if (!warned) {
|
|
687
|
-
warned = true;
|
|
688
|
-
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
689
|
-
}
|
|
690
|
-
};
|
|
691
|
-
})();
|
|
680
|
+
exports.destroy = util.deprecate(
|
|
681
|
+
() => {},
|
|
682
|
+
'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
|
|
683
|
+
);
|
|
692
684
|
|
|
693
685
|
/**
|
|
694
686
|
* Colors.
|
|
695
687
|
*/
|
|
696
688
|
|
|
697
|
-
exports.colors = [
|
|
698
|
-
'#0000CC',
|
|
699
|
-
'#0000FF',
|
|
700
|
-
'#0033CC',
|
|
701
|
-
'#0033FF',
|
|
702
|
-
'#0066CC',
|
|
703
|
-
'#0066FF',
|
|
704
|
-
'#0099CC',
|
|
705
|
-
'#0099FF',
|
|
706
|
-
'#00CC00',
|
|
707
|
-
'#00CC33',
|
|
708
|
-
'#00CC66',
|
|
709
|
-
'#00CC99',
|
|
710
|
-
'#00CCCC',
|
|
711
|
-
'#00CCFF',
|
|
712
|
-
'#3300CC',
|
|
713
|
-
'#3300FF',
|
|
714
|
-
'#3333CC',
|
|
715
|
-
'#3333FF',
|
|
716
|
-
'#3366CC',
|
|
717
|
-
'#3366FF',
|
|
718
|
-
'#3399CC',
|
|
719
|
-
'#3399FF',
|
|
720
|
-
'#33CC00',
|
|
721
|
-
'#33CC33',
|
|
722
|
-
'#33CC66',
|
|
723
|
-
'#33CC99',
|
|
724
|
-
'#33CCCC',
|
|
725
|
-
'#33CCFF',
|
|
726
|
-
'#6600CC',
|
|
727
|
-
'#6600FF',
|
|
728
|
-
'#6633CC',
|
|
729
|
-
'#6633FF',
|
|
730
|
-
'#66CC00',
|
|
731
|
-
'#66CC33',
|
|
732
|
-
'#9900CC',
|
|
733
|
-
'#9900FF',
|
|
734
|
-
'#9933CC',
|
|
735
|
-
'#9933FF',
|
|
736
|
-
'#99CC00',
|
|
737
|
-
'#99CC33',
|
|
738
|
-
'#CC0000',
|
|
739
|
-
'#CC0033',
|
|
740
|
-
'#CC0066',
|
|
741
|
-
'#CC0099',
|
|
742
|
-
'#CC00CC',
|
|
743
|
-
'#CC00FF',
|
|
744
|
-
'#CC3300',
|
|
745
|
-
'#CC3333',
|
|
746
|
-
'#CC3366',
|
|
747
|
-
'#CC3399',
|
|
748
|
-
'#CC33CC',
|
|
749
|
-
'#CC33FF',
|
|
750
|
-
'#CC6600',
|
|
751
|
-
'#CC6633',
|
|
752
|
-
'#CC9900',
|
|
753
|
-
'#CC9933',
|
|
754
|
-
'#CCCC00',
|
|
755
|
-
'#CCCC33',
|
|
756
|
-
'#FF0000',
|
|
757
|
-
'#FF0033',
|
|
758
|
-
'#FF0066',
|
|
759
|
-
'#FF0099',
|
|
760
|
-
'#FF00CC',
|
|
761
|
-
'#FF00FF',
|
|
762
|
-
'#FF3300',
|
|
763
|
-
'#FF3333',
|
|
764
|
-
'#FF3366',
|
|
765
|
-
'#FF3399',
|
|
766
|
-
'#FF33CC',
|
|
767
|
-
'#FF33FF',
|
|
768
|
-
'#FF6600',
|
|
769
|
-
'#FF6633',
|
|
770
|
-
'#FF9900',
|
|
771
|
-
'#FF9933',
|
|
772
|
-
'#FFCC00',
|
|
773
|
-
'#FFCC33'
|
|
774
|
-
];
|
|
775
|
-
|
|
776
|
-
/**
|
|
777
|
-
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
|
778
|
-
* and the Firebug extension (any Firefox version) are known
|
|
779
|
-
* to support "%c" CSS customizations.
|
|
780
|
-
*
|
|
781
|
-
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
782
|
-
*/
|
|
689
|
+
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
783
690
|
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
//
|
|
787
|
-
|
|
788
|
-
// explicitly
|
|
789
|
-
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
|
790
|
-
return true;
|
|
791
|
-
}
|
|
691
|
+
try {
|
|
692
|
+
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
|
|
693
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
694
|
+
const supportsColor = require('supports-color');
|
|
792
695
|
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
696
|
+
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
697
|
+
exports.colors = [
|
|
698
|
+
20,
|
|
699
|
+
21,
|
|
700
|
+
26,
|
|
701
|
+
27,
|
|
702
|
+
32,
|
|
703
|
+
33,
|
|
704
|
+
38,
|
|
705
|
+
39,
|
|
706
|
+
40,
|
|
707
|
+
41,
|
|
708
|
+
42,
|
|
709
|
+
43,
|
|
710
|
+
44,
|
|
711
|
+
45,
|
|
712
|
+
56,
|
|
713
|
+
57,
|
|
714
|
+
62,
|
|
715
|
+
63,
|
|
716
|
+
68,
|
|
717
|
+
69,
|
|
718
|
+
74,
|
|
719
|
+
75,
|
|
720
|
+
76,
|
|
721
|
+
77,
|
|
722
|
+
78,
|
|
723
|
+
79,
|
|
724
|
+
80,
|
|
725
|
+
81,
|
|
726
|
+
92,
|
|
727
|
+
93,
|
|
728
|
+
98,
|
|
729
|
+
99,
|
|
730
|
+
112,
|
|
731
|
+
113,
|
|
732
|
+
128,
|
|
733
|
+
129,
|
|
734
|
+
134,
|
|
735
|
+
135,
|
|
736
|
+
148,
|
|
737
|
+
149,
|
|
738
|
+
160,
|
|
739
|
+
161,
|
|
740
|
+
162,
|
|
741
|
+
163,
|
|
742
|
+
164,
|
|
743
|
+
165,
|
|
744
|
+
166,
|
|
745
|
+
167,
|
|
746
|
+
168,
|
|
747
|
+
169,
|
|
748
|
+
170,
|
|
749
|
+
171,
|
|
750
|
+
172,
|
|
751
|
+
173,
|
|
752
|
+
178,
|
|
753
|
+
179,
|
|
754
|
+
184,
|
|
755
|
+
185,
|
|
756
|
+
196,
|
|
757
|
+
197,
|
|
758
|
+
198,
|
|
759
|
+
199,
|
|
760
|
+
200,
|
|
761
|
+
201,
|
|
762
|
+
202,
|
|
763
|
+
203,
|
|
764
|
+
204,
|
|
765
|
+
205,
|
|
766
|
+
206,
|
|
767
|
+
207,
|
|
768
|
+
208,
|
|
769
|
+
209,
|
|
770
|
+
214,
|
|
771
|
+
215,
|
|
772
|
+
220,
|
|
773
|
+
221
|
|
774
|
+
];
|
|
796
775
|
}
|
|
797
|
-
|
|
798
|
-
//
|
|
799
|
-
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
|
800
|
-
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
|
801
|
-
// Is firebug? http://stackoverflow.com/a/398120/376773
|
|
802
|
-
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
|
803
|
-
// Is firefox >= v31?
|
|
804
|
-
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
805
|
-
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
|
806
|
-
// Double check webkit in userAgent just in case we are in a worker
|
|
807
|
-
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
|
776
|
+
} catch (error) {
|
|
777
|
+
// Swallow - we only care if `supports-color` is available; it doesn't have to be.
|
|
808
778
|
}
|
|
809
779
|
|
|
810
780
|
/**
|
|
811
|
-
*
|
|
781
|
+
* Build up the default `inspectOpts` object from the environment variables.
|
|
812
782
|
*
|
|
813
|
-
*
|
|
783
|
+
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
|
814
784
|
*/
|
|
815
785
|
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
(
|
|
822
|
-
|
|
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
|
+
});
|
|
823
796
|
|
|
824
|
-
|
|
825
|
-
|
|
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);
|
|
826
807
|
}
|
|
827
808
|
|
|
828
|
-
|
|
829
|
-
|
|
809
|
+
obj[prop] = val;
|
|
810
|
+
return obj;
|
|
811
|
+
}, {});
|
|
830
812
|
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
let index = 0;
|
|
835
|
-
let lastC = 0;
|
|
836
|
-
args[0].replace(/%[a-zA-Z%]/g, match => {
|
|
837
|
-
if (match === '%%') {
|
|
838
|
-
return;
|
|
839
|
-
}
|
|
840
|
-
index++;
|
|
841
|
-
if (match === '%c') {
|
|
842
|
-
// We only are interested in the *last* %c
|
|
843
|
-
// (the user may have provided their own)
|
|
844
|
-
lastC = index;
|
|
845
|
-
}
|
|
846
|
-
});
|
|
813
|
+
/**
|
|
814
|
+
* Is stdout a TTY? Colored output is enabled when `true`.
|
|
815
|
+
*/
|
|
847
816
|
|
|
848
|
-
|
|
817
|
+
function useColors() {
|
|
818
|
+
return 'colors' in exports.inspectOpts ?
|
|
819
|
+
Boolean(exports.inspectOpts.colors) :
|
|
820
|
+
tty.isatty(process.stderr.fd);
|
|
849
821
|
}
|
|
850
822
|
|
|
851
823
|
/**
|
|
852
|
-
*
|
|
853
|
-
* No-op when `console.debug` is not a "function".
|
|
854
|
-
* If `console.debug` is not available, falls back
|
|
855
|
-
* to `console.log`.
|
|
824
|
+
* Adds ANSI color escape codes if enabled.
|
|
856
825
|
*
|
|
857
826
|
* @api public
|
|
858
827
|
*/
|
|
859
|
-
|
|
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
|
+
}
|
|
860
858
|
|
|
861
859
|
/**
|
|
862
860
|
* Save `namespaces`.
|
|
@@ -865,15 +863,12 @@ function requireBrowser () {
|
|
|
865
863
|
* @api private
|
|
866
864
|
*/
|
|
867
865
|
function save(namespaces) {
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
} catch (error) {
|
|
875
|
-
// Swallow
|
|
876
|
-
// XXX (@Qix-) should we be logging these?
|
|
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;
|
|
877
872
|
}
|
|
878
873
|
}
|
|
879
874
|
|
|
@@ -883,42 +878,24 @@ function requireBrowser () {
|
|
|
883
878
|
* @return {String} returns the previously persisted debug modes
|
|
884
879
|
* @api private
|
|
885
880
|
*/
|
|
886
|
-
function load() {
|
|
887
|
-
let r;
|
|
888
|
-
try {
|
|
889
|
-
r = exports.storage.getItem('debug');
|
|
890
|
-
} catch (error) {
|
|
891
|
-
// Swallow
|
|
892
|
-
// XXX (@Qix-) should we be logging these?
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
|
896
|
-
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
|
897
|
-
r = process.env.DEBUG;
|
|
898
|
-
}
|
|
899
881
|
|
|
900
|
-
|
|
882
|
+
function load() {
|
|
883
|
+
return process.env.DEBUG;
|
|
901
884
|
}
|
|
902
885
|
|
|
903
886
|
/**
|
|
904
|
-
*
|
|
905
|
-
*
|
|
906
|
-
* This is necessary because safari throws
|
|
907
|
-
* when a user disables cookies/localstorage
|
|
908
|
-
* and you attempt to access it.
|
|
887
|
+
* Init logic for `debug` instances.
|
|
909
888
|
*
|
|
910
|
-
*
|
|
911
|
-
*
|
|
889
|
+
* Create a new `inspectOpts` object in case `useColors` is set
|
|
890
|
+
* differently for a particular `debug` instance.
|
|
912
891
|
*/
|
|
913
892
|
|
|
914
|
-
function
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
// Swallow
|
|
921
|
-
// XXX (@Qix-) should we be logging these?
|
|
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]];
|
|
922
899
|
}
|
|
923
900
|
}
|
|
924
901
|
|
|
@@ -927,223 +904,226 @@ function requireBrowser () {
|
|
|
927
904
|
const {formatters} = module.exports;
|
|
928
905
|
|
|
929
906
|
/**
|
|
930
|
-
* Map %
|
|
907
|
+
* Map %o to `util.inspect()`, all on a single line.
|
|
931
908
|
*/
|
|
932
909
|
|
|
933
|
-
formatters.
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
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);
|
|
939
925
|
};
|
|
940
|
-
} (
|
|
941
|
-
return
|
|
926
|
+
} (node, node.exports));
|
|
927
|
+
return node.exports;
|
|
942
928
|
}
|
|
943
929
|
|
|
944
|
-
var
|
|
930
|
+
var browser$1 = {exports: {}};
|
|
945
931
|
|
|
946
|
-
|
|
947
|
-
* Module dependencies.
|
|
948
|
-
*/
|
|
932
|
+
/* eslint-env browser */
|
|
949
933
|
|
|
950
|
-
var
|
|
934
|
+
var hasRequiredBrowser;
|
|
951
935
|
|
|
952
|
-
function
|
|
953
|
-
if (
|
|
954
|
-
|
|
936
|
+
function requireBrowser () {
|
|
937
|
+
if (hasRequiredBrowser) return browser$1.exports;
|
|
938
|
+
hasRequiredBrowser = 1;
|
|
955
939
|
(function (module, exports) {
|
|
956
|
-
const tty = require$$0;
|
|
957
|
-
const util = require$$1;
|
|
958
|
-
|
|
959
940
|
/**
|
|
960
|
-
* This is the
|
|
941
|
+
* This is the web browser implementation of `debug()`.
|
|
961
942
|
*/
|
|
962
943
|
|
|
963
|
-
exports.init = init;
|
|
964
|
-
exports.log = log;
|
|
965
944
|
exports.formatArgs = formatArgs;
|
|
966
945
|
exports.save = save;
|
|
967
946
|
exports.load = load;
|
|
968
947
|
exports.useColors = useColors;
|
|
969
|
-
exports.
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
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
|
+
})();
|
|
973
959
|
|
|
974
960
|
/**
|
|
975
961
|
* Colors.
|
|
976
962
|
*/
|
|
977
963
|
|
|
978
|
-
exports.colors = [
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
207,
|
|
1057
|
-
208,
|
|
1058
|
-
209,
|
|
1059
|
-
214,
|
|
1060
|
-
215,
|
|
1061
|
-
220,
|
|
1062
|
-
221
|
|
1063
|
-
];
|
|
1064
|
-
}
|
|
1065
|
-
} catch (error) {
|
|
1066
|
-
// Swallow - we only care if `supports-color` is available; it doesn't have to be.
|
|
1067
|
-
}
|
|
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
|
+
];
|
|
1068
1042
|
|
|
1069
1043
|
/**
|
|
1070
|
-
*
|
|
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.
|
|
1071
1047
|
*
|
|
1072
|
-
*
|
|
1048
|
+
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
1073
1049
|
*/
|
|
1074
1050
|
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
//
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
.replace(/_([a-z])/g, (_, k) => {
|
|
1083
|
-
return k.toUpperCase();
|
|
1084
|
-
});
|
|
1085
|
-
|
|
1086
|
-
// Coerce string value into JS value
|
|
1087
|
-
let val = process.env[key];
|
|
1088
|
-
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
|
1089
|
-
val = true;
|
|
1090
|
-
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
|
1091
|
-
val = false;
|
|
1092
|
-
} else if (val === 'null') {
|
|
1093
|
-
val = null;
|
|
1094
|
-
} else {
|
|
1095
|
-
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;
|
|
1096
1058
|
}
|
|
1097
1059
|
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
/**
|
|
1103
|
-
* Is stdout a TTY? Colored output is enabled when `true`.
|
|
1104
|
-
*/
|
|
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
|
+
}
|
|
1105
1064
|
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
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+)/));
|
|
1110
1075
|
}
|
|
1111
1076
|
|
|
1112
1077
|
/**
|
|
1113
|
-
*
|
|
1078
|
+
* Colorize log arguments if enabled.
|
|
1114
1079
|
*
|
|
1115
1080
|
* @api public
|
|
1116
1081
|
*/
|
|
1117
1082
|
|
|
1118
1083
|
function formatArgs(args) {
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
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);
|
|
1125
1090
|
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
} else {
|
|
1129
|
-
args[0] = getDate() + name + ' ' + args[0];
|
|
1091
|
+
if (!this.useColors) {
|
|
1092
|
+
return;
|
|
1130
1093
|
}
|
|
1131
|
-
}
|
|
1132
1094
|
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
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);
|
|
1138
1116
|
}
|
|
1139
1117
|
|
|
1140
1118
|
/**
|
|
1141
|
-
* Invokes `
|
|
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
|
|
1142
1125
|
*/
|
|
1143
|
-
|
|
1144
|
-
function log(...args) {
|
|
1145
|
-
return process.stderr.write(util.format(...args) + '\n');
|
|
1146
|
-
}
|
|
1126
|
+
exports.log = console.debug || console.log || (() => {});
|
|
1147
1127
|
|
|
1148
1128
|
/**
|
|
1149
1129
|
* Save `namespaces`.
|
|
@@ -1152,12 +1132,15 @@ function requireNode () {
|
|
|
1152
1132
|
* @api private
|
|
1153
1133
|
*/
|
|
1154
1134
|
function save(namespaces) {
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
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?
|
|
1161
1144
|
}
|
|
1162
1145
|
}
|
|
1163
1146
|
|
|
@@ -1167,24 +1150,42 @@ function requireNode () {
|
|
|
1167
1150
|
* @return {String} returns the previously persisted debug modes
|
|
1168
1151
|
* @api private
|
|
1169
1152
|
*/
|
|
1170
|
-
|
|
1171
1153
|
function load() {
|
|
1172
|
-
|
|
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;
|
|
1173
1168
|
}
|
|
1174
1169
|
|
|
1175
1170
|
/**
|
|
1176
|
-
*
|
|
1171
|
+
* Localstorage attempts to return the localstorage.
|
|
1177
1172
|
*
|
|
1178
|
-
*
|
|
1179
|
-
*
|
|
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
|
|
1180
1179
|
*/
|
|
1181
1180
|
|
|
1182
|
-
function
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
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?
|
|
1188
1189
|
}
|
|
1189
1190
|
}
|
|
1190
1191
|
|
|
@@ -1193,27 +1194,18 @@ function requireNode () {
|
|
|
1193
1194
|
const {formatters} = module.exports;
|
|
1194
1195
|
|
|
1195
1196
|
/**
|
|
1196
|
-
* Map %
|
|
1197
|
-
*/
|
|
1198
|
-
|
|
1199
|
-
formatters.o = function (v) {
|
|
1200
|
-
this.inspectOpts.colors = this.useColors;
|
|
1201
|
-
return util.inspect(v, this.inspectOpts)
|
|
1202
|
-
.split('\n')
|
|
1203
|
-
.map(str => str.trim())
|
|
1204
|
-
.join(' ');
|
|
1205
|
-
};
|
|
1206
|
-
|
|
1207
|
-
/**
|
|
1208
|
-
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
|
1197
|
+
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|
1209
1198
|
*/
|
|
1210
1199
|
|
|
1211
|
-
formatters.
|
|
1212
|
-
|
|
1213
|
-
|
|
1200
|
+
formatters.j = function (v) {
|
|
1201
|
+
try {
|
|
1202
|
+
return JSON.stringify(v);
|
|
1203
|
+
} catch (error) {
|
|
1204
|
+
return '[UnexpectedJSONParseError]: ' + error.message;
|
|
1205
|
+
}
|
|
1214
1206
|
};
|
|
1215
|
-
} (
|
|
1216
|
-
return
|
|
1207
|
+
} (browser$1, browser$1.exports));
|
|
1208
|
+
return browser$1.exports;
|
|
1217
1209
|
}
|
|
1218
1210
|
|
|
1219
1211
|
/**
|
|
@@ -1228,7 +1220,7 @@ if (typeof process === 'undefined' || process.type === 'renderer' || process.bro
|
|
|
1228
1220
|
}
|
|
1229
1221
|
|
|
1230
1222
|
var srcExports = src.exports;
|
|
1231
|
-
var debug$
|
|
1223
|
+
var debug$2 = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
|
|
1232
1224
|
|
|
1233
1225
|
var utils$3 = {};
|
|
1234
1226
|
|
|
@@ -3311,7 +3303,7 @@ const normalizePath$1 = function normalizePath(filename) {
|
|
|
3311
3303
|
};
|
|
3312
3304
|
|
|
3313
3305
|
function getMatcherString(id, resolutionBase) {
|
|
3314
|
-
if (resolutionBase === false || require$$0$1.isAbsolute(id) || id.startsWith('
|
|
3306
|
+
if (resolutionBase === false || require$$0$1.isAbsolute(id) || id.startsWith('**')) {
|
|
3315
3307
|
return normalizePath$1(id);
|
|
3316
3308
|
}
|
|
3317
3309
|
// resolve('') is valid and will default to process.cwd()
|
|
@@ -3366,7 +3358,7 @@ forbiddenIdentifiers.add('');
|
|
|
3366
3358
|
|
|
3367
3359
|
if (process.versions.pnp) {
|
|
3368
3360
|
try {
|
|
3369
|
-
node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (
|
|
3361
|
+
node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href)))('pnpapi');
|
|
3370
3362
|
}
|
|
3371
3363
|
catch { }
|
|
3372
3364
|
}
|
|
@@ -3376,16 +3368,18 @@ const windowsSlashRE = /\\/g;
|
|
|
3376
3368
|
function slash(p) {
|
|
3377
3369
|
return p.replace(windowsSlashRE, '/');
|
|
3378
3370
|
}
|
|
3371
|
+
// Some runtimes like Bun injects namespaced modules here, which is not a node builtin
|
|
3372
|
+
node_module.builtinModules.filter((id) => !id.includes(':'));
|
|
3379
3373
|
function isInNodeModules(id) {
|
|
3380
3374
|
return id.includes('node_modules');
|
|
3381
3375
|
}
|
|
3382
3376
|
// TODO: use import()
|
|
3383
|
-
|
|
3377
|
+
node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href)));
|
|
3384
3378
|
// set in bin/vite.js
|
|
3385
3379
|
const filter = process.env.VITE_DEBUG_FILTER;
|
|
3386
3380
|
const DEBUG = process.env.DEBUG;
|
|
3387
3381
|
function createDebugger(namespace, options = {}) {
|
|
3388
|
-
const log = debug$
|
|
3382
|
+
const log = debug$2(namespace);
|
|
3389
3383
|
const { onlyWhenFocused } = options;
|
|
3390
3384
|
let enabled = log.enabled;
|
|
3391
3385
|
if (enabled && onlyWhenFocused) {
|
|
@@ -3470,6 +3464,7 @@ function isObject$1(value) {
|
|
|
3470
3464
|
}
|
|
3471
3465
|
function tryStatSync(file) {
|
|
3472
3466
|
try {
|
|
3467
|
+
// The "throwIfNoEntry" is a performance optimization for cases where the file does not exist
|
|
3473
3468
|
return fs$1.statSync(file, { throwIfNoEntry: false });
|
|
3474
3469
|
}
|
|
3475
3470
|
catch {
|
|
@@ -3477,11 +3472,10 @@ function tryStatSync(file) {
|
|
|
3477
3472
|
}
|
|
3478
3473
|
}
|
|
3479
3474
|
function isFileReadable(filename) {
|
|
3475
|
+
if (!tryStatSync(filename)) {
|
|
3476
|
+
return false;
|
|
3477
|
+
}
|
|
3480
3478
|
try {
|
|
3481
|
-
// The "throwIfNoEntry" is a performance optimization for cases where the file does not exist
|
|
3482
|
-
if (!fs$1.statSync(filename, { throwIfNoEntry: false })) {
|
|
3483
|
-
return false;
|
|
3484
|
-
}
|
|
3485
3479
|
// Check if current process has read permission to the file
|
|
3486
3480
|
fs$1.accessSync(filename, fs$1.constants.R_OK);
|
|
3487
3481
|
return true;
|
|
@@ -3493,21 +3487,16 @@ function isFileReadable(filename) {
|
|
|
3493
3487
|
function arraify(target) {
|
|
3494
3488
|
return Array.isArray(target) ? target : [target];
|
|
3495
3489
|
}
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
*/
|
|
3507
|
-
usingDynamicImport
|
|
3508
|
-
? new Function('file', 'return import(file)')
|
|
3509
|
-
: _require;
|
|
3510
|
-
path$3.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href))));
|
|
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
|
+
}
|
|
3511
3500
|
function mergeConfigRecursively(defaults, overrides, rootPath) {
|
|
3512
3501
|
const merged = { ...defaults };
|
|
3513
3502
|
for (const key in overrides) {
|
|
@@ -3535,6 +3524,13 @@ function mergeConfigRecursively(defaults, overrides, rootPath) {
|
|
|
3535
3524
|
merged[key] = true;
|
|
3536
3525
|
continue;
|
|
3537
3526
|
}
|
|
3527
|
+
else if (key === 'plugins' && rootPath === 'worker') {
|
|
3528
|
+
merged[key] = () => [
|
|
3529
|
+
...backwardCompatibleWorkerPlugins(existing),
|
|
3530
|
+
...backwardCompatibleWorkerPlugins(value),
|
|
3531
|
+
];
|
|
3532
|
+
continue;
|
|
3533
|
+
}
|
|
3538
3534
|
if (Array.isArray(existing) || Array.isArray(value)) {
|
|
3539
3535
|
merged[key] = [...arraify(existing ?? []), ...arraify(value ?? [])];
|
|
3540
3536
|
continue;
|
|
@@ -3704,6 +3700,245 @@ function splitVendorChunkPlugin() {
|
|
|
3704
3700
|
};
|
|
3705
3701
|
}
|
|
3706
3702
|
|
|
3703
|
+
var convertSourceMap$1 = {};
|
|
3704
|
+
|
|
3705
|
+
(function (exports) {
|
|
3706
|
+
|
|
3707
|
+
Object.defineProperty(exports, 'commentRegex', {
|
|
3708
|
+
get: function getCommentRegex () {
|
|
3709
|
+
// Groups: 1: media type, 2: MIME type, 3: charset, 4: encoding, 5: data.
|
|
3710
|
+
return /^\s*?\/[\/\*][@#]\s+?sourceMappingURL=data:(((?:application|text)\/json)(?:;charset=([^;,]+?)?)?)?(?:;(base64))?,(.*?)$/mg;
|
|
3711
|
+
}
|
|
3712
|
+
});
|
|
3713
|
+
|
|
3714
|
+
|
|
3715
|
+
Object.defineProperty(exports, 'mapFileCommentRegex', {
|
|
3716
|
+
get: function getMapFileCommentRegex () {
|
|
3717
|
+
// Matches sourceMappingURL in either // or /* comment styles.
|
|
3718
|
+
return /(?:\/\/[@#][ \t]+?sourceMappingURL=([^\s'"`]+?)[ \t]*?$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*?(?:\*\/){1}[ \t]*?$)/mg;
|
|
3719
|
+
}
|
|
3720
|
+
});
|
|
3721
|
+
|
|
3722
|
+
var decodeBase64;
|
|
3723
|
+
if (typeof Buffer !== 'undefined') {
|
|
3724
|
+
if (typeof Buffer.from === 'function') {
|
|
3725
|
+
decodeBase64 = decodeBase64WithBufferFrom;
|
|
3726
|
+
} else {
|
|
3727
|
+
decodeBase64 = decodeBase64WithNewBuffer;
|
|
3728
|
+
}
|
|
3729
|
+
} else {
|
|
3730
|
+
decodeBase64 = decodeBase64WithAtob;
|
|
3731
|
+
}
|
|
3732
|
+
|
|
3733
|
+
function decodeBase64WithBufferFrom(base64) {
|
|
3734
|
+
return Buffer.from(base64, 'base64').toString();
|
|
3735
|
+
}
|
|
3736
|
+
|
|
3737
|
+
function decodeBase64WithNewBuffer(base64) {
|
|
3738
|
+
if (typeof value === 'number') {
|
|
3739
|
+
throw new TypeError('The value to decode must not be of type number.');
|
|
3740
|
+
}
|
|
3741
|
+
return new Buffer(base64, 'base64').toString();
|
|
3742
|
+
}
|
|
3743
|
+
|
|
3744
|
+
function decodeBase64WithAtob(base64) {
|
|
3745
|
+
return decodeURIComponent(escape(atob(base64)));
|
|
3746
|
+
}
|
|
3747
|
+
|
|
3748
|
+
function stripComment(sm) {
|
|
3749
|
+
return sm.split(',').pop();
|
|
3750
|
+
}
|
|
3751
|
+
|
|
3752
|
+
function readFromFileMap(sm, read) {
|
|
3753
|
+
var r = exports.mapFileCommentRegex.exec(sm);
|
|
3754
|
+
// for some odd reason //# .. captures in 1 and /* .. */ in 2
|
|
3755
|
+
var filename = r[1] || r[2];
|
|
3756
|
+
|
|
3757
|
+
try {
|
|
3758
|
+
var sm = read(filename);
|
|
3759
|
+
if (sm != null && typeof sm.catch === 'function') {
|
|
3760
|
+
return sm.catch(throwError);
|
|
3761
|
+
} else {
|
|
3762
|
+
return sm;
|
|
3763
|
+
}
|
|
3764
|
+
} catch (e) {
|
|
3765
|
+
throwError(e);
|
|
3766
|
+
}
|
|
3767
|
+
|
|
3768
|
+
function throwError(e) {
|
|
3769
|
+
throw new Error('An error occurred while trying to read the map file at ' + filename + '\n' + e.stack);
|
|
3770
|
+
}
|
|
3771
|
+
}
|
|
3772
|
+
|
|
3773
|
+
function Converter (sm, opts) {
|
|
3774
|
+
opts = opts || {};
|
|
3775
|
+
|
|
3776
|
+
if (opts.hasComment) {
|
|
3777
|
+
sm = stripComment(sm);
|
|
3778
|
+
}
|
|
3779
|
+
|
|
3780
|
+
if (opts.encoding === 'base64') {
|
|
3781
|
+
sm = decodeBase64(sm);
|
|
3782
|
+
} else if (opts.encoding === 'uri') {
|
|
3783
|
+
sm = decodeURIComponent(sm);
|
|
3784
|
+
}
|
|
3785
|
+
|
|
3786
|
+
if (opts.isJSON || opts.encoding) {
|
|
3787
|
+
sm = JSON.parse(sm);
|
|
3788
|
+
}
|
|
3789
|
+
|
|
3790
|
+
this.sourcemap = sm;
|
|
3791
|
+
}
|
|
3792
|
+
|
|
3793
|
+
Converter.prototype.toJSON = function (space) {
|
|
3794
|
+
return JSON.stringify(this.sourcemap, null, space);
|
|
3795
|
+
};
|
|
3796
|
+
|
|
3797
|
+
if (typeof Buffer !== 'undefined') {
|
|
3798
|
+
if (typeof Buffer.from === 'function') {
|
|
3799
|
+
Converter.prototype.toBase64 = encodeBase64WithBufferFrom;
|
|
3800
|
+
} else {
|
|
3801
|
+
Converter.prototype.toBase64 = encodeBase64WithNewBuffer;
|
|
3802
|
+
}
|
|
3803
|
+
} else {
|
|
3804
|
+
Converter.prototype.toBase64 = encodeBase64WithBtoa;
|
|
3805
|
+
}
|
|
3806
|
+
|
|
3807
|
+
function encodeBase64WithBufferFrom() {
|
|
3808
|
+
var json = this.toJSON();
|
|
3809
|
+
return Buffer.from(json, 'utf8').toString('base64');
|
|
3810
|
+
}
|
|
3811
|
+
|
|
3812
|
+
function encodeBase64WithNewBuffer() {
|
|
3813
|
+
var json = this.toJSON();
|
|
3814
|
+
if (typeof json === 'number') {
|
|
3815
|
+
throw new TypeError('The json to encode must not be of type number.');
|
|
3816
|
+
}
|
|
3817
|
+
return new Buffer(json, 'utf8').toString('base64');
|
|
3818
|
+
}
|
|
3819
|
+
|
|
3820
|
+
function encodeBase64WithBtoa() {
|
|
3821
|
+
var json = this.toJSON();
|
|
3822
|
+
return btoa(unescape(encodeURIComponent(json)));
|
|
3823
|
+
}
|
|
3824
|
+
|
|
3825
|
+
Converter.prototype.toURI = function () {
|
|
3826
|
+
var json = this.toJSON();
|
|
3827
|
+
return encodeURIComponent(json);
|
|
3828
|
+
};
|
|
3829
|
+
|
|
3830
|
+
Converter.prototype.toComment = function (options) {
|
|
3831
|
+
var encoding, content, data;
|
|
3832
|
+
if (options != null && options.encoding === 'uri') {
|
|
3833
|
+
encoding = '';
|
|
3834
|
+
content = this.toURI();
|
|
3835
|
+
} else {
|
|
3836
|
+
encoding = ';base64';
|
|
3837
|
+
content = this.toBase64();
|
|
3838
|
+
}
|
|
3839
|
+
data = 'sourceMappingURL=data:application/json;charset=utf-8' + encoding + ',' + content;
|
|
3840
|
+
return options != null && options.multiline ? '/*# ' + data + ' */' : '//# ' + data;
|
|
3841
|
+
};
|
|
3842
|
+
|
|
3843
|
+
// returns copy instead of original
|
|
3844
|
+
Converter.prototype.toObject = function () {
|
|
3845
|
+
return JSON.parse(this.toJSON());
|
|
3846
|
+
};
|
|
3847
|
+
|
|
3848
|
+
Converter.prototype.addProperty = function (key, value) {
|
|
3849
|
+
if (this.sourcemap.hasOwnProperty(key)) throw new Error('property "' + key + '" already exists on the sourcemap, use set property instead');
|
|
3850
|
+
return this.setProperty(key, value);
|
|
3851
|
+
};
|
|
3852
|
+
|
|
3853
|
+
Converter.prototype.setProperty = function (key, value) {
|
|
3854
|
+
this.sourcemap[key] = value;
|
|
3855
|
+
return this;
|
|
3856
|
+
};
|
|
3857
|
+
|
|
3858
|
+
Converter.prototype.getProperty = function (key) {
|
|
3859
|
+
return this.sourcemap[key];
|
|
3860
|
+
};
|
|
3861
|
+
|
|
3862
|
+
exports.fromObject = function (obj) {
|
|
3863
|
+
return new Converter(obj);
|
|
3864
|
+
};
|
|
3865
|
+
|
|
3866
|
+
exports.fromJSON = function (json) {
|
|
3867
|
+
return new Converter(json, { isJSON: true });
|
|
3868
|
+
};
|
|
3869
|
+
|
|
3870
|
+
exports.fromURI = function (uri) {
|
|
3871
|
+
return new Converter(uri, { encoding: 'uri' });
|
|
3872
|
+
};
|
|
3873
|
+
|
|
3874
|
+
exports.fromBase64 = function (base64) {
|
|
3875
|
+
return new Converter(base64, { encoding: 'base64' });
|
|
3876
|
+
};
|
|
3877
|
+
|
|
3878
|
+
exports.fromComment = function (comment) {
|
|
3879
|
+
var m, encoding;
|
|
3880
|
+
comment = comment
|
|
3881
|
+
.replace(/^\/\*/g, '//')
|
|
3882
|
+
.replace(/\*\/$/g, '');
|
|
3883
|
+
m = exports.commentRegex.exec(comment);
|
|
3884
|
+
encoding = m && m[4] || 'uri';
|
|
3885
|
+
return new Converter(comment, { encoding: encoding, hasComment: true });
|
|
3886
|
+
};
|
|
3887
|
+
|
|
3888
|
+
function makeConverter(sm) {
|
|
3889
|
+
return new Converter(sm, { isJSON: true });
|
|
3890
|
+
}
|
|
3891
|
+
|
|
3892
|
+
exports.fromMapFileComment = function (comment, read) {
|
|
3893
|
+
if (typeof read === 'string') {
|
|
3894
|
+
throw new Error(
|
|
3895
|
+
'String directory paths are no longer supported with `fromMapFileComment`\n' +
|
|
3896
|
+
'Please review the Upgrading documentation at https://github.com/thlorenz/convert-source-map#upgrading'
|
|
3897
|
+
)
|
|
3898
|
+
}
|
|
3899
|
+
|
|
3900
|
+
var sm = readFromFileMap(comment, read);
|
|
3901
|
+
if (sm != null && typeof sm.then === 'function') {
|
|
3902
|
+
return sm.then(makeConverter);
|
|
3903
|
+
} else {
|
|
3904
|
+
return makeConverter(sm);
|
|
3905
|
+
}
|
|
3906
|
+
};
|
|
3907
|
+
|
|
3908
|
+
// Finds last sourcemap comment in file or returns null if none was found
|
|
3909
|
+
exports.fromSource = function (content) {
|
|
3910
|
+
var m = content.match(exports.commentRegex);
|
|
3911
|
+
return m ? exports.fromComment(m.pop()) : null;
|
|
3912
|
+
};
|
|
3913
|
+
|
|
3914
|
+
// Finds last sourcemap comment in file or returns null if none was found
|
|
3915
|
+
exports.fromMapFileSource = function (content, read) {
|
|
3916
|
+
if (typeof read === 'string') {
|
|
3917
|
+
throw new Error(
|
|
3918
|
+
'String directory paths are no longer supported with `fromMapFileSource`\n' +
|
|
3919
|
+
'Please review the Upgrading documentation at https://github.com/thlorenz/convert-source-map#upgrading'
|
|
3920
|
+
)
|
|
3921
|
+
}
|
|
3922
|
+
var m = content.match(exports.mapFileCommentRegex);
|
|
3923
|
+
return m ? exports.fromMapFileComment(m.pop(), read) : null;
|
|
3924
|
+
};
|
|
3925
|
+
|
|
3926
|
+
exports.removeComments = function (src) {
|
|
3927
|
+
return src.replace(exports.commentRegex, '');
|
|
3928
|
+
};
|
|
3929
|
+
|
|
3930
|
+
exports.removeMapFileComments = function (src) {
|
|
3931
|
+
return src.replace(exports.mapFileCommentRegex, '');
|
|
3932
|
+
};
|
|
3933
|
+
|
|
3934
|
+
exports.generateMapFileComment = function (file, options) {
|
|
3935
|
+
var data = 'sourceMappingURL=' + file;
|
|
3936
|
+
return options && options.multiline ? '/*# ' + data + ' */' : '//# ' + data;
|
|
3937
|
+
};
|
|
3938
|
+
} (convertSourceMap$1));
|
|
3939
|
+
|
|
3940
|
+
var convertSourceMap = /*@__PURE__*/getDefaultExportFromCjs(convertSourceMap$1);
|
|
3941
|
+
|
|
3707
3942
|
/*!
|
|
3708
3943
|
* etag
|
|
3709
3944
|
* Copyright(c) 2014-2016 Douglas Christopher Wilson
|
|
@@ -3945,6 +4180,13 @@ class Chunk {
|
|
|
3945
4180
|
this.end = index;
|
|
3946
4181
|
|
|
3947
4182
|
if (this.edited) {
|
|
4183
|
+
// after split we should save the edit content record into the correct chunk
|
|
4184
|
+
// to make sure sourcemap correct
|
|
4185
|
+
// For example:
|
|
4186
|
+
// ' test'.trim()
|
|
4187
|
+
// split -> ' ' + 'test'
|
|
4188
|
+
// ✔️ edit -> '' + 'test'
|
|
4189
|
+
// ✖️ edit -> 'test' + ''
|
|
3948
4190
|
// TODO is this block necessary?...
|
|
3949
4191
|
newChunk.edit('', false);
|
|
3950
4192
|
this.content = '';
|
|
@@ -3973,6 +4215,10 @@ class Chunk {
|
|
|
3973
4215
|
if (trimmed.length) {
|
|
3974
4216
|
if (trimmed !== this.content) {
|
|
3975
4217
|
this.split(this.start + trimmed.length).edit('', undefined, true);
|
|
4218
|
+
if (this.edited) {
|
|
4219
|
+
// save the change, if it has been edited
|
|
4220
|
+
this.edit(trimmed, this.storeName, true);
|
|
4221
|
+
}
|
|
3976
4222
|
}
|
|
3977
4223
|
return true;
|
|
3978
4224
|
} else {
|
|
@@ -3991,7 +4237,11 @@ class Chunk {
|
|
|
3991
4237
|
|
|
3992
4238
|
if (trimmed.length) {
|
|
3993
4239
|
if (trimmed !== this.content) {
|
|
3994
|
-
this.split(this.end - trimmed.length);
|
|
4240
|
+
const newChunk = this.split(this.end - trimmed.length);
|
|
4241
|
+
if (this.edited) {
|
|
4242
|
+
// save the change, if it has been edited
|
|
4243
|
+
newChunk.edit(trimmed, this.storeName, true);
|
|
4244
|
+
}
|
|
3995
4245
|
this.edit('', undefined, true);
|
|
3996
4246
|
}
|
|
3997
4247
|
return true;
|
|
@@ -4016,7 +4266,7 @@ function getBtoa() {
|
|
|
4016
4266
|
}
|
|
4017
4267
|
}
|
|
4018
4268
|
|
|
4019
|
-
const btoa = /*#__PURE__*/ getBtoa();
|
|
4269
|
+
const btoa$1 = /*#__PURE__*/ getBtoa();
|
|
4020
4270
|
|
|
4021
4271
|
class SourceMap {
|
|
4022
4272
|
constructor(properties) {
|
|
@@ -4036,7 +4286,7 @@ class SourceMap {
|
|
|
4036
4286
|
}
|
|
4037
4287
|
|
|
4038
4288
|
toUrl() {
|
|
4039
|
-
return 'data:application/json;charset=utf-8;base64,' + btoa(this.toString());
|
|
4289
|
+
return 'data:application/json;charset=utf-8;base64,' + btoa$1(this.toString());
|
|
4040
4290
|
}
|
|
4041
4291
|
}
|
|
4042
4292
|
|
|
@@ -4131,16 +4381,35 @@ class Mappings {
|
|
|
4131
4381
|
|
|
4132
4382
|
addEdit(sourceIndex, content, loc, nameIndex) {
|
|
4133
4383
|
if (content.length) {
|
|
4384
|
+
let contentLineEnd = content.indexOf('\n', 0);
|
|
4385
|
+
let previousContentLineEnd = -1;
|
|
4386
|
+
while (contentLineEnd >= 0) {
|
|
4387
|
+
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
4388
|
+
if (nameIndex >= 0) {
|
|
4389
|
+
segment.push(nameIndex);
|
|
4390
|
+
}
|
|
4391
|
+
this.rawSegments.push(segment);
|
|
4392
|
+
|
|
4393
|
+
this.generatedCodeLine += 1;
|
|
4394
|
+
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
4395
|
+
this.generatedCodeColumn = 0;
|
|
4396
|
+
|
|
4397
|
+
previousContentLineEnd = contentLineEnd;
|
|
4398
|
+
contentLineEnd = content.indexOf('\n', contentLineEnd + 1);
|
|
4399
|
+
}
|
|
4400
|
+
|
|
4134
4401
|
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
4135
4402
|
if (nameIndex >= 0) {
|
|
4136
4403
|
segment.push(nameIndex);
|
|
4137
4404
|
}
|
|
4138
4405
|
this.rawSegments.push(segment);
|
|
4406
|
+
|
|
4407
|
+
this.advance(content.slice(previousContentLineEnd + 1));
|
|
4139
4408
|
} else if (this.pending) {
|
|
4140
4409
|
this.rawSegments.push(this.pending);
|
|
4410
|
+
this.advance(content);
|
|
4141
4411
|
}
|
|
4142
4412
|
|
|
4143
|
-
this.advance(content);
|
|
4144
4413
|
this.pending = null;
|
|
4145
4414
|
}
|
|
4146
4415
|
|
|
@@ -5003,7 +5272,7 @@ class MagicString {
|
|
|
5003
5272
|
}
|
|
5004
5273
|
}
|
|
5005
5274
|
|
|
5006
|
-
const debug = createDebugger('vite:sourcemap', {
|
|
5275
|
+
const debug$1 = createDebugger('vite:sourcemap', {
|
|
5007
5276
|
onlyWhenFocused: true,
|
|
5008
5277
|
});
|
|
5009
5278
|
function genSourceMapUrl(map) {
|
|
@@ -5013,7 +5282,7 @@ function genSourceMapUrl(map) {
|
|
|
5013
5282
|
return `data:application/json;base64,${Buffer.from(map).toString('base64')}`;
|
|
5014
5283
|
}
|
|
5015
5284
|
function getCodeWithSourcemap(type, code, map) {
|
|
5016
|
-
if (debug) {
|
|
5285
|
+
if (debug$1) {
|
|
5017
5286
|
code += `\n/*${JSON.stringify(map, null, 2).replace(/\*\//g, '*\\/')}*/\n`;
|
|
5018
5287
|
}
|
|
5019
5288
|
if (type === 'js') {
|
|
@@ -5025,6 +5294,9 @@ function getCodeWithSourcemap(type, code, map) {
|
|
|
5025
5294
|
return code;
|
|
5026
5295
|
}
|
|
5027
5296
|
|
|
5297
|
+
const debug = createDebugger('vite:send', {
|
|
5298
|
+
onlyWhenFocused: true,
|
|
5299
|
+
});
|
|
5028
5300
|
const alias = {
|
|
5029
5301
|
js: 'application/javascript',
|
|
5030
5302
|
css: 'text/css',
|
|
@@ -5055,11 +5327,22 @@ function send(req, res, content, type, options) {
|
|
|
5055
5327
|
content = getCodeWithSourcemap(type, content.toString(), map);
|
|
5056
5328
|
}
|
|
5057
5329
|
}
|
|
5058
|
-
|
|
5059
|
-
|
|
5330
|
+
// inject fallback sourcemap for js for improved debugging
|
|
5331
|
+
// https://github.com/vitejs/vite/pull/13514#issuecomment-1592431496
|
|
5332
|
+
else if (type === 'js' && (!map || map.mappings !== '')) {
|
|
5333
|
+
const code = content.toString();
|
|
5334
|
+
// if the code has existing inline sourcemap, assume it's correct and skip
|
|
5335
|
+
if (convertSourceMap.mapFileCommentRegex.test(code)) {
|
|
5336
|
+
debug?.(`Skipped injecting fallback sourcemap for ${req.url}`);
|
|
5337
|
+
}
|
|
5338
|
+
else {
|
|
5060
5339
|
const urlWithoutTimestamp = removeTimestampQuery(req.url);
|
|
5061
|
-
const ms = new MagicString(
|
|
5062
|
-
content = getCodeWithSourcemap(type,
|
|
5340
|
+
const ms = new MagicString(code);
|
|
5341
|
+
content = getCodeWithSourcemap(type, code, ms.generateMap({
|
|
5342
|
+
source: path$3.basename(urlWithoutTimestamp),
|
|
5343
|
+
hires: 'boundary',
|
|
5344
|
+
includeContent: true,
|
|
5345
|
+
}));
|
|
5063
5346
|
}
|
|
5064
5347
|
}
|
|
5065
5348
|
res.statusCode = 200;
|
|
@@ -5191,8 +5474,13 @@ function hasWorkspacePackageJSON(root) {
|
|
|
5191
5474
|
if (!isFileReadable(path)) {
|
|
5192
5475
|
return false;
|
|
5193
5476
|
}
|
|
5194
|
-
|
|
5195
|
-
|
|
5477
|
+
try {
|
|
5478
|
+
const content = JSON.parse(fs$1.readFileSync(path, 'utf-8')) || {};
|
|
5479
|
+
return !!content.workspaces;
|
|
5480
|
+
}
|
|
5481
|
+
catch {
|
|
5482
|
+
return false;
|
|
5483
|
+
}
|
|
5196
5484
|
}
|
|
5197
5485
|
function hasRootFile(root) {
|
|
5198
5486
|
return ROOT_FILES.some((file) => fs$1.existsSync(path$3.join(root, file)));
|
|
@@ -5641,48 +5929,59 @@ main$1.exports.populate = DotenvModule.populate;
|
|
|
5641
5929
|
|
|
5642
5930
|
main$1.exports = DotenvModule;
|
|
5643
5931
|
|
|
5932
|
+
// like String.prototype.search but returns the last index
|
|
5933
|
+
function _searchLast (str, rgx) {
|
|
5934
|
+
const matches = Array.from(str.matchAll(rgx));
|
|
5935
|
+
return matches.length > 0 ? matches.slice(-1)[0].index : -1
|
|
5936
|
+
}
|
|
5937
|
+
|
|
5644
5938
|
function _interpolate (envValue, environment, config) {
|
|
5645
|
-
|
|
5939
|
+
// find the last unescaped dollar sign in the
|
|
5940
|
+
// value so that we can evaluate it
|
|
5941
|
+
const lastUnescapedDollarSignIndex = _searchLast(envValue, /(?!(?<=\\))\$/g);
|
|
5646
5942
|
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
return newEnv
|
|
5651
|
-
}
|
|
5943
|
+
// If we couldn't match any unescaped dollar sign
|
|
5944
|
+
// let's return the string as is
|
|
5945
|
+
if (lastUnescapedDollarSignIndex === -1) return envValue
|
|
5652
5946
|
|
|
5653
|
-
|
|
5947
|
+
// This is the right-most group of variables in the string
|
|
5948
|
+
const rightMostGroup = envValue.slice(lastUnescapedDollarSignIndex);
|
|
5654
5949
|
|
|
5655
|
-
|
|
5950
|
+
/**
|
|
5951
|
+
* This finds the inner most variable/group divided
|
|
5952
|
+
* by variable name and default value (if present)
|
|
5953
|
+
* (
|
|
5954
|
+
* (?!(?<=\\))\$ // only match dollar signs that are not escaped
|
|
5955
|
+
* {? // optional opening curly brace
|
|
5956
|
+
* ([\w]+) // match the variable name
|
|
5957
|
+
* (?::-([^}\\]*))? // match an optional default value
|
|
5958
|
+
* }? // optional closing curly brace
|
|
5959
|
+
* )
|
|
5960
|
+
*/
|
|
5961
|
+
const matchGroup = /((?!(?<=\\))\${?([\w]+)(?::-([^}\\]*))?}?)/;
|
|
5962
|
+
const match = rightMostGroup.match(matchGroup);
|
|
5963
|
+
|
|
5964
|
+
if (match != null) {
|
|
5965
|
+
const [, group, variableName, defaultValue] = match;
|
|
5966
|
+
|
|
5967
|
+
return _interpolate(
|
|
5968
|
+
envValue.replace(
|
|
5969
|
+
group,
|
|
5970
|
+
environment[variableName] ||
|
|
5971
|
+
defaultValue ||
|
|
5972
|
+
config.parsed[variableName] ||
|
|
5973
|
+
''
|
|
5974
|
+
),
|
|
5975
|
+
environment,
|
|
5976
|
+
config
|
|
5977
|
+
)
|
|
5978
|
+
}
|
|
5656
5979
|
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
value = replacePart.replace('\\$', '$');
|
|
5660
|
-
} else {
|
|
5661
|
-
// PATCH: compatible with env variables ended with unescaped $
|
|
5662
|
-
if(!parts[2]) {
|
|
5663
|
-
return newEnv
|
|
5664
|
-
}
|
|
5665
|
-
const keyParts = parts[2].split(':-');
|
|
5666
|
-
const key = keyParts[0];
|
|
5667
|
-
replacePart = parts[0].substring(prefix.length);
|
|
5668
|
-
// process.env value 'wins' over .env file's value
|
|
5669
|
-
value = Object.prototype.hasOwnProperty.call(environment, key)
|
|
5670
|
-
? environment[key]
|
|
5671
|
-
: (config.parsed[key] || keyParts[1] || '');
|
|
5672
|
-
|
|
5673
|
-
// If the value is found, remove nested expansions.
|
|
5674
|
-
if (keyParts.length > 1 && value) {
|
|
5675
|
-
const replaceNested = matches[index + 1];
|
|
5676
|
-
matches[index + 1] = '';
|
|
5677
|
-
|
|
5678
|
-
newEnv = newEnv.replace(replaceNested, '');
|
|
5679
|
-
}
|
|
5680
|
-
// Resolve recursive interpolations
|
|
5681
|
-
value = _interpolate(value, environment, config);
|
|
5682
|
-
}
|
|
5980
|
+
return envValue
|
|
5981
|
+
}
|
|
5683
5982
|
|
|
5684
|
-
|
|
5685
|
-
|
|
5983
|
+
function _resolveEscapeSequences (value) {
|
|
5984
|
+
return value.replace(/\\\$/g, '$')
|
|
5686
5985
|
}
|
|
5687
5986
|
|
|
5688
5987
|
function expand (config) {
|
|
@@ -5690,9 +5989,13 @@ function expand (config) {
|
|
|
5690
5989
|
const environment = config.ignoreProcessEnv ? {} : process.env;
|
|
5691
5990
|
|
|
5692
5991
|
for (const configKey in config.parsed) {
|
|
5693
|
-
const value = Object.prototype.hasOwnProperty.call(environment, configKey)
|
|
5992
|
+
const value = Object.prototype.hasOwnProperty.call(environment, configKey)
|
|
5993
|
+
? environment[configKey]
|
|
5994
|
+
: config.parsed[configKey];
|
|
5694
5995
|
|
|
5695
|
-
config.parsed[configKey] =
|
|
5996
|
+
config.parsed[configKey] = _resolveEscapeSequences(
|
|
5997
|
+
_interpolate(value, environment, config)
|
|
5998
|
+
);
|
|
5696
5999
|
}
|
|
5697
6000
|
|
|
5698
6001
|
// PATCH: don't write to process.env
|
|
@@ -5705,6 +6008,14 @@ function expand (config) {
|
|
|
5705
6008
|
|
|
5706
6009
|
var expand_1 = expand;
|
|
5707
6010
|
|
|
6011
|
+
function getEnvFilesForMode(mode) {
|
|
6012
|
+
return [
|
|
6013
|
+
/** default file */ `.env`,
|
|
6014
|
+
/** local file */ `.env.local`,
|
|
6015
|
+
/** mode file */ `.env.${mode}`,
|
|
6016
|
+
/** mode local file */ `.env.${mode}.local`,
|
|
6017
|
+
];
|
|
6018
|
+
}
|
|
5708
6019
|
function loadEnv(mode, envDir, prefixes = 'VITE_') {
|
|
5709
6020
|
if (mode === 'local') {
|
|
5710
6021
|
throw new Error(`"local" cannot be used as a mode name because it conflicts with ` +
|
|
@@ -5712,12 +6023,7 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
|
|
|
5712
6023
|
}
|
|
5713
6024
|
prefixes = arraify(prefixes);
|
|
5714
6025
|
const env = {};
|
|
5715
|
-
const envFiles =
|
|
5716
|
-
/** default file */ `.env`,
|
|
5717
|
-
/** local file */ `.env.local`,
|
|
5718
|
-
/** mode file */ `.env.${mode}`,
|
|
5719
|
-
/** mode local file */ `.env.${mode}.local`,
|
|
5720
|
-
];
|
|
6026
|
+
const envFiles = getEnvFilesForMode(mode);
|
|
5721
6027
|
const parsed = Object.fromEntries(envFiles.flatMap((file) => {
|
|
5722
6028
|
const filePath = path$3.join(envDir, file);
|
|
5723
6029
|
if (!tryStatSync(filePath)?.isFile())
|