vite 5.0.0-beta.0 → 5.0.0-beta.10
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-4033fb3a.js → dep-RTfXXG9P.js} +3583 -4035
- package/dist/node/chunks/{dep-3d0847ee.js → dep-pNoMh5ox.js} +145 -145
- package/dist/node/chunks/{dep-1d1f72b4.js → dep-s3v9f2KI.js} +2 -2
- package/dist/node/cli.js +29 -13
- package/dist/node/index.d.ts +3261 -3405
- package/dist/node/index.js +8 -6
- package/dist/node-cjs/publicUtils.cjs +807 -513
- package/index.cjs +13 -9
- package/index.d.cts +6 -0
- package/package.json +43 -37
- 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) {
|
|
@@ -3423,6 +3417,12 @@ function fsPathFromId(id) {
|
|
|
3423
3417
|
function fsPathFromUrl(url) {
|
|
3424
3418
|
return fsPathFromId(cleanUrl(url));
|
|
3425
3419
|
}
|
|
3420
|
+
function withTrailingSlash(path) {
|
|
3421
|
+
if (path[path.length - 1] !== '/') {
|
|
3422
|
+
return `${path}/`;
|
|
3423
|
+
}
|
|
3424
|
+
return path;
|
|
3425
|
+
}
|
|
3426
3426
|
/**
|
|
3427
3427
|
* Check if dir is a parent of file
|
|
3428
3428
|
*
|
|
@@ -3433,9 +3433,7 @@ function fsPathFromUrl(url) {
|
|
|
3433
3433
|
* @returns true if dir is a parent of file
|
|
3434
3434
|
*/
|
|
3435
3435
|
function isParentDirectory(dir, file) {
|
|
3436
|
-
|
|
3437
|
-
dir = `${dir}/`;
|
|
3438
|
-
}
|
|
3436
|
+
dir = withTrailingSlash(dir);
|
|
3439
3437
|
return (file.startsWith(dir) ||
|
|
3440
3438
|
(isCaseInsensitiveFS && file.toLowerCase().startsWith(dir.toLowerCase())));
|
|
3441
3439
|
}
|
|
@@ -3466,6 +3464,7 @@ function isObject$1(value) {
|
|
|
3466
3464
|
}
|
|
3467
3465
|
function tryStatSync(file) {
|
|
3468
3466
|
try {
|
|
3467
|
+
// The "throwIfNoEntry" is a performance optimization for cases where the file does not exist
|
|
3469
3468
|
return fs$1.statSync(file, { throwIfNoEntry: false });
|
|
3470
3469
|
}
|
|
3471
3470
|
catch {
|
|
@@ -3473,11 +3472,10 @@ function tryStatSync(file) {
|
|
|
3473
3472
|
}
|
|
3474
3473
|
}
|
|
3475
3474
|
function isFileReadable(filename) {
|
|
3475
|
+
if (!tryStatSync(filename)) {
|
|
3476
|
+
return false;
|
|
3477
|
+
}
|
|
3476
3478
|
try {
|
|
3477
|
-
// The "throwIfNoEntry" is a performance optimization for cases where the file does not exist
|
|
3478
|
-
if (!fs$1.statSync(filename, { throwIfNoEntry: false })) {
|
|
3479
|
-
return false;
|
|
3480
|
-
}
|
|
3481
3479
|
// Check if current process has read permission to the file
|
|
3482
3480
|
fs$1.accessSync(filename, fs$1.constants.R_OK);
|
|
3483
3481
|
return true;
|
|
@@ -3489,21 +3487,7 @@ function isFileReadable(filename) {
|
|
|
3489
3487
|
function arraify(target) {
|
|
3490
3488
|
return Array.isArray(target) ? target : [target];
|
|
3491
3489
|
}
|
|
3492
|
-
|
|
3493
|
-
const usingDynamicImport = typeof jest === 'undefined';
|
|
3494
|
-
/**
|
|
3495
|
-
* Dynamically import files. It will make sure it's not being compiled away by TS/Rollup.
|
|
3496
|
-
*
|
|
3497
|
-
* As a temporary workaround for Jest's lack of stable ESM support, we fallback to require
|
|
3498
|
-
* if we're in a Jest environment.
|
|
3499
|
-
* See https://github.com/vitejs/vite/pull/5197#issuecomment-938054077
|
|
3500
|
-
*
|
|
3501
|
-
* @param file File path to import.
|
|
3502
|
-
*/
|
|
3503
|
-
usingDynamicImport
|
|
3504
|
-
? new Function('file', 'return import(file)')
|
|
3505
|
-
: _require;
|
|
3506
|
-
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))));
|
|
3507
3491
|
function mergeConfigRecursively(defaults, overrides, rootPath) {
|
|
3508
3492
|
const merged = { ...defaults };
|
|
3509
3493
|
for (const key in overrides) {
|
|
@@ -3700,6 +3684,245 @@ function splitVendorChunkPlugin() {
|
|
|
3700
3684
|
};
|
|
3701
3685
|
}
|
|
3702
3686
|
|
|
3687
|
+
var convertSourceMap$1 = {};
|
|
3688
|
+
|
|
3689
|
+
(function (exports) {
|
|
3690
|
+
|
|
3691
|
+
Object.defineProperty(exports, 'commentRegex', {
|
|
3692
|
+
get: function getCommentRegex () {
|
|
3693
|
+
// Groups: 1: media type, 2: MIME type, 3: charset, 4: encoding, 5: data.
|
|
3694
|
+
return /^\s*?\/[\/\*][@#]\s+?sourceMappingURL=data:(((?:application|text)\/json)(?:;charset=([^;,]+?)?)?)?(?:;(base64))?,(.*?)$/mg;
|
|
3695
|
+
}
|
|
3696
|
+
});
|
|
3697
|
+
|
|
3698
|
+
|
|
3699
|
+
Object.defineProperty(exports, 'mapFileCommentRegex', {
|
|
3700
|
+
get: function getMapFileCommentRegex () {
|
|
3701
|
+
// Matches sourceMappingURL in either // or /* comment styles.
|
|
3702
|
+
return /(?:\/\/[@#][ \t]+?sourceMappingURL=([^\s'"`]+?)[ \t]*?$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*?(?:\*\/){1}[ \t]*?$)/mg;
|
|
3703
|
+
}
|
|
3704
|
+
});
|
|
3705
|
+
|
|
3706
|
+
var decodeBase64;
|
|
3707
|
+
if (typeof Buffer !== 'undefined') {
|
|
3708
|
+
if (typeof Buffer.from === 'function') {
|
|
3709
|
+
decodeBase64 = decodeBase64WithBufferFrom;
|
|
3710
|
+
} else {
|
|
3711
|
+
decodeBase64 = decodeBase64WithNewBuffer;
|
|
3712
|
+
}
|
|
3713
|
+
} else {
|
|
3714
|
+
decodeBase64 = decodeBase64WithAtob;
|
|
3715
|
+
}
|
|
3716
|
+
|
|
3717
|
+
function decodeBase64WithBufferFrom(base64) {
|
|
3718
|
+
return Buffer.from(base64, 'base64').toString();
|
|
3719
|
+
}
|
|
3720
|
+
|
|
3721
|
+
function decodeBase64WithNewBuffer(base64) {
|
|
3722
|
+
if (typeof value === 'number') {
|
|
3723
|
+
throw new TypeError('The value to decode must not be of type number.');
|
|
3724
|
+
}
|
|
3725
|
+
return new Buffer(base64, 'base64').toString();
|
|
3726
|
+
}
|
|
3727
|
+
|
|
3728
|
+
function decodeBase64WithAtob(base64) {
|
|
3729
|
+
return decodeURIComponent(escape(atob(base64)));
|
|
3730
|
+
}
|
|
3731
|
+
|
|
3732
|
+
function stripComment(sm) {
|
|
3733
|
+
return sm.split(',').pop();
|
|
3734
|
+
}
|
|
3735
|
+
|
|
3736
|
+
function readFromFileMap(sm, read) {
|
|
3737
|
+
var r = exports.mapFileCommentRegex.exec(sm);
|
|
3738
|
+
// for some odd reason //# .. captures in 1 and /* .. */ in 2
|
|
3739
|
+
var filename = r[1] || r[2];
|
|
3740
|
+
|
|
3741
|
+
try {
|
|
3742
|
+
var sm = read(filename);
|
|
3743
|
+
if (sm != null && typeof sm.catch === 'function') {
|
|
3744
|
+
return sm.catch(throwError);
|
|
3745
|
+
} else {
|
|
3746
|
+
return sm;
|
|
3747
|
+
}
|
|
3748
|
+
} catch (e) {
|
|
3749
|
+
throwError(e);
|
|
3750
|
+
}
|
|
3751
|
+
|
|
3752
|
+
function throwError(e) {
|
|
3753
|
+
throw new Error('An error occurred while trying to read the map file at ' + filename + '\n' + e.stack);
|
|
3754
|
+
}
|
|
3755
|
+
}
|
|
3756
|
+
|
|
3757
|
+
function Converter (sm, opts) {
|
|
3758
|
+
opts = opts || {};
|
|
3759
|
+
|
|
3760
|
+
if (opts.hasComment) {
|
|
3761
|
+
sm = stripComment(sm);
|
|
3762
|
+
}
|
|
3763
|
+
|
|
3764
|
+
if (opts.encoding === 'base64') {
|
|
3765
|
+
sm = decodeBase64(sm);
|
|
3766
|
+
} else if (opts.encoding === 'uri') {
|
|
3767
|
+
sm = decodeURIComponent(sm);
|
|
3768
|
+
}
|
|
3769
|
+
|
|
3770
|
+
if (opts.isJSON || opts.encoding) {
|
|
3771
|
+
sm = JSON.parse(sm);
|
|
3772
|
+
}
|
|
3773
|
+
|
|
3774
|
+
this.sourcemap = sm;
|
|
3775
|
+
}
|
|
3776
|
+
|
|
3777
|
+
Converter.prototype.toJSON = function (space) {
|
|
3778
|
+
return JSON.stringify(this.sourcemap, null, space);
|
|
3779
|
+
};
|
|
3780
|
+
|
|
3781
|
+
if (typeof Buffer !== 'undefined') {
|
|
3782
|
+
if (typeof Buffer.from === 'function') {
|
|
3783
|
+
Converter.prototype.toBase64 = encodeBase64WithBufferFrom;
|
|
3784
|
+
} else {
|
|
3785
|
+
Converter.prototype.toBase64 = encodeBase64WithNewBuffer;
|
|
3786
|
+
}
|
|
3787
|
+
} else {
|
|
3788
|
+
Converter.prototype.toBase64 = encodeBase64WithBtoa;
|
|
3789
|
+
}
|
|
3790
|
+
|
|
3791
|
+
function encodeBase64WithBufferFrom() {
|
|
3792
|
+
var json = this.toJSON();
|
|
3793
|
+
return Buffer.from(json, 'utf8').toString('base64');
|
|
3794
|
+
}
|
|
3795
|
+
|
|
3796
|
+
function encodeBase64WithNewBuffer() {
|
|
3797
|
+
var json = this.toJSON();
|
|
3798
|
+
if (typeof json === 'number') {
|
|
3799
|
+
throw new TypeError('The json to encode must not be of type number.');
|
|
3800
|
+
}
|
|
3801
|
+
return new Buffer(json, 'utf8').toString('base64');
|
|
3802
|
+
}
|
|
3803
|
+
|
|
3804
|
+
function encodeBase64WithBtoa() {
|
|
3805
|
+
var json = this.toJSON();
|
|
3806
|
+
return btoa(unescape(encodeURIComponent(json)));
|
|
3807
|
+
}
|
|
3808
|
+
|
|
3809
|
+
Converter.prototype.toURI = function () {
|
|
3810
|
+
var json = this.toJSON();
|
|
3811
|
+
return encodeURIComponent(json);
|
|
3812
|
+
};
|
|
3813
|
+
|
|
3814
|
+
Converter.prototype.toComment = function (options) {
|
|
3815
|
+
var encoding, content, data;
|
|
3816
|
+
if (options != null && options.encoding === 'uri') {
|
|
3817
|
+
encoding = '';
|
|
3818
|
+
content = this.toURI();
|
|
3819
|
+
} else {
|
|
3820
|
+
encoding = ';base64';
|
|
3821
|
+
content = this.toBase64();
|
|
3822
|
+
}
|
|
3823
|
+
data = 'sourceMappingURL=data:application/json;charset=utf-8' + encoding + ',' + content;
|
|
3824
|
+
return options != null && options.multiline ? '/*# ' + data + ' */' : '//# ' + data;
|
|
3825
|
+
};
|
|
3826
|
+
|
|
3827
|
+
// returns copy instead of original
|
|
3828
|
+
Converter.prototype.toObject = function () {
|
|
3829
|
+
return JSON.parse(this.toJSON());
|
|
3830
|
+
};
|
|
3831
|
+
|
|
3832
|
+
Converter.prototype.addProperty = function (key, value) {
|
|
3833
|
+
if (this.sourcemap.hasOwnProperty(key)) throw new Error('property "' + key + '" already exists on the sourcemap, use set property instead');
|
|
3834
|
+
return this.setProperty(key, value);
|
|
3835
|
+
};
|
|
3836
|
+
|
|
3837
|
+
Converter.prototype.setProperty = function (key, value) {
|
|
3838
|
+
this.sourcemap[key] = value;
|
|
3839
|
+
return this;
|
|
3840
|
+
};
|
|
3841
|
+
|
|
3842
|
+
Converter.prototype.getProperty = function (key) {
|
|
3843
|
+
return this.sourcemap[key];
|
|
3844
|
+
};
|
|
3845
|
+
|
|
3846
|
+
exports.fromObject = function (obj) {
|
|
3847
|
+
return new Converter(obj);
|
|
3848
|
+
};
|
|
3849
|
+
|
|
3850
|
+
exports.fromJSON = function (json) {
|
|
3851
|
+
return new Converter(json, { isJSON: true });
|
|
3852
|
+
};
|
|
3853
|
+
|
|
3854
|
+
exports.fromURI = function (uri) {
|
|
3855
|
+
return new Converter(uri, { encoding: 'uri' });
|
|
3856
|
+
};
|
|
3857
|
+
|
|
3858
|
+
exports.fromBase64 = function (base64) {
|
|
3859
|
+
return new Converter(base64, { encoding: 'base64' });
|
|
3860
|
+
};
|
|
3861
|
+
|
|
3862
|
+
exports.fromComment = function (comment) {
|
|
3863
|
+
var m, encoding;
|
|
3864
|
+
comment = comment
|
|
3865
|
+
.replace(/^\/\*/g, '//')
|
|
3866
|
+
.replace(/\*\/$/g, '');
|
|
3867
|
+
m = exports.commentRegex.exec(comment);
|
|
3868
|
+
encoding = m && m[4] || 'uri';
|
|
3869
|
+
return new Converter(comment, { encoding: encoding, hasComment: true });
|
|
3870
|
+
};
|
|
3871
|
+
|
|
3872
|
+
function makeConverter(sm) {
|
|
3873
|
+
return new Converter(sm, { isJSON: true });
|
|
3874
|
+
}
|
|
3875
|
+
|
|
3876
|
+
exports.fromMapFileComment = function (comment, read) {
|
|
3877
|
+
if (typeof read === 'string') {
|
|
3878
|
+
throw new Error(
|
|
3879
|
+
'String directory paths are no longer supported with `fromMapFileComment`\n' +
|
|
3880
|
+
'Please review the Upgrading documentation at https://github.com/thlorenz/convert-source-map#upgrading'
|
|
3881
|
+
)
|
|
3882
|
+
}
|
|
3883
|
+
|
|
3884
|
+
var sm = readFromFileMap(comment, read);
|
|
3885
|
+
if (sm != null && typeof sm.then === 'function') {
|
|
3886
|
+
return sm.then(makeConverter);
|
|
3887
|
+
} else {
|
|
3888
|
+
return makeConverter(sm);
|
|
3889
|
+
}
|
|
3890
|
+
};
|
|
3891
|
+
|
|
3892
|
+
// Finds last sourcemap comment in file or returns null if none was found
|
|
3893
|
+
exports.fromSource = function (content) {
|
|
3894
|
+
var m = content.match(exports.commentRegex);
|
|
3895
|
+
return m ? exports.fromComment(m.pop()) : null;
|
|
3896
|
+
};
|
|
3897
|
+
|
|
3898
|
+
// Finds last sourcemap comment in file or returns null if none was found
|
|
3899
|
+
exports.fromMapFileSource = function (content, read) {
|
|
3900
|
+
if (typeof read === 'string') {
|
|
3901
|
+
throw new Error(
|
|
3902
|
+
'String directory paths are no longer supported with `fromMapFileSource`\n' +
|
|
3903
|
+
'Please review the Upgrading documentation at https://github.com/thlorenz/convert-source-map#upgrading'
|
|
3904
|
+
)
|
|
3905
|
+
}
|
|
3906
|
+
var m = content.match(exports.mapFileCommentRegex);
|
|
3907
|
+
return m ? exports.fromMapFileComment(m.pop(), read) : null;
|
|
3908
|
+
};
|
|
3909
|
+
|
|
3910
|
+
exports.removeComments = function (src) {
|
|
3911
|
+
return src.replace(exports.commentRegex, '');
|
|
3912
|
+
};
|
|
3913
|
+
|
|
3914
|
+
exports.removeMapFileComments = function (src) {
|
|
3915
|
+
return src.replace(exports.mapFileCommentRegex, '');
|
|
3916
|
+
};
|
|
3917
|
+
|
|
3918
|
+
exports.generateMapFileComment = function (file, options) {
|
|
3919
|
+
var data = 'sourceMappingURL=' + file;
|
|
3920
|
+
return options && options.multiline ? '/*# ' + data + ' */' : '//# ' + data;
|
|
3921
|
+
};
|
|
3922
|
+
} (convertSourceMap$1));
|
|
3923
|
+
|
|
3924
|
+
var convertSourceMap = /*@__PURE__*/getDefaultExportFromCjs(convertSourceMap$1);
|
|
3925
|
+
|
|
3703
3926
|
/*!
|
|
3704
3927
|
* etag
|
|
3705
3928
|
* Copyright(c) 2014-2016 Douglas Christopher Wilson
|
|
@@ -3941,6 +4164,13 @@ class Chunk {
|
|
|
3941
4164
|
this.end = index;
|
|
3942
4165
|
|
|
3943
4166
|
if (this.edited) {
|
|
4167
|
+
// after split we should save the edit content record into the correct chunk
|
|
4168
|
+
// to make sure sourcemap correct
|
|
4169
|
+
// For example:
|
|
4170
|
+
// ' test'.trim()
|
|
4171
|
+
// split -> ' ' + 'test'
|
|
4172
|
+
// ✔️ edit -> '' + 'test'
|
|
4173
|
+
// ✖️ edit -> 'test' + ''
|
|
3944
4174
|
// TODO is this block necessary?...
|
|
3945
4175
|
newChunk.edit('', false);
|
|
3946
4176
|
this.content = '';
|
|
@@ -3969,6 +4199,10 @@ class Chunk {
|
|
|
3969
4199
|
if (trimmed.length) {
|
|
3970
4200
|
if (trimmed !== this.content) {
|
|
3971
4201
|
this.split(this.start + trimmed.length).edit('', undefined, true);
|
|
4202
|
+
if (this.edited) {
|
|
4203
|
+
// save the change, if it has been edited
|
|
4204
|
+
this.edit(trimmed, this.storeName, true);
|
|
4205
|
+
}
|
|
3972
4206
|
}
|
|
3973
4207
|
return true;
|
|
3974
4208
|
} else {
|
|
@@ -3987,7 +4221,11 @@ class Chunk {
|
|
|
3987
4221
|
|
|
3988
4222
|
if (trimmed.length) {
|
|
3989
4223
|
if (trimmed !== this.content) {
|
|
3990
|
-
this.split(this.end - trimmed.length);
|
|
4224
|
+
const newChunk = this.split(this.end - trimmed.length);
|
|
4225
|
+
if (this.edited) {
|
|
4226
|
+
// save the change, if it has been edited
|
|
4227
|
+
newChunk.edit(trimmed, this.storeName, true);
|
|
4228
|
+
}
|
|
3991
4229
|
this.edit('', undefined, true);
|
|
3992
4230
|
}
|
|
3993
4231
|
return true;
|
|
@@ -4012,7 +4250,7 @@ function getBtoa() {
|
|
|
4012
4250
|
}
|
|
4013
4251
|
}
|
|
4014
4252
|
|
|
4015
|
-
const btoa = /*#__PURE__*/ getBtoa();
|
|
4253
|
+
const btoa$1 = /*#__PURE__*/ getBtoa();
|
|
4016
4254
|
|
|
4017
4255
|
class SourceMap {
|
|
4018
4256
|
constructor(properties) {
|
|
@@ -4032,7 +4270,7 @@ class SourceMap {
|
|
|
4032
4270
|
}
|
|
4033
4271
|
|
|
4034
4272
|
toUrl() {
|
|
4035
|
-
return 'data:application/json;charset=utf-8;base64,' + btoa(this.toString());
|
|
4273
|
+
return 'data:application/json;charset=utf-8;base64,' + btoa$1(this.toString());
|
|
4036
4274
|
}
|
|
4037
4275
|
}
|
|
4038
4276
|
|
|
@@ -4127,16 +4365,35 @@ class Mappings {
|
|
|
4127
4365
|
|
|
4128
4366
|
addEdit(sourceIndex, content, loc, nameIndex) {
|
|
4129
4367
|
if (content.length) {
|
|
4368
|
+
let contentLineEnd = content.indexOf('\n', 0);
|
|
4369
|
+
let previousContentLineEnd = -1;
|
|
4370
|
+
while (contentLineEnd >= 0) {
|
|
4371
|
+
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
4372
|
+
if (nameIndex >= 0) {
|
|
4373
|
+
segment.push(nameIndex);
|
|
4374
|
+
}
|
|
4375
|
+
this.rawSegments.push(segment);
|
|
4376
|
+
|
|
4377
|
+
this.generatedCodeLine += 1;
|
|
4378
|
+
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
4379
|
+
this.generatedCodeColumn = 0;
|
|
4380
|
+
|
|
4381
|
+
previousContentLineEnd = contentLineEnd;
|
|
4382
|
+
contentLineEnd = content.indexOf('\n', contentLineEnd + 1);
|
|
4383
|
+
}
|
|
4384
|
+
|
|
4130
4385
|
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
4131
4386
|
if (nameIndex >= 0) {
|
|
4132
4387
|
segment.push(nameIndex);
|
|
4133
4388
|
}
|
|
4134
4389
|
this.rawSegments.push(segment);
|
|
4390
|
+
|
|
4391
|
+
this.advance(content.slice(previousContentLineEnd + 1));
|
|
4135
4392
|
} else if (this.pending) {
|
|
4136
4393
|
this.rawSegments.push(this.pending);
|
|
4394
|
+
this.advance(content);
|
|
4137
4395
|
}
|
|
4138
4396
|
|
|
4139
|
-
this.advance(content);
|
|
4140
4397
|
this.pending = null;
|
|
4141
4398
|
}
|
|
4142
4399
|
|
|
@@ -4999,7 +5256,7 @@ class MagicString {
|
|
|
4999
5256
|
}
|
|
5000
5257
|
}
|
|
5001
5258
|
|
|
5002
|
-
const debug = createDebugger('vite:sourcemap', {
|
|
5259
|
+
const debug$1 = createDebugger('vite:sourcemap', {
|
|
5003
5260
|
onlyWhenFocused: true,
|
|
5004
5261
|
});
|
|
5005
5262
|
function genSourceMapUrl(map) {
|
|
@@ -5009,7 +5266,7 @@ function genSourceMapUrl(map) {
|
|
|
5009
5266
|
return `data:application/json;base64,${Buffer.from(map).toString('base64')}`;
|
|
5010
5267
|
}
|
|
5011
5268
|
function getCodeWithSourcemap(type, code, map) {
|
|
5012
|
-
if (debug) {
|
|
5269
|
+
if (debug$1) {
|
|
5013
5270
|
code += `\n/*${JSON.stringify(map, null, 2).replace(/\*\//g, '*\\/')}*/\n`;
|
|
5014
5271
|
}
|
|
5015
5272
|
if (type === 'js') {
|
|
@@ -5021,6 +5278,9 @@ function getCodeWithSourcemap(type, code, map) {
|
|
|
5021
5278
|
return code;
|
|
5022
5279
|
}
|
|
5023
5280
|
|
|
5281
|
+
const debug = createDebugger('vite:send', {
|
|
5282
|
+
onlyWhenFocused: true,
|
|
5283
|
+
});
|
|
5024
5284
|
const alias = {
|
|
5025
5285
|
js: 'application/javascript',
|
|
5026
5286
|
css: 'text/css',
|
|
@@ -5051,11 +5311,22 @@ function send(req, res, content, type, options) {
|
|
|
5051
5311
|
content = getCodeWithSourcemap(type, content.toString(), map);
|
|
5052
5312
|
}
|
|
5053
5313
|
}
|
|
5054
|
-
|
|
5055
|
-
|
|
5314
|
+
// inject fallback sourcemap for js for improved debugging
|
|
5315
|
+
// https://github.com/vitejs/vite/pull/13514#issuecomment-1592431496
|
|
5316
|
+
else if (type === 'js' && (!map || map.mappings !== '')) {
|
|
5317
|
+
const code = content.toString();
|
|
5318
|
+
// if the code has existing inline sourcemap, assume it's correct and skip
|
|
5319
|
+
if (convertSourceMap.mapFileCommentRegex.test(code)) {
|
|
5320
|
+
debug?.(`Skipped injecting fallback sourcemap for ${req.url}`);
|
|
5321
|
+
}
|
|
5322
|
+
else {
|
|
5056
5323
|
const urlWithoutTimestamp = removeTimestampQuery(req.url);
|
|
5057
|
-
const ms = new MagicString(
|
|
5058
|
-
content = getCodeWithSourcemap(type,
|
|
5324
|
+
const ms = new MagicString(code);
|
|
5325
|
+
content = getCodeWithSourcemap(type, code, ms.generateMap({
|
|
5326
|
+
source: path$3.basename(urlWithoutTimestamp),
|
|
5327
|
+
hires: 'boundary',
|
|
5328
|
+
includeContent: true,
|
|
5329
|
+
}));
|
|
5059
5330
|
}
|
|
5060
5331
|
}
|
|
5061
5332
|
res.statusCode = 200;
|
|
@@ -5187,8 +5458,13 @@ function hasWorkspacePackageJSON(root) {
|
|
|
5187
5458
|
if (!isFileReadable(path)) {
|
|
5188
5459
|
return false;
|
|
5189
5460
|
}
|
|
5190
|
-
|
|
5191
|
-
|
|
5461
|
+
try {
|
|
5462
|
+
const content = JSON.parse(fs$1.readFileSync(path, 'utf-8')) || {};
|
|
5463
|
+
return !!content.workspaces;
|
|
5464
|
+
}
|
|
5465
|
+
catch {
|
|
5466
|
+
return false;
|
|
5467
|
+
}
|
|
5192
5468
|
}
|
|
5193
5469
|
function hasRootFile(root) {
|
|
5194
5470
|
return ROOT_FILES.some((file) => fs$1.existsSync(path$3.join(root, file)));
|
|
@@ -5637,48 +5913,59 @@ main$1.exports.populate = DotenvModule.populate;
|
|
|
5637
5913
|
|
|
5638
5914
|
main$1.exports = DotenvModule;
|
|
5639
5915
|
|
|
5916
|
+
// like String.prototype.search but returns the last index
|
|
5917
|
+
function _searchLast (str, rgx) {
|
|
5918
|
+
const matches = Array.from(str.matchAll(rgx));
|
|
5919
|
+
return matches.length > 0 ? matches.slice(-1)[0].index : -1
|
|
5920
|
+
}
|
|
5921
|
+
|
|
5640
5922
|
function _interpolate (envValue, environment, config) {
|
|
5641
|
-
|
|
5923
|
+
// find the last unescaped dollar sign in the
|
|
5924
|
+
// value so that we can evaluate it
|
|
5925
|
+
const lastUnescapedDollarSignIndex = _searchLast(envValue, /(?!(?<=\\))\$/g);
|
|
5642
5926
|
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
return newEnv
|
|
5647
|
-
}
|
|
5927
|
+
// If we couldn't match any unescaped dollar sign
|
|
5928
|
+
// let's return the string as is
|
|
5929
|
+
if (lastUnescapedDollarSignIndex === -1) return envValue
|
|
5648
5930
|
|
|
5649
|
-
|
|
5931
|
+
// This is the right-most group of variables in the string
|
|
5932
|
+
const rightMostGroup = envValue.slice(lastUnescapedDollarSignIndex);
|
|
5650
5933
|
|
|
5651
|
-
|
|
5934
|
+
/**
|
|
5935
|
+
* This finds the inner most variable/group divided
|
|
5936
|
+
* by variable name and default value (if present)
|
|
5937
|
+
* (
|
|
5938
|
+
* (?!(?<=\\))\$ // only match dollar signs that are not escaped
|
|
5939
|
+
* {? // optional opening curly brace
|
|
5940
|
+
* ([\w]+) // match the variable name
|
|
5941
|
+
* (?::-([^}\\]*))? // match an optional default value
|
|
5942
|
+
* }? // optional closing curly brace
|
|
5943
|
+
* )
|
|
5944
|
+
*/
|
|
5945
|
+
const matchGroup = /((?!(?<=\\))\${?([\w]+)(?::-([^}\\]*))?}?)/;
|
|
5946
|
+
const match = rightMostGroup.match(matchGroup);
|
|
5947
|
+
|
|
5948
|
+
if (match != null) {
|
|
5949
|
+
const [, group, variableName, defaultValue] = match;
|
|
5950
|
+
|
|
5951
|
+
return _interpolate(
|
|
5952
|
+
envValue.replace(
|
|
5953
|
+
group,
|
|
5954
|
+
environment[variableName] ||
|
|
5955
|
+
defaultValue ||
|
|
5956
|
+
config.parsed[variableName] ||
|
|
5957
|
+
''
|
|
5958
|
+
),
|
|
5959
|
+
environment,
|
|
5960
|
+
config
|
|
5961
|
+
)
|
|
5962
|
+
}
|
|
5652
5963
|
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
value = replacePart.replace('\\$', '$');
|
|
5656
|
-
} else {
|
|
5657
|
-
// PATCH: compatible with env variables ended with unescaped $
|
|
5658
|
-
if(!parts[2]) {
|
|
5659
|
-
return newEnv
|
|
5660
|
-
}
|
|
5661
|
-
const keyParts = parts[2].split(':-');
|
|
5662
|
-
const key = keyParts[0];
|
|
5663
|
-
replacePart = parts[0].substring(prefix.length);
|
|
5664
|
-
// process.env value 'wins' over .env file's value
|
|
5665
|
-
value = Object.prototype.hasOwnProperty.call(environment, key)
|
|
5666
|
-
? environment[key]
|
|
5667
|
-
: (config.parsed[key] || keyParts[1] || '');
|
|
5668
|
-
|
|
5669
|
-
// If the value is found, remove nested expansions.
|
|
5670
|
-
if (keyParts.length > 1 && value) {
|
|
5671
|
-
const replaceNested = matches[index + 1];
|
|
5672
|
-
matches[index + 1] = '';
|
|
5673
|
-
|
|
5674
|
-
newEnv = newEnv.replace(replaceNested, '');
|
|
5675
|
-
}
|
|
5676
|
-
// Resolve recursive interpolations
|
|
5677
|
-
value = _interpolate(value, environment, config);
|
|
5678
|
-
}
|
|
5964
|
+
return envValue
|
|
5965
|
+
}
|
|
5679
5966
|
|
|
5680
|
-
|
|
5681
|
-
|
|
5967
|
+
function _resolveEscapeSequences (value) {
|
|
5968
|
+
return value.replace(/\\\$/g, '$')
|
|
5682
5969
|
}
|
|
5683
5970
|
|
|
5684
5971
|
function expand (config) {
|
|
@@ -5686,9 +5973,13 @@ function expand (config) {
|
|
|
5686
5973
|
const environment = config.ignoreProcessEnv ? {} : process.env;
|
|
5687
5974
|
|
|
5688
5975
|
for (const configKey in config.parsed) {
|
|
5689
|
-
const value = Object.prototype.hasOwnProperty.call(environment, configKey)
|
|
5976
|
+
const value = Object.prototype.hasOwnProperty.call(environment, configKey)
|
|
5977
|
+
? environment[configKey]
|
|
5978
|
+
: config.parsed[configKey];
|
|
5690
5979
|
|
|
5691
|
-
config.parsed[configKey] =
|
|
5980
|
+
config.parsed[configKey] = _resolveEscapeSequences(
|
|
5981
|
+
_interpolate(value, environment, config)
|
|
5982
|
+
);
|
|
5692
5983
|
}
|
|
5693
5984
|
|
|
5694
5985
|
// PATCH: don't write to process.env
|
|
@@ -5701,6 +5992,14 @@ function expand (config) {
|
|
|
5701
5992
|
|
|
5702
5993
|
var expand_1 = expand;
|
|
5703
5994
|
|
|
5995
|
+
function getEnvFilesForMode(mode) {
|
|
5996
|
+
return [
|
|
5997
|
+
/** default file */ `.env`,
|
|
5998
|
+
/** local file */ `.env.local`,
|
|
5999
|
+
/** mode file */ `.env.${mode}`,
|
|
6000
|
+
/** mode local file */ `.env.${mode}.local`,
|
|
6001
|
+
];
|
|
6002
|
+
}
|
|
5704
6003
|
function loadEnv(mode, envDir, prefixes = 'VITE_') {
|
|
5705
6004
|
if (mode === 'local') {
|
|
5706
6005
|
throw new Error(`"local" cannot be used as a mode name because it conflicts with ` +
|
|
@@ -5708,12 +6007,7 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
|
|
|
5708
6007
|
}
|
|
5709
6008
|
prefixes = arraify(prefixes);
|
|
5710
6009
|
const env = {};
|
|
5711
|
-
const envFiles =
|
|
5712
|
-
/** default file */ `.env`,
|
|
5713
|
-
/** local file */ `.env.local`,
|
|
5714
|
-
/** mode file */ `.env.${mode}`,
|
|
5715
|
-
/** mode local file */ `.env.${mode}.local`,
|
|
5716
|
-
];
|
|
6010
|
+
const envFiles = getEnvFilesForMode(mode);
|
|
5717
6011
|
const parsed = Object.fromEntries(envFiles.flatMap((file) => {
|
|
5718
6012
|
const filePath = path$3.join(envDir, file);
|
|
5719
6013
|
if (!tryStatSync(filePath)?.isFile())
|