vite 3.2.0-beta.0 → 3.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node/chunks/{dep-92763d7a.js → dep-34b5a6bf.js} +183 -120
- package/dist/node/chunks/{dep-553f6a62.js → dep-46ac452b.js} +1 -1
- package/dist/node/cli.js +5 -5
- package/dist/node/constants.js +1 -1
- package/dist/node/index.d.ts +3 -1
- package/dist/node/index.js +1 -1
- package/dist/node-cjs/publicUtils.cjs +13 -1
- package/package.json +4 -4
- package/types/package.json +3 -0
|
@@ -165,14 +165,21 @@ function getEntries({ entries, customResolver }) {
|
|
|
165
165
|
return { find: key, replacement: value, resolverFunction: resolverFunctionFromOptions };
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
|
+
function getHookFunction(hook) {
|
|
169
|
+
if (typeof hook === 'function') {
|
|
170
|
+
return hook;
|
|
171
|
+
}
|
|
172
|
+
if (hook && 'handler' in hook && typeof hook.handler === 'function') {
|
|
173
|
+
return hook.handler;
|
|
174
|
+
}
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
168
177
|
function resolveCustomResolver(customResolver) {
|
|
178
|
+
if (typeof customResolver === 'function') {
|
|
179
|
+
return customResolver;
|
|
180
|
+
}
|
|
169
181
|
if (customResolver) {
|
|
170
|
-
|
|
171
|
-
return customResolver;
|
|
172
|
-
}
|
|
173
|
-
if (typeof customResolver.resolveId === 'function') {
|
|
174
|
-
return customResolver.resolveId;
|
|
175
|
-
}
|
|
182
|
+
return getHookFunction(customResolver.resolveId);
|
|
176
183
|
}
|
|
177
184
|
return null;
|
|
178
185
|
}
|
|
@@ -187,10 +194,7 @@ function alias$1(options = {}) {
|
|
|
187
194
|
return {
|
|
188
195
|
name: 'alias',
|
|
189
196
|
async buildStart(inputOptions) {
|
|
190
|
-
await Promise.all([...(Array.isArray(options.entries) ? options.entries : []), options].map(({ customResolver }) => customResolver &&
|
|
191
|
-
typeof customResolver === 'object' &&
|
|
192
|
-
typeof customResolver.buildStart === 'function' &&
|
|
193
|
-
customResolver.buildStart.call(this, inputOptions)));
|
|
197
|
+
await Promise.all([...(Array.isArray(options.entries) ? options.entries : []), options].map(({ customResolver }) => { var _a; return customResolver && ((_a = getHookFunction(customResolver.buildStart)) === null || _a === void 0 ? void 0 : _a.call(this, inputOptions)); }));
|
|
194
198
|
},
|
|
195
199
|
resolveId(importee, importer, resolveOptions) {
|
|
196
200
|
if (!importer) {
|
|
@@ -9645,16 +9649,30 @@ const schemeRegex = /^[\w+.-]+:\/\//;
|
|
|
9645
9649
|
* 3. Host, guaranteed.
|
|
9646
9650
|
* 4. Port, including ":", optional.
|
|
9647
9651
|
* 5. Path, including "/", optional.
|
|
9652
|
+
* 6. Query, including "?", optional.
|
|
9653
|
+
* 7. Hash, including "#", optional.
|
|
9648
9654
|
*/
|
|
9649
|
-
const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?/;
|
|
9655
|
+
const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
|
|
9650
9656
|
/**
|
|
9651
9657
|
* File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start
|
|
9652
9658
|
* with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).
|
|
9653
9659
|
*
|
|
9654
9660
|
* 1. Host, optional.
|
|
9655
|
-
* 2. Path, which may
|
|
9656
|
-
|
|
9657
|
-
|
|
9661
|
+
* 2. Path, which may include "/", guaranteed.
|
|
9662
|
+
* 3. Query, including "?", optional.
|
|
9663
|
+
* 4. Hash, including "#", optional.
|
|
9664
|
+
*/
|
|
9665
|
+
const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
|
|
9666
|
+
var UrlType;
|
|
9667
|
+
(function (UrlType) {
|
|
9668
|
+
UrlType[UrlType["Empty"] = 1] = "Empty";
|
|
9669
|
+
UrlType[UrlType["Hash"] = 2] = "Hash";
|
|
9670
|
+
UrlType[UrlType["Query"] = 3] = "Query";
|
|
9671
|
+
UrlType[UrlType["RelativePath"] = 4] = "RelativePath";
|
|
9672
|
+
UrlType[UrlType["AbsolutePath"] = 5] = "AbsolutePath";
|
|
9673
|
+
UrlType[UrlType["SchemeRelative"] = 6] = "SchemeRelative";
|
|
9674
|
+
UrlType[UrlType["Absolute"] = 7] = "Absolute";
|
|
9675
|
+
})(UrlType || (UrlType = {}));
|
|
9658
9676
|
function isAbsoluteUrl(input) {
|
|
9659
9677
|
return schemeRegex.test(input);
|
|
9660
9678
|
}
|
|
@@ -9667,35 +9685,42 @@ function isAbsolutePath(input) {
|
|
|
9667
9685
|
function isFileUrl(input) {
|
|
9668
9686
|
return input.startsWith('file:');
|
|
9669
9687
|
}
|
|
9688
|
+
function isRelative(input) {
|
|
9689
|
+
return /^[.?#]/.test(input);
|
|
9690
|
+
}
|
|
9670
9691
|
function parseAbsoluteUrl(input) {
|
|
9671
9692
|
const match = urlRegex.exec(input);
|
|
9672
|
-
return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/');
|
|
9693
|
+
return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || '');
|
|
9673
9694
|
}
|
|
9674
9695
|
function parseFileUrl(input) {
|
|
9675
9696
|
const match = fileRegex.exec(input);
|
|
9676
9697
|
const path = match[2];
|
|
9677
|
-
return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path);
|
|
9698
|
+
return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || '');
|
|
9678
9699
|
}
|
|
9679
|
-
function makeUrl(scheme, user, host, port, path) {
|
|
9700
|
+
function makeUrl(scheme, user, host, port, path, query, hash) {
|
|
9680
9701
|
return {
|
|
9681
9702
|
scheme,
|
|
9682
9703
|
user,
|
|
9683
9704
|
host,
|
|
9684
9705
|
port,
|
|
9685
9706
|
path,
|
|
9686
|
-
|
|
9707
|
+
query,
|
|
9708
|
+
hash,
|
|
9709
|
+
type: UrlType.Absolute,
|
|
9687
9710
|
};
|
|
9688
9711
|
}
|
|
9689
9712
|
function parseUrl$2(input) {
|
|
9690
9713
|
if (isSchemeRelativeUrl(input)) {
|
|
9691
9714
|
const url = parseAbsoluteUrl('http:' + input);
|
|
9692
9715
|
url.scheme = '';
|
|
9716
|
+
url.type = UrlType.SchemeRelative;
|
|
9693
9717
|
return url;
|
|
9694
9718
|
}
|
|
9695
9719
|
if (isAbsolutePath(input)) {
|
|
9696
9720
|
const url = parseAbsoluteUrl('http://foo.com' + input);
|
|
9697
9721
|
url.scheme = '';
|
|
9698
9722
|
url.host = '';
|
|
9723
|
+
url.type = UrlType.AbsolutePath;
|
|
9699
9724
|
return url;
|
|
9700
9725
|
}
|
|
9701
9726
|
if (isFileUrl(input))
|
|
@@ -9705,7 +9730,13 @@ function parseUrl$2(input) {
|
|
|
9705
9730
|
const url = parseAbsoluteUrl('http://foo.com/' + input);
|
|
9706
9731
|
url.scheme = '';
|
|
9707
9732
|
url.host = '';
|
|
9708
|
-
url.
|
|
9733
|
+
url.type = input
|
|
9734
|
+
? input.startsWith('?')
|
|
9735
|
+
? UrlType.Query
|
|
9736
|
+
: input.startsWith('#')
|
|
9737
|
+
? UrlType.Hash
|
|
9738
|
+
: UrlType.RelativePath
|
|
9739
|
+
: UrlType.Empty;
|
|
9709
9740
|
return url;
|
|
9710
9741
|
}
|
|
9711
9742
|
function stripPathFilename(path) {
|
|
@@ -9717,10 +9748,7 @@ function stripPathFilename(path) {
|
|
|
9717
9748
|
return path.slice(0, index + 1);
|
|
9718
9749
|
}
|
|
9719
9750
|
function mergePaths(url, base) {
|
|
9720
|
-
|
|
9721
|
-
if (!url.relativePath)
|
|
9722
|
-
return;
|
|
9723
|
-
normalizePath$5(base);
|
|
9751
|
+
normalizePath$5(base, base.type);
|
|
9724
9752
|
// If the path is just a "/", then it was an empty path to begin with (remember, we're a relative
|
|
9725
9753
|
// path).
|
|
9726
9754
|
if (url.path === '/') {
|
|
@@ -9730,15 +9758,13 @@ function mergePaths(url, base) {
|
|
|
9730
9758
|
// Resolution happens relative to the base path's directory, not the file.
|
|
9731
9759
|
url.path = stripPathFilename(base.path) + url.path;
|
|
9732
9760
|
}
|
|
9733
|
-
// If the base path is absolute, then our path is now absolute too.
|
|
9734
|
-
url.relativePath = base.relativePath;
|
|
9735
9761
|
}
|
|
9736
9762
|
/**
|
|
9737
9763
|
* The path can have empty directories "//", unneeded parents "foo/..", or current directory
|
|
9738
9764
|
* "foo/.". We need to normalize to a standard representation.
|
|
9739
9765
|
*/
|
|
9740
|
-
function normalizePath$5(url) {
|
|
9741
|
-
const
|
|
9766
|
+
function normalizePath$5(url, type) {
|
|
9767
|
+
const rel = type <= UrlType.RelativePath;
|
|
9742
9768
|
const pieces = url.path.split('/');
|
|
9743
9769
|
// We need to preserve the first piece always, so that we output a leading slash. The item at
|
|
9744
9770
|
// pieces[0] is an empty string.
|
|
@@ -9770,7 +9796,7 @@ function normalizePath$5(url) {
|
|
|
9770
9796
|
positive--;
|
|
9771
9797
|
pointer--;
|
|
9772
9798
|
}
|
|
9773
|
-
else if (
|
|
9799
|
+
else if (rel) {
|
|
9774
9800
|
// If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute
|
|
9775
9801
|
// URL, protocol relative URL, or an absolute path, we don't need to keep excess.
|
|
9776
9802
|
pieces[pointer++] = piece;
|
|
@@ -9798,37 +9824,60 @@ function resolve$3(input, base) {
|
|
|
9798
9824
|
if (!input && !base)
|
|
9799
9825
|
return '';
|
|
9800
9826
|
const url = parseUrl$2(input);
|
|
9801
|
-
|
|
9802
|
-
if (base &&
|
|
9827
|
+
let inputType = url.type;
|
|
9828
|
+
if (base && inputType !== UrlType.Absolute) {
|
|
9803
9829
|
const baseUrl = parseUrl$2(base);
|
|
9804
|
-
|
|
9805
|
-
|
|
9806
|
-
|
|
9807
|
-
|
|
9808
|
-
|
|
9809
|
-
|
|
9810
|
-
|
|
9811
|
-
|
|
9812
|
-
|
|
9813
|
-
|
|
9814
|
-
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
|
|
9818
|
-
|
|
9819
|
-
|
|
9820
|
-
|
|
9821
|
-
|
|
9822
|
-
|
|
9823
|
-
|
|
9824
|
-
|
|
9825
|
-
|
|
9830
|
+
const baseType = baseUrl.type;
|
|
9831
|
+
switch (inputType) {
|
|
9832
|
+
case UrlType.Empty:
|
|
9833
|
+
url.hash = baseUrl.hash;
|
|
9834
|
+
// fall through
|
|
9835
|
+
case UrlType.Hash:
|
|
9836
|
+
url.query = baseUrl.query;
|
|
9837
|
+
// fall through
|
|
9838
|
+
case UrlType.Query:
|
|
9839
|
+
case UrlType.RelativePath:
|
|
9840
|
+
mergePaths(url, baseUrl);
|
|
9841
|
+
// fall through
|
|
9842
|
+
case UrlType.AbsolutePath:
|
|
9843
|
+
// The host, user, and port are joined, you can't copy one without the others.
|
|
9844
|
+
url.user = baseUrl.user;
|
|
9845
|
+
url.host = baseUrl.host;
|
|
9846
|
+
url.port = baseUrl.port;
|
|
9847
|
+
// fall through
|
|
9848
|
+
case UrlType.SchemeRelative:
|
|
9849
|
+
// The input doesn't have a schema at least, so we need to copy at least that over.
|
|
9850
|
+
url.scheme = baseUrl.scheme;
|
|
9851
|
+
}
|
|
9852
|
+
if (baseType > inputType)
|
|
9853
|
+
inputType = baseType;
|
|
9854
|
+
}
|
|
9855
|
+
normalizePath$5(url, inputType);
|
|
9856
|
+
const queryHash = url.query + url.hash;
|
|
9857
|
+
switch (inputType) {
|
|
9858
|
+
// This is impossible, because of the empty checks at the start of the function.
|
|
9859
|
+
// case UrlType.Empty:
|
|
9860
|
+
case UrlType.Hash:
|
|
9861
|
+
case UrlType.Query:
|
|
9862
|
+
return queryHash;
|
|
9863
|
+
case UrlType.RelativePath: {
|
|
9864
|
+
// The first char is always a "/", and we need it to be relative.
|
|
9865
|
+
const path = url.path.slice(1);
|
|
9866
|
+
if (!path)
|
|
9867
|
+
return queryHash || '.';
|
|
9868
|
+
if (isRelative(base || input) && !isRelative(path)) {
|
|
9869
|
+
// If base started with a leading ".", or there is no base and input started with a ".",
|
|
9870
|
+
// then we need to ensure that the relative path starts with a ".". We don't know if
|
|
9871
|
+
// relative starts with a "..", though, so check before prepending.
|
|
9872
|
+
return './' + path + queryHash;
|
|
9873
|
+
}
|
|
9874
|
+
return path + queryHash;
|
|
9875
|
+
}
|
|
9876
|
+
case UrlType.AbsolutePath:
|
|
9877
|
+
return url.path + queryHash;
|
|
9878
|
+
default:
|
|
9879
|
+
return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;
|
|
9826
9880
|
}
|
|
9827
|
-
// If there's no host (and no scheme/user/port), then we need to output an absolute path.
|
|
9828
|
-
if (!url.scheme && !url.host)
|
|
9829
|
-
return url.path;
|
|
9830
|
-
// We're outputting either an absolute URL, or a protocol relative one.
|
|
9831
|
-
return `${url.scheme}//${url.user}${url.host}${url.port}${url.path}`;
|
|
9832
9881
|
}
|
|
9833
9882
|
|
|
9834
9883
|
function resolve$2(input, base) {
|
|
@@ -10033,7 +10082,9 @@ class TraceMap {
|
|
|
10033
10082
|
// mapping (like a "//# sourceMappingURL=") at the end of the child file.
|
|
10034
10083
|
if (line >= decoded.length)
|
|
10035
10084
|
return null;
|
|
10036
|
-
|
|
10085
|
+
const segments = decoded[line];
|
|
10086
|
+
const index = traceSegmentInternal(segments, map._decodedMemo, line, column, GREATEST_LOWER_BOUND);
|
|
10087
|
+
return index === -1 ? null : segments[index];
|
|
10037
10088
|
};
|
|
10038
10089
|
originalPositionFor$1 = (map, { line, column, bias }) => {
|
|
10039
10090
|
line--;
|
|
@@ -10046,10 +10097,12 @@ class TraceMap {
|
|
|
10046
10097
|
// mapping (like a "//# sourceMappingURL=") at the end of the child file.
|
|
10047
10098
|
if (line >= decoded.length)
|
|
10048
10099
|
return OMapping(null, null, null, null);
|
|
10049
|
-
const
|
|
10050
|
-
|
|
10100
|
+
const segments = decoded[line];
|
|
10101
|
+
const index = traceSegmentInternal(segments, map._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND);
|
|
10102
|
+
if (index === -1)
|
|
10051
10103
|
return OMapping(null, null, null, null);
|
|
10052
|
-
|
|
10104
|
+
const segment = segments[index];
|
|
10105
|
+
if (segment.length === 1)
|
|
10053
10106
|
return OMapping(null, null, null, null);
|
|
10054
10107
|
const { names, resolvedSources } = map;
|
|
10055
10108
|
return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null);
|
|
@@ -10066,8 +10119,8 @@ function traceSegmentInternal(segments, memo, line, column, bias) {
|
|
|
10066
10119
|
else if (bias === LEAST_UPPER_BOUND)
|
|
10067
10120
|
index++;
|
|
10068
10121
|
if (index === -1 || index === segments.length)
|
|
10069
|
-
return
|
|
10070
|
-
return
|
|
10122
|
+
return -1;
|
|
10123
|
+
return index;
|
|
10071
10124
|
}
|
|
10072
10125
|
|
|
10073
10126
|
/**
|
|
@@ -26803,6 +26856,11 @@ class MagicString {
|
|
|
26803
26856
|
}
|
|
26804
26857
|
|
|
26805
26858
|
overwrite(start, end, content, options) {
|
|
26859
|
+
options = options || {};
|
|
26860
|
+
return this.update(start, end, content, { ...options, overwrite: !options.contentOnly });
|
|
26861
|
+
}
|
|
26862
|
+
|
|
26863
|
+
update(start, end, content, options) {
|
|
26806
26864
|
if (typeof content !== 'string') throw new TypeError('replacement content must be a string');
|
|
26807
26865
|
|
|
26808
26866
|
while (start < 0) start += this.original.length;
|
|
@@ -26828,7 +26886,7 @@ class MagicString {
|
|
|
26828
26886
|
options = { storeName: true };
|
|
26829
26887
|
}
|
|
26830
26888
|
const storeName = options !== undefined ? options.storeName : false;
|
|
26831
|
-
const
|
|
26889
|
+
const overwrite = options !== undefined ? options.overwrite : false;
|
|
26832
26890
|
|
|
26833
26891
|
if (storeName) {
|
|
26834
26892
|
const original = this.original.slice(start, end);
|
|
@@ -26852,7 +26910,7 @@ class MagicString {
|
|
|
26852
26910
|
chunk.edit('', false);
|
|
26853
26911
|
}
|
|
26854
26912
|
|
|
26855
|
-
first.edit(content, storeName,
|
|
26913
|
+
first.edit(content, storeName, !overwrite);
|
|
26856
26914
|
} else {
|
|
26857
26915
|
// must be inserting at the end
|
|
26858
26916
|
const newChunk = new Chunk(start, end, '').edit(content, storeName);
|
|
@@ -33438,9 +33496,7 @@ function renderAssetUrlInJS(ctx, config, chunk, opts, code) {
|
|
|
33438
33496
|
const replacementString = typeof replacement === 'string'
|
|
33439
33497
|
? JSON.stringify(replacement).slice(1, -1)
|
|
33440
33498
|
: `"+${replacement.runtime}+"`;
|
|
33441
|
-
s.
|
|
33442
|
-
contentOnly: true
|
|
33443
|
-
});
|
|
33499
|
+
s.update(match.index, match.index + full.length, replacementString);
|
|
33444
33500
|
}
|
|
33445
33501
|
// Replace __VITE_PUBLIC_ASSET__5aa0ddc0__ with absolute paths
|
|
33446
33502
|
const publicAssetUrlMap = publicAssetUrlCache.get(config);
|
|
@@ -33452,9 +33508,7 @@ function renderAssetUrlInJS(ctx, config, chunk, opts, code) {
|
|
|
33452
33508
|
const replacementString = typeof replacement === 'string'
|
|
33453
33509
|
? JSON.stringify(replacement).slice(1, -1)
|
|
33454
33510
|
: `"+${replacement.runtime}+"`;
|
|
33455
|
-
s.
|
|
33456
|
-
contentOnly: true
|
|
33457
|
-
});
|
|
33511
|
+
s.update(match.index, match.index + full.length, replacementString);
|
|
33458
33512
|
}
|
|
33459
33513
|
return s;
|
|
33460
33514
|
}
|
|
@@ -34530,9 +34584,7 @@ function webWorkerPlugin(config) {
|
|
|
34530
34584
|
const replacementString = typeof replacement === 'string'
|
|
34531
34585
|
? JSON.stringify(replacement).slice(1, -1)
|
|
34532
34586
|
: `"+${replacement.runtime}+"`;
|
|
34533
|
-
s.
|
|
34534
|
-
contentOnly: true
|
|
34535
|
-
});
|
|
34587
|
+
s.update(match.index, match.index + full.length, replacementString);
|
|
34536
34588
|
}
|
|
34537
34589
|
}
|
|
34538
34590
|
return result();
|
|
@@ -38765,7 +38817,7 @@ function definePlugin(config) {
|
|
|
38765
38817
|
const start = match.index;
|
|
38766
38818
|
const end = start + match[0].length;
|
|
38767
38819
|
const replacement = '' + replacements[match[1]];
|
|
38768
|
-
s.
|
|
38820
|
+
s.update(start, end, replacement);
|
|
38769
38821
|
}
|
|
38770
38822
|
if (!hasReplaced) {
|
|
38771
38823
|
return null;
|
|
@@ -40333,7 +40385,7 @@ function workerImportMetaUrlPlugin(config) {
|
|
|
40333
40385
|
builtUrl = injectQuery(builtUrl, WORKER_FILE_ID);
|
|
40334
40386
|
builtUrl = injectQuery(builtUrl, `type=${workerType}`);
|
|
40335
40387
|
}
|
|
40336
|
-
s.
|
|
40388
|
+
s.update(urlIndex, urlIndex + exp.length, `new URL(${JSON.stringify(builtUrl)}, self.location)`);
|
|
40337
40389
|
}
|
|
40338
40390
|
if (s) {
|
|
40339
40391
|
return transformStableResult(s, id, config);
|
|
@@ -40385,7 +40437,7 @@ function assetImportMetaUrlPlugin(config) {
|
|
|
40385
40437
|
// target so we use the global location here. It can be
|
|
40386
40438
|
// window.location or self.location in case it is used in a Web Worker.
|
|
40387
40439
|
// @see https://developer.mozilla.org/en-US/docs/Web/API/Window/self
|
|
40388
|
-
s.
|
|
40440
|
+
s.update(index, index + exp.length, `new URL((import.meta.glob(${pattern}, { eager: true, import: 'default', as: 'url' }))[${rawUrl}], self.location)`);
|
|
40389
40441
|
continue;
|
|
40390
40442
|
}
|
|
40391
40443
|
}
|
|
@@ -40428,7 +40480,7 @@ function assetImportMetaUrlPlugin(config) {
|
|
|
40428
40480
|
config.logger.warnOnce(`\n${rawExp} doesn't exist at build time, it will remain unchanged to be resolved at runtime`);
|
|
40429
40481
|
builtUrl = url;
|
|
40430
40482
|
}
|
|
40431
|
-
s.
|
|
40483
|
+
s.update(index, index + exp.length, `new URL(${JSON.stringify(builtUrl)}, self.location)`);
|
|
40432
40484
|
}
|
|
40433
40485
|
if (s) {
|
|
40434
40486
|
return transformStableResult(s, id, config);
|
|
@@ -43325,9 +43377,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
43325
43377
|
let rewrittenUrl = JSON.stringify(file);
|
|
43326
43378
|
if (!isDynamicImport)
|
|
43327
43379
|
rewrittenUrl = rewrittenUrl.slice(1, -1);
|
|
43328
|
-
str().
|
|
43329
|
-
contentOnly: true
|
|
43330
|
-
});
|
|
43380
|
+
str().update(start, end, rewrittenUrl);
|
|
43331
43381
|
}
|
|
43332
43382
|
}
|
|
43333
43383
|
}
|
|
@@ -43346,9 +43396,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
43346
43396
|
// edge case for package names ending with .css (e.g normalize.css)
|
|
43347
43397
|
!(bareImportRE.test(specifier) && !specifier.includes('/'))) {
|
|
43348
43398
|
const url = specifier.replace(/\?|$/, (m) => `?used${m ? '&' : ''}`);
|
|
43349
|
-
str().
|
|
43350
|
-
contentOnly: true
|
|
43351
|
-
});
|
|
43399
|
+
str().update(start, end, isDynamicImport ? `'${url}'` : url);
|
|
43352
43400
|
}
|
|
43353
43401
|
}
|
|
43354
43402
|
if (needPreloadHelper &&
|
|
@@ -43372,7 +43420,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
43372
43420
|
const s = new MagicString(code);
|
|
43373
43421
|
let match;
|
|
43374
43422
|
while ((match = re.exec(code))) {
|
|
43375
|
-
s.
|
|
43423
|
+
s.update(match.index, match.index + isModernFlag.length, isModern);
|
|
43376
43424
|
}
|
|
43377
43425
|
return {
|
|
43378
43426
|
code: s.toString(),
|
|
@@ -43452,9 +43500,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
43452
43500
|
});
|
|
43453
43501
|
hasRemovedPureCssChunk = true;
|
|
43454
43502
|
}
|
|
43455
|
-
s.
|
|
43456
|
-
contentOnly: true
|
|
43457
|
-
});
|
|
43503
|
+
s.update(expStart, expEnd, 'Promise.resolve({})');
|
|
43458
43504
|
}
|
|
43459
43505
|
}
|
|
43460
43506
|
};
|
|
@@ -43512,7 +43558,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
43512
43558
|
? toRelativePath(d, file)
|
|
43513
43559
|
: d));
|
|
43514
43560
|
}
|
|
43515
|
-
s.
|
|
43561
|
+
s.update(markerStartPos, markerStartPos + preloadMarkerWithQuote.length, `[${renderedDeps.join(',')}]`);
|
|
43516
43562
|
rewroteMarkerStartPos.add(markerStartPos);
|
|
43517
43563
|
}
|
|
43518
43564
|
}
|
|
@@ -43522,7 +43568,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
43522
43568
|
let markerStartPos = code.indexOf(preloadMarkerWithQuote);
|
|
43523
43569
|
while (markerStartPos >= 0) {
|
|
43524
43570
|
if (!rewroteMarkerStartPos.has(markerStartPos)) {
|
|
43525
|
-
s.
|
|
43571
|
+
s.update(markerStartPos, markerStartPos + preloadMarkerWithQuote.length, 'void 0');
|
|
43526
43572
|
}
|
|
43527
43573
|
markerStartPos = code.indexOf(preloadMarkerWithQuote, markerStartPos + preloadMarkerWithQuote.length);
|
|
43528
43574
|
}
|
|
@@ -43707,6 +43753,8 @@ function getScriptInfo(node) {
|
|
|
43707
43753
|
let isModule = false;
|
|
43708
43754
|
let isAsync = false;
|
|
43709
43755
|
for (const p of node.attrs) {
|
|
43756
|
+
if (p.prefix !== undefined)
|
|
43757
|
+
continue;
|
|
43710
43758
|
if (p.name === 'src') {
|
|
43711
43759
|
if (!src) {
|
|
43712
43760
|
src = p;
|
|
@@ -43732,7 +43780,7 @@ function overwriteAttrValue(s, sourceCodeLocation, newValue) {
|
|
|
43732
43780
|
}
|
|
43733
43781
|
const wrapOffset = valueStart[1] === '"' || valueStart[1] === "'" ? 1 : 0;
|
|
43734
43782
|
const valueOffset = valueStart.index + valueStart[0].length - 1;
|
|
43735
|
-
s.
|
|
43783
|
+
s.update(sourceCodeLocation.startOffset + valueOffset + wrapOffset, sourceCodeLocation.endOffset - wrapOffset, newValue);
|
|
43736
43784
|
return s;
|
|
43737
43785
|
}
|
|
43738
43786
|
/**
|
|
@@ -43873,15 +43921,17 @@ function buildHtmlPlugin(config) {
|
|
|
43873
43921
|
const assetAttrs = assetAttrsConfig[node.nodeName];
|
|
43874
43922
|
if (assetAttrs) {
|
|
43875
43923
|
for (const p of node.attrs) {
|
|
43876
|
-
|
|
43877
|
-
|
|
43924
|
+
const attrKey = getAttrKey(p);
|
|
43925
|
+
if (p.value && assetAttrs.includes(attrKey)) {
|
|
43926
|
+
const attrSourceCodeLocation = node.sourceCodeLocation.attrs[attrKey];
|
|
43878
43927
|
// assetsUrl may be encodeURI
|
|
43879
43928
|
const url = decodeURI(p.value);
|
|
43880
43929
|
if (!isExcludedUrl(url)) {
|
|
43881
43930
|
if (node.nodeName === 'link' &&
|
|
43882
43931
|
isCSSRequest(url) &&
|
|
43883
43932
|
// should not be converted if following attributes are present (#6748)
|
|
43884
|
-
!node.attrs.some((p) => p.
|
|
43933
|
+
!node.attrs.some((p) => p.prefix === undefined &&
|
|
43934
|
+
(p.name === 'media' || p.name === 'disabled'))) {
|
|
43885
43935
|
// CSS references, convert to import
|
|
43886
43936
|
const importExpression = `\nimport ${JSON.stringify(url)}`;
|
|
43887
43937
|
styleUrls.push({
|
|
@@ -43906,7 +43956,9 @@ function buildHtmlPlugin(config) {
|
|
|
43906
43956
|
}
|
|
43907
43957
|
// <tag style="... url(...) ..."></tag>
|
|
43908
43958
|
// extract inline styles as virtual css and add class attribute to tag for selecting
|
|
43909
|
-
const inlineStyle = node.attrs.find((prop) => prop.
|
|
43959
|
+
const inlineStyle = node.attrs.find((prop) => prop.prefix === undefined &&
|
|
43960
|
+
prop.name === 'style' &&
|
|
43961
|
+
prop.value.includes('url(') // only url(...) in css need to emit file
|
|
43910
43962
|
);
|
|
43911
43963
|
if (inlineStyle) {
|
|
43912
43964
|
inlineModuleIndex++;
|
|
@@ -43933,7 +43985,7 @@ function buildHtmlPlugin(config) {
|
|
|
43933
43985
|
js += `\nimport "${id}?html-proxy&inline-css&index=${inlineModuleIndex}.css"`;
|
|
43934
43986
|
const hash = getHash(cleanUrl(id));
|
|
43935
43987
|
// will transform in `applyHtmlTransforms`
|
|
43936
|
-
s.
|
|
43988
|
+
s.update(styleNode.sourceCodeLocation.startOffset, styleNode.sourceCodeLocation.endOffset, `__VITE_INLINE_CSS__${hash}_${inlineModuleIndex}__`);
|
|
43937
43989
|
}
|
|
43938
43990
|
if (shouldRemove) {
|
|
43939
43991
|
// remove the script tag from the html. we are going to inject new
|
|
@@ -43957,7 +44009,7 @@ function buildHtmlPlugin(config) {
|
|
|
43957
44009
|
!namedOutput.includes(content.replace(/^\//, '')) // Allow for absolute references as named output can't be an absolute path
|
|
43958
44010
|
) {
|
|
43959
44011
|
try {
|
|
43960
|
-
const url = attr.name === 'srcset'
|
|
44012
|
+
const url = attr.prefix === undefined && attr.name === 'srcset'
|
|
43961
44013
|
? await processSrcSet(content, ({ url }) => urlToBuiltUrl(url, id, config, this))
|
|
43962
44014
|
: await urlToBuiltUrl(content, id, config, this);
|
|
43963
44015
|
overwriteAttrValue(s, sourceCodeLocation, url);
|
|
@@ -43972,12 +44024,10 @@ function buildHtmlPlugin(config) {
|
|
|
43972
44024
|
// emit <script>import("./aaa")</script> asset
|
|
43973
44025
|
for (const { start, end, url } of scriptUrls) {
|
|
43974
44026
|
if (!isExcludedUrl(url)) {
|
|
43975
|
-
s.
|
|
44027
|
+
s.update(start, end, await urlToBuiltUrl(url, id, config, this));
|
|
43976
44028
|
}
|
|
43977
44029
|
else if (checkPublicFile(url, config)) {
|
|
43978
|
-
s.
|
|
43979
|
-
contentOnly: true
|
|
43980
|
-
});
|
|
44030
|
+
s.update(start, end, toOutputPublicFilePath(url));
|
|
43981
44031
|
}
|
|
43982
44032
|
}
|
|
43983
44033
|
// ignore <link rel="stylesheet"> if its url can't be resolved
|
|
@@ -44139,7 +44189,7 @@ function buildHtmlPlugin(config) {
|
|
|
44139
44189
|
s || (s = new MagicString(result));
|
|
44140
44190
|
const { 0: full, 1: scopedName } = match;
|
|
44141
44191
|
const cssTransformedCode = htmlProxyResult.get(scopedName);
|
|
44142
|
-
s.
|
|
44192
|
+
s.update(match.index, match.index + full.length, cssTransformedCode);
|
|
44143
44193
|
}
|
|
44144
44194
|
if (s) {
|
|
44145
44195
|
result = s.toString();
|
|
@@ -44379,6 +44429,9 @@ function serializeAttrs(attrs) {
|
|
|
44379
44429
|
function incrementIndent(indent = '') {
|
|
44380
44430
|
return `${indent}${indent[0] === '\t' ? '\t' : ' '}`;
|
|
44381
44431
|
}
|
|
44432
|
+
function getAttrKey(attr) {
|
|
44433
|
+
return attr.prefix === undefined ? attr.name : `${attr.prefix}:${attr.name}`;
|
|
44434
|
+
}
|
|
44382
44435
|
|
|
44383
44436
|
const cssLangs = `\\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)($|\\?)`;
|
|
44384
44437
|
const cssLangRE = new RegExp(cssLangs);
|
|
@@ -44919,7 +44972,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
44919
44972
|
logger: config.logger
|
|
44920
44973
|
}));
|
|
44921
44974
|
if (isModule) {
|
|
44922
|
-
postcssPlugins.unshift((await import('./dep-
|
|
44975
|
+
postcssPlugins.unshift((await import('./dep-46ac452b.js').then(function (n) { return n.i; })).default({
|
|
44923
44976
|
...modulesOptions,
|
|
44924
44977
|
getJSON(cssFileName, _modules, outputFileName) {
|
|
44925
44978
|
modules = _modules;
|
|
@@ -46258,10 +46311,11 @@ function resolveLibFilename(libOptions, format, entryName, root, extension) {
|
|
|
46258
46311
|
}
|
|
46259
46312
|
function resolveBuildOutputs(outputs, libOptions, logger) {
|
|
46260
46313
|
if (libOptions) {
|
|
46261
|
-
const
|
|
46314
|
+
const hasMultipleEntries = typeof libOptions.entry !== 'string' &&
|
|
46315
|
+
Object.values(libOptions.entry).length > 1;
|
|
46316
|
+
const formats = libOptions.formats || (hasMultipleEntries ? ['es', 'cjs'] : ['es', 'umd']);
|
|
46262
46317
|
if (formats.includes('umd') || formats.includes('iife')) {
|
|
46263
|
-
if (
|
|
46264
|
-
Object.values(libOptions.entry).length > 1) {
|
|
46318
|
+
if (hasMultipleEntries) {
|
|
46265
46319
|
throw new Error(`Multiple entry points are not supported when output formats include "umd" or "iife".`);
|
|
46266
46320
|
}
|
|
46267
46321
|
if (!libOptions.name) {
|
|
@@ -46522,6 +46576,7 @@ var build$1 = {
|
|
|
46522
46576
|
resolveBuildPlugins: resolveBuildPlugins,
|
|
46523
46577
|
build: build,
|
|
46524
46578
|
resolveLibFilename: resolveLibFilename,
|
|
46579
|
+
resolveBuildOutputs: resolveBuildOutputs,
|
|
46525
46580
|
onRollupWarning: onRollupWarning,
|
|
46526
46581
|
toOutputFilePathInJS: toOutputFilePathInJS,
|
|
46527
46582
|
createToImportMetaURLBasedRelativeRuntime: createToImportMetaURLBasedRelativeRuntime,
|
|
@@ -53346,7 +53401,7 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
53346
53401
|
}
|
|
53347
53402
|
else {
|
|
53348
53403
|
// anonymous default exports
|
|
53349
|
-
s.
|
|
53404
|
+
s.update(node.start, node.start + 14 /* 'export default'.length */, `${ssrModuleExportsKey}.default =`);
|
|
53350
53405
|
}
|
|
53351
53406
|
}
|
|
53352
53407
|
// export * from './foo'
|
|
@@ -53389,16 +53444,14 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
53389
53444
|
}
|
|
53390
53445
|
}
|
|
53391
53446
|
else {
|
|
53392
|
-
s.
|
|
53447
|
+
s.update(id.start, id.end, binding);
|
|
53393
53448
|
}
|
|
53394
53449
|
},
|
|
53395
53450
|
onImportMeta(node) {
|
|
53396
|
-
s.
|
|
53451
|
+
s.update(node.start, node.end, ssrImportMetaKey);
|
|
53397
53452
|
},
|
|
53398
53453
|
onDynamicImport(node) {
|
|
53399
|
-
s.
|
|
53400
|
-
contentOnly: true
|
|
53401
|
-
});
|
|
53454
|
+
s.update(node.start, node.start + 6, ssrDynamicImportKey);
|
|
53402
53455
|
if (node.type === 'ImportExpression' && node.source.type === 'Literal') {
|
|
53403
53456
|
dynamicDeps.add(node.source.value);
|
|
53404
53457
|
}
|
|
@@ -53437,6 +53490,7 @@ const isNodeInPattern = (node) => isNodeInPatternWeakSet.has(node);
|
|
|
53437
53490
|
*/
|
|
53438
53491
|
function walk(root, { onIdentifier, onImportMeta, onDynamicImport }) {
|
|
53439
53492
|
const parentStack = [];
|
|
53493
|
+
const varKindStack = [];
|
|
53440
53494
|
const scopeMap = new WeakMap();
|
|
53441
53495
|
const identifiers = [];
|
|
53442
53496
|
const setScope = (node, name) => {
|
|
@@ -53495,6 +53549,10 @@ function walk(root, { onIdentifier, onImportMeta, onDynamicImport }) {
|
|
|
53495
53549
|
!(parent.type === 'IfStatement' && node === parent.alternate)) {
|
|
53496
53550
|
parentStack.unshift(parent);
|
|
53497
53551
|
}
|
|
53552
|
+
// track variable declaration kind stack used by VariableDeclarator
|
|
53553
|
+
if (node.type === 'VariableDeclaration') {
|
|
53554
|
+
varKindStack.unshift(node.kind);
|
|
53555
|
+
}
|
|
53498
53556
|
if (node.type === 'MetaProperty' && node.meta.name === 'import') {
|
|
53499
53557
|
onImportMeta(node);
|
|
53500
53558
|
}
|
|
@@ -53553,7 +53611,7 @@ function walk(root, { onIdentifier, onImportMeta, onDynamicImport }) {
|
|
|
53553
53611
|
setIsNodeInPattern(node);
|
|
53554
53612
|
}
|
|
53555
53613
|
else if (node.type === 'VariableDeclarator') {
|
|
53556
|
-
const parentFunction = findParentScope(parentStack);
|
|
53614
|
+
const parentFunction = findParentScope(parentStack, varKindStack[0] === 'var');
|
|
53557
53615
|
if (parentFunction) {
|
|
53558
53616
|
handlePattern(node.id, parentFunction);
|
|
53559
53617
|
}
|
|
@@ -53565,6 +53623,9 @@ function walk(root, { onIdentifier, onImportMeta, onDynamicImport }) {
|
|
|
53565
53623
|
!(parent.type === 'IfStatement' && node === parent.alternate)) {
|
|
53566
53624
|
parentStack.shift();
|
|
53567
53625
|
}
|
|
53626
|
+
if (node.type === 'VariableDeclaration') {
|
|
53627
|
+
varKindStack.shift();
|
|
53628
|
+
}
|
|
53568
53629
|
}
|
|
53569
53630
|
});
|
|
53570
53631
|
// emit the identifier events in BFS so the hoisted declarations
|
|
@@ -53631,8 +53692,9 @@ function isFunction(node) {
|
|
|
53631
53692
|
return functionNodeTypeRE.test(node.type);
|
|
53632
53693
|
}
|
|
53633
53694
|
const scopeNodeTypeRE = /(?:Function|Class)(?:Expression|Declaration)$|Method$|^IfStatement$/;
|
|
53634
|
-
function findParentScope(parentStack) {
|
|
53635
|
-
|
|
53695
|
+
function findParentScope(parentStack, isVar = false) {
|
|
53696
|
+
const regex = isVar ? functionNodeTypeRE : scopeNodeTypeRE;
|
|
53697
|
+
return parentStack.find((i) => regex.test(i.type));
|
|
53636
53698
|
}
|
|
53637
53699
|
function isInDestructuringAssignment(parent, parentStack) {
|
|
53638
53700
|
if (parent &&
|
|
@@ -60963,7 +61025,7 @@ const processNodeUrl = (attr, sourceCodeLocation, s, config, htmlPath, originalU
|
|
|
60963
61025
|
// path will add `/a/` prefix, it will caused 404.
|
|
60964
61026
|
// rewrite before `./index.js` -> `localhost:5173/a/index.js`.
|
|
60965
61027
|
// rewrite after `../index.js` -> `localhost:5173/index.js`.
|
|
60966
|
-
const processedUrl = attr.name === 'srcset'
|
|
61028
|
+
const processedUrl = attr.name === 'srcset' && attr.prefix === undefined
|
|
60967
61029
|
? processSrcSetSync(url, ({ url }) => replacer(url))
|
|
60968
61030
|
: replacer(url);
|
|
60969
61031
|
overwriteAttrValue(s, sourceCodeLocation, processedUrl);
|
|
@@ -61014,7 +61076,7 @@ const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl
|
|
|
61014
61076
|
if (module) {
|
|
61015
61077
|
server?.moduleGraph.invalidateModule(module);
|
|
61016
61078
|
}
|
|
61017
|
-
s.
|
|
61079
|
+
s.update(node.sourceCodeLocation.startOffset, node.sourceCodeLocation.endOffset, `<script type="module" src="${modulePath}"></script>`);
|
|
61018
61080
|
};
|
|
61019
61081
|
await traverseHtml(html, htmlPath, (node) => {
|
|
61020
61082
|
if (!nodeIsElement(node)) {
|
|
@@ -61042,8 +61104,9 @@ const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl
|
|
|
61042
61104
|
const assetAttrs = assetAttrsConfig[node.nodeName];
|
|
61043
61105
|
if (assetAttrs) {
|
|
61044
61106
|
for (const p of node.attrs) {
|
|
61045
|
-
|
|
61046
|
-
|
|
61107
|
+
const attrKey = getAttrKey(p);
|
|
61108
|
+
if (p.value && assetAttrs.includes(attrKey)) {
|
|
61109
|
+
processNodeUrl(p, node.sourceCodeLocation.attrs[attrKey], s, config, htmlPath, originalUrl);
|
|
61047
61110
|
}
|
|
61048
61111
|
}
|
|
61049
61112
|
}
|
|
@@ -63850,7 +63913,7 @@ async function bundleConfigFile(fileName, isESM) {
|
|
|
63850
63913
|
isRequire: !isESM,
|
|
63851
63914
|
preferRelative: false,
|
|
63852
63915
|
tryIndex: true,
|
|
63853
|
-
mainFields:
|
|
63916
|
+
mainFields: [],
|
|
63854
63917
|
browserField: false,
|
|
63855
63918
|
conditions: [],
|
|
63856
63919
|
dedupe: [],
|
package/dist/node/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
import { y as picocolors, u as createLogger, e as resolveConfig } from './chunks/dep-
|
|
3
|
+
import { y as picocolors, u as createLogger, e as resolveConfig } from './chunks/dep-34b5a6bf.js';
|
|
4
4
|
import { VERSION } from './constants.js';
|
|
5
5
|
import 'node:fs';
|
|
6
6
|
import 'node:path';
|
|
@@ -695,7 +695,7 @@ cli
|
|
|
695
695
|
.action(async (root, options) => {
|
|
696
696
|
// output structure is preserved even after bundling so require()
|
|
697
697
|
// is ok here
|
|
698
|
-
const { createServer } = await import('./chunks/dep-
|
|
698
|
+
const { createServer } = await import('./chunks/dep-34b5a6bf.js').then(function (n) { return n.C; });
|
|
699
699
|
try {
|
|
700
700
|
const server = await createServer({
|
|
701
701
|
root,
|
|
@@ -742,7 +742,7 @@ cli
|
|
|
742
742
|
.option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
|
|
743
743
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
744
744
|
.action(async (root, options) => {
|
|
745
|
-
const { build } = await import('./chunks/dep-
|
|
745
|
+
const { build } = await import('./chunks/dep-34b5a6bf.js').then(function (n) { return n.B; });
|
|
746
746
|
const buildOptions = cleanOptions(options);
|
|
747
747
|
try {
|
|
748
748
|
await build({
|
|
@@ -766,7 +766,7 @@ cli
|
|
|
766
766
|
.command('optimize [root]', 'pre-bundle dependencies')
|
|
767
767
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
768
768
|
.action(async (root, options) => {
|
|
769
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
769
|
+
const { optimizeDeps } = await import('./chunks/dep-34b5a6bf.js').then(function (n) { return n.A; });
|
|
770
770
|
try {
|
|
771
771
|
const config = await resolveConfig({
|
|
772
772
|
root,
|
|
@@ -789,7 +789,7 @@ cli
|
|
|
789
789
|
.option('--https', `[boolean] use TLS + HTTP/2`)
|
|
790
790
|
.option('--open [path]', `[boolean | string] open browser on startup`)
|
|
791
791
|
.action(async (root, options) => {
|
|
792
|
-
const { preview } = await import('./chunks/dep-
|
|
792
|
+
const { preview } = await import('./chunks/dep-34b5a6bf.js').then(function (n) { return n.D; });
|
|
793
793
|
try {
|
|
794
794
|
const server = await preview({
|
|
795
795
|
root,
|
package/dist/node/constants.js
CHANGED
package/dist/node/index.d.ts
CHANGED
|
@@ -1252,6 +1252,8 @@ export declare interface ManifestChunk {
|
|
|
1252
1252
|
dynamicImports?: string[];
|
|
1253
1253
|
}
|
|
1254
1254
|
|
|
1255
|
+
export declare type MapToFunction<T> = T extends Function ? T : never
|
|
1256
|
+
|
|
1255
1257
|
export declare type Matcher = AnymatchPattern | AnymatchPattern[]
|
|
1256
1258
|
|
|
1257
1259
|
export declare function mergeAlias(a?: AliasOptions, b?: AliasOptions): AliasOptions | undefined;
|
|
@@ -1685,7 +1687,7 @@ export declare function resolvePackageData(id: string, basedir: string, preserve
|
|
|
1685
1687
|
|
|
1686
1688
|
export declare function resolvePackageEntry(id: string, { dir, data, setResolvedCache, getResolvedCache }: PackageData, targetWeb: boolean, options: InternalResolveOptions): string | undefined;
|
|
1687
1689
|
|
|
1688
|
-
export declare type ResolverFunction = PluginHooks['resolveId']
|
|
1690
|
+
export declare type ResolverFunction = MapToFunction<PluginHooks['resolveId']>
|
|
1689
1691
|
|
|
1690
1692
|
export declare interface ResolverObject {
|
|
1691
1693
|
buildStart?: PluginHooks['buildStart']
|
package/dist/node/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b as build, k as createFilter, u as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, h as getDepOptimizationConfig, i as isDepsOptimizerEnabled, l as loadConfigFromFile, w as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, g as resolveBaseUrl, e as resolveConfig, x as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, v as searchForWorkspaceRoot, q as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-
|
|
1
|
+
export { b as build, k as createFilter, u as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, h as getDepOptimizationConfig, i as isDepsOptimizerEnabled, l as loadConfigFromFile, w as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, g as resolveBaseUrl, e as resolveConfig, x as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, v as searchForWorkspaceRoot, q as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-34b5a6bf.js';
|
|
2
2
|
export { VERSION as version } from './constants.js';
|
|
3
3
|
export { version as esbuildVersion } from 'esbuild';
|
|
4
4
|
export { VERSION as rollupVersion } from 'rollup';
|
|
@@ -31,7 +31,7 @@ var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
|
|
|
31
31
|
var readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);
|
|
32
32
|
var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
|
|
33
33
|
|
|
34
|
-
var version = "3.2.0-beta.
|
|
34
|
+
var version = "3.2.0-beta.1";
|
|
35
35
|
|
|
36
36
|
const VERSION = version;
|
|
37
37
|
const VITE_PACKAGE_DIR = path$3.resolve(
|
|
@@ -155,6 +155,18 @@ for (let i = 0; i < chars.length; i++) {
|
|
|
155
155
|
charToInt[c] = i;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
// Matches the scheme of a URL, eg "http://"
|
|
159
|
+
var UrlType;
|
|
160
|
+
(function (UrlType) {
|
|
161
|
+
UrlType[UrlType["Empty"] = 1] = "Empty";
|
|
162
|
+
UrlType[UrlType["Hash"] = 2] = "Hash";
|
|
163
|
+
UrlType[UrlType["Query"] = 3] = "Query";
|
|
164
|
+
UrlType[UrlType["RelativePath"] = 4] = "RelativePath";
|
|
165
|
+
UrlType[UrlType["AbsolutePath"] = 5] = "AbsolutePath";
|
|
166
|
+
UrlType[UrlType["SchemeRelative"] = 6] = "SchemeRelative";
|
|
167
|
+
UrlType[UrlType["Absolute"] = 7] = "Absolute";
|
|
168
|
+
})(UrlType || (UrlType = {}));
|
|
169
|
+
|
|
158
170
|
function getDefaultExportFromCjs (x) {
|
|
159
171
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
160
172
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite",
|
|
3
|
-
"version": "3.2.0-beta.
|
|
3
|
+
"version": "3.2.0-beta.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Evan You",
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
"@ampproject/remapping": "^2.2.0",
|
|
72
72
|
"@babel/parser": "^7.19.3",
|
|
73
73
|
"@babel/types": "^7.19.3",
|
|
74
|
-
"@jridgewell/trace-mapping": "^0.3.
|
|
75
|
-
"@rollup/plugin-alias": "^
|
|
74
|
+
"@jridgewell/trace-mapping": "^0.3.16",
|
|
75
|
+
"@rollup/plugin-alias": "^4.0.0",
|
|
76
76
|
"@rollup/plugin-commonjs": "^22.0.2",
|
|
77
77
|
"@rollup/plugin-dynamic-import-vars": "^1.4.4",
|
|
78
78
|
"@rollup/plugin-json": "^4.1.0",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"http-proxy": "^1.18.1",
|
|
98
98
|
"json5": "^2.2.1",
|
|
99
99
|
"launch-editor-middleware": "^2.6.0",
|
|
100
|
-
"magic-string": "^0.26.
|
|
100
|
+
"magic-string": "^0.26.7",
|
|
101
101
|
"micromatch": "^4.0.5",
|
|
102
102
|
"mlly": "^0.5.16",
|
|
103
103
|
"mrmime": "^1.0.1",
|