vite 5.0.0-beta.2 → 5.0.0-beta.20
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 +96 -39
- package/dist/client/client.mjs +34 -3
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-13ae786e.js → dep-M-BNPx05.js} +2 -2
- package/dist/node/chunks/{dep-82f73734.js → dep-T98iZFpD.js} +35023 -35691
- package/dist/node/chunks/{dep-5c5f3875.js → dep-_v8GkZ9b.js} +145 -145
- package/dist/node/cli.js +39 -38
- package/dist/node/constants.js +1 -0
- package/dist/node/index.d.ts +3315 -3502
- package/dist/node/index.js +9 -7
- package/dist/node-cjs/publicUtils.cjs +553 -500
- package/index.cjs +12 -9
- package/index.d.cts +6 -0
- package/package.json +43 -41
- 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
|
/**
|
|
@@ -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,11 +3368,13 @@ 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;
|
|
@@ -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;
|
|
@@ -4184,6 +4180,13 @@ class Chunk {
|
|
|
4184
4180
|
this.end = index;
|
|
4185
4181
|
|
|
4186
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' + ''
|
|
4187
4190
|
// TODO is this block necessary?...
|
|
4188
4191
|
newChunk.edit('', false);
|
|
4189
4192
|
this.content = '';
|
|
@@ -4212,6 +4215,10 @@ class Chunk {
|
|
|
4212
4215
|
if (trimmed.length) {
|
|
4213
4216
|
if (trimmed !== this.content) {
|
|
4214
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
|
+
}
|
|
4215
4222
|
}
|
|
4216
4223
|
return true;
|
|
4217
4224
|
} else {
|
|
@@ -4230,7 +4237,11 @@ class Chunk {
|
|
|
4230
4237
|
|
|
4231
4238
|
if (trimmed.length) {
|
|
4232
4239
|
if (trimmed !== this.content) {
|
|
4233
|
-
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
|
+
}
|
|
4234
4245
|
this.edit('', undefined, true);
|
|
4235
4246
|
}
|
|
4236
4247
|
return true;
|
|
@@ -4370,16 +4381,35 @@ class Mappings {
|
|
|
4370
4381
|
|
|
4371
4382
|
addEdit(sourceIndex, content, loc, nameIndex) {
|
|
4372
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
|
+
|
|
4373
4401
|
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
4374
4402
|
if (nameIndex >= 0) {
|
|
4375
4403
|
segment.push(nameIndex);
|
|
4376
4404
|
}
|
|
4377
4405
|
this.rawSegments.push(segment);
|
|
4406
|
+
|
|
4407
|
+
this.advance(content.slice(previousContentLineEnd + 1));
|
|
4378
4408
|
} else if (this.pending) {
|
|
4379
4409
|
this.rawSegments.push(this.pending);
|
|
4410
|
+
this.advance(content);
|
|
4380
4411
|
}
|
|
4381
4412
|
|
|
4382
|
-
this.advance(content);
|
|
4383
4413
|
this.pending = null;
|
|
4384
4414
|
}
|
|
4385
4415
|
|
|
@@ -5444,8 +5474,13 @@ function hasWorkspacePackageJSON(root) {
|
|
|
5444
5474
|
if (!isFileReadable(path)) {
|
|
5445
5475
|
return false;
|
|
5446
5476
|
}
|
|
5447
|
-
|
|
5448
|
-
|
|
5477
|
+
try {
|
|
5478
|
+
const content = JSON.parse(fs$1.readFileSync(path, 'utf-8')) || {};
|
|
5479
|
+
return !!content.workspaces;
|
|
5480
|
+
}
|
|
5481
|
+
catch {
|
|
5482
|
+
return false;
|
|
5483
|
+
}
|
|
5449
5484
|
}
|
|
5450
5485
|
function hasRootFile(root) {
|
|
5451
5486
|
return ROOT_FILES.some((file) => fs$1.existsSync(path$3.join(root, file)));
|
|
@@ -5894,48 +5929,59 @@ main$1.exports.populate = DotenvModule.populate;
|
|
|
5894
5929
|
|
|
5895
5930
|
main$1.exports = DotenvModule;
|
|
5896
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
|
+
|
|
5897
5938
|
function _interpolate (envValue, environment, config) {
|
|
5898
|
-
|
|
5939
|
+
// find the last unescaped dollar sign in the
|
|
5940
|
+
// value so that we can evaluate it
|
|
5941
|
+
const lastUnescapedDollarSignIndex = _searchLast(envValue, /(?!(?<=\\))\$/g);
|
|
5899
5942
|
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
return newEnv
|
|
5904
|
-
}
|
|
5943
|
+
// If we couldn't match any unescaped dollar sign
|
|
5944
|
+
// let's return the string as is
|
|
5945
|
+
if (lastUnescapedDollarSignIndex === -1) return envValue
|
|
5905
5946
|
|
|
5906
|
-
|
|
5947
|
+
// This is the right-most group of variables in the string
|
|
5948
|
+
const rightMostGroup = envValue.slice(lastUnescapedDollarSignIndex);
|
|
5907
5949
|
|
|
5908
|
-
|
|
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
|
+
}
|
|
5909
5979
|
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
value = replacePart.replace('\\$', '$');
|
|
5913
|
-
} else {
|
|
5914
|
-
// PATCH: compatible with env variables ended with unescaped $
|
|
5915
|
-
if(!parts[2]) {
|
|
5916
|
-
return newEnv
|
|
5917
|
-
}
|
|
5918
|
-
const keyParts = parts[2].split(':-');
|
|
5919
|
-
const key = keyParts[0];
|
|
5920
|
-
replacePart = parts[0].substring(prefix.length);
|
|
5921
|
-
// process.env value 'wins' over .env file's value
|
|
5922
|
-
value = Object.prototype.hasOwnProperty.call(environment, key)
|
|
5923
|
-
? environment[key]
|
|
5924
|
-
: (config.parsed[key] || keyParts[1] || '');
|
|
5925
|
-
|
|
5926
|
-
// If the value is found, remove nested expansions.
|
|
5927
|
-
if (keyParts.length > 1 && value) {
|
|
5928
|
-
const replaceNested = matches[index + 1];
|
|
5929
|
-
matches[index + 1] = '';
|
|
5930
|
-
|
|
5931
|
-
newEnv = newEnv.replace(replaceNested, '');
|
|
5932
|
-
}
|
|
5933
|
-
// Resolve recursive interpolations
|
|
5934
|
-
value = _interpolate(value, environment, config);
|
|
5935
|
-
}
|
|
5980
|
+
return envValue
|
|
5981
|
+
}
|
|
5936
5982
|
|
|
5937
|
-
|
|
5938
|
-
|
|
5983
|
+
function _resolveEscapeSequences (value) {
|
|
5984
|
+
return value.replace(/\\\$/g, '$')
|
|
5939
5985
|
}
|
|
5940
5986
|
|
|
5941
5987
|
function expand (config) {
|
|
@@ -5943,9 +5989,13 @@ function expand (config) {
|
|
|
5943
5989
|
const environment = config.ignoreProcessEnv ? {} : process.env;
|
|
5944
5990
|
|
|
5945
5991
|
for (const configKey in config.parsed) {
|
|
5946
|
-
const value = Object.prototype.hasOwnProperty.call(environment, configKey)
|
|
5992
|
+
const value = Object.prototype.hasOwnProperty.call(environment, configKey)
|
|
5993
|
+
? environment[configKey]
|
|
5994
|
+
: config.parsed[configKey];
|
|
5947
5995
|
|
|
5948
|
-
config.parsed[configKey] =
|
|
5996
|
+
config.parsed[configKey] = _resolveEscapeSequences(
|
|
5997
|
+
_interpolate(value, environment, config)
|
|
5998
|
+
);
|
|
5949
5999
|
}
|
|
5950
6000
|
|
|
5951
6001
|
// PATCH: don't write to process.env
|
|
@@ -5958,6 +6008,14 @@ function expand (config) {
|
|
|
5958
6008
|
|
|
5959
6009
|
var expand_1 = expand;
|
|
5960
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
|
+
}
|
|
5961
6019
|
function loadEnv(mode, envDir, prefixes = 'VITE_') {
|
|
5962
6020
|
if (mode === 'local') {
|
|
5963
6021
|
throw new Error(`"local" cannot be used as a mode name because it conflicts with ` +
|
|
@@ -5965,12 +6023,7 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
|
|
|
5965
6023
|
}
|
|
5966
6024
|
prefixes = arraify(prefixes);
|
|
5967
6025
|
const env = {};
|
|
5968
|
-
const envFiles =
|
|
5969
|
-
/** default file */ `.env`,
|
|
5970
|
-
/** local file */ `.env.local`,
|
|
5971
|
-
/** mode file */ `.env.${mode}`,
|
|
5972
|
-
/** mode local file */ `.env.${mode}.local`,
|
|
5973
|
-
];
|
|
6026
|
+
const envFiles = getEnvFilesForMode(mode);
|
|
5974
6027
|
const parsed = Object.fromEntries(envFiles.flatMap((file) => {
|
|
5975
6028
|
const filePath = path$3.join(envDir, file);
|
|
5976
6029
|
if (!tryStatSync(filePath)?.isFile())
|