vite 2.5.5 → 2.5.9
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.
Potentially problematic release.
This version of vite might be problematic. Click here for more details.
- package/CHANGELOG.md +46 -0
- package/dist/node/chunks/{dep-07ec9cdd.js → dep-05fcddd5.js} +258 -222
- package/dist/node/chunks/dep-05fcddd5.js.map +1 -0
- package/dist/node/chunks/{dep-a247570d.js → dep-499befab.js} +2 -2
- package/dist/node/chunks/{dep-a247570d.js.map → dep-499befab.js.map} +1 -1
- package/dist/node/chunks/{dep-8a1f5a00.js → dep-58243dfd.js} +2 -2
- package/dist/node/chunks/{dep-8a1f5a00.js.map → dep-58243dfd.js.map} +1 -1
- package/dist/node/chunks/{dep-ebe44577.js → dep-fcb82982.js} +2 -2
- package/dist/node/chunks/{dep-ebe44577.js.map → dep-fcb82982.js.map} +1 -1
- package/dist/node/cli.js +4 -4
- package/dist/node/index.d.ts +13 -8
- package/dist/node/index.js +2 -1
- package/dist/node/index.js.map +1 -1
- package/package.json +1 -1
- package/src/node/__tests__/build.spec.ts +39 -4
- package/src/node/__tests__/packages/name/package.json +3 -0
- package/src/node/__tests__/packages/noname/package.json +1 -0
- package/src/node/build.ts +15 -10
- package/src/node/config.ts +9 -1
- package/src/node/index.ts +2 -0
- package/src/node/optimizer/esbuildDepPlugin.ts +3 -2
- package/src/node/plugin.ts +2 -2
- package/src/node/plugins/esbuild.ts +51 -33
- package/src/node/plugins/importAnalysis.ts +6 -4
- package/src/node/plugins/importAnalysisBuild.ts +1 -1
- package/src/node/server/index.ts +5 -21
- package/src/node/server/middlewares/spaFallback.ts +32 -0
- package/src/node/server/pluginContainer.ts +0 -13
- package/src/node/server/transformRequest.ts +1 -0
- package/src/node/ssr/__tests__/ssrTransform.spec.ts +22 -22
- package/src/node/ssr/ssrExternal.ts +10 -4
- package/src/node/ssr/ssrTransform.ts +6 -1
- package/.DS_Store +0 -0
- package/dist/node/chunks/dep-07ec9cdd.js.map +0 -1
- package/src/node/.DS_Store +0 -0
- package/yarn-error.log +0 -8027
|
@@ -3145,7 +3145,7 @@ if (typeof process === 'undefined' || process.type === 'renderer' || process.bro
|
|
|
3145
3145
|
src$3.exports = node$2.exports;
|
|
3146
3146
|
}
|
|
3147
3147
|
|
|
3148
|
-
var debug$
|
|
3148
|
+
var debug$e = src$3.exports;
|
|
3149
3149
|
|
|
3150
3150
|
const DEFAULT_MAIN_FIELDS = [
|
|
3151
3151
|
'module',
|
|
@@ -4103,7 +4103,7 @@ function nestedResolveFrom(id, basedir) {
|
|
|
4103
4103
|
const filter$1 = process.env.VITE_DEBUG_FILTER;
|
|
4104
4104
|
const DEBUG$1 = process.env.DEBUG;
|
|
4105
4105
|
function createDebugger(namespace, options = {}) {
|
|
4106
|
-
const log = debug$
|
|
4106
|
+
const log = debug$e(namespace);
|
|
4107
4107
|
const { onlyWhenFocused } = options;
|
|
4108
4108
|
const focus = typeof onlyWhenFocused === 'string' ? onlyWhenFocused : namespace;
|
|
4109
4109
|
return (msg, ...args) => {
|
|
@@ -34157,7 +34157,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
34157
34157
|
replacer: urlReplacer
|
|
34158
34158
|
}));
|
|
34159
34159
|
if (isModule) {
|
|
34160
|
-
postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-
|
|
34160
|
+
postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-58243dfd.js'); }).then(function (n) { return n.index; })).default({
|
|
34161
34161
|
...modulesOptions,
|
|
34162
34162
|
getJSON(cssFileName, _modules, outputFileName) {
|
|
34163
34163
|
modules = _modules;
|
|
@@ -34949,7 +34949,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
34949
34949
|
const cssFiles = chunkToEmittedCssFileMap.get(chunk);
|
|
34950
34950
|
if (cssFiles && cssFiles.size > 0) {
|
|
34951
34951
|
cssFiles.forEach((file) => {
|
|
34952
|
-
deps.add(
|
|
34952
|
+
deps.add(file);
|
|
34953
34953
|
});
|
|
34954
34954
|
hasRemovedPureCssChunk = true;
|
|
34955
34955
|
}
|
|
@@ -35101,7 +35101,7 @@ const assetAttrsConfig = {
|
|
|
35101
35101
|
};
|
|
35102
35102
|
async function traverseHtml(html, filePath, visitor) {
|
|
35103
35103
|
// lazy load compiler
|
|
35104
|
-
const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-
|
|
35104
|
+
const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-499befab.js'); }).then(function (n) { return n.compilerDom_cjs; });
|
|
35105
35105
|
// @vue/compiler-core doesn't like lowercase doctypes
|
|
35106
35106
|
html = html.replace(/<!doctype\s/i, '<!DOCTYPE ');
|
|
35107
35107
|
try {
|
|
@@ -35602,48 +35602,66 @@ var stripJsonComments = (jsonString, options = {}) => {
|
|
|
35602
35602
|
return result + (insideComment ? strip(jsonString.slice(offset)) : jsonString.slice(offset));
|
|
35603
35603
|
};
|
|
35604
35604
|
|
|
35605
|
-
const debug$
|
|
35605
|
+
const debug$d = createDebugger('vite:esbuild');
|
|
35606
35606
|
async function transformWithEsbuild(code, filename, options, inMap) {
|
|
35607
35607
|
var _a, _b, _c;
|
|
35608
|
-
|
|
35609
|
-
|
|
35610
|
-
|
|
35611
|
-
|
|
35612
|
-
|
|
35613
|
-
|
|
35614
|
-
|
|
35615
|
-
|
|
35616
|
-
|
|
35617
|
-
const meaningfulFields = [
|
|
35618
|
-
'jsxFactory',
|
|
35619
|
-
'jsxFragmentFactory',
|
|
35620
|
-
'useDefineForClassFields',
|
|
35621
|
-
'importsNotUsedAsValues'
|
|
35622
|
-
];
|
|
35623
|
-
const compilerOptionsForFile = {};
|
|
35624
|
-
if (loader === 'ts' || loader === 'tsx') {
|
|
35625
|
-
const loadedTsconfig = await loadTsconfigJsonForFile(filename);
|
|
35626
|
-
const loadedCompilerOptions = (_a = loadedTsconfig.compilerOptions) !== null && _a !== void 0 ? _a : {};
|
|
35627
|
-
for (const field of meaningfulFields) {
|
|
35628
|
-
if (field in loadedCompilerOptions) {
|
|
35629
|
-
// @ts-ignore TypeScript can't tell they are of the same type
|
|
35630
|
-
compilerOptionsForFile[field] = loadedCompilerOptions[field];
|
|
35631
|
-
}
|
|
35608
|
+
let loader = options === null || options === void 0 ? void 0 : options.loader;
|
|
35609
|
+
if (!loader) {
|
|
35610
|
+
// if the id ends with a valid ext, use it (e.g. vue blocks)
|
|
35611
|
+
// otherwise, cleanup the query before checking the ext
|
|
35612
|
+
const ext = path__default
|
|
35613
|
+
.extname(/\.\w+$/.test(filename) ? filename : cleanUrl(filename))
|
|
35614
|
+
.slice(1);
|
|
35615
|
+
if (ext === 'cjs' || ext === 'mjs') {
|
|
35616
|
+
loader = 'js';
|
|
35632
35617
|
}
|
|
35633
|
-
|
|
35634
|
-
|
|
35635
|
-
|
|
35636
|
-
|
|
35637
|
-
|
|
35618
|
+
else {
|
|
35619
|
+
loader = ext;
|
|
35620
|
+
}
|
|
35621
|
+
}
|
|
35622
|
+
let tsconfigRaw = options === null || options === void 0 ? void 0 : options.tsconfigRaw;
|
|
35623
|
+
// if options provide tsconfigraw in string, it takes highest precedence
|
|
35624
|
+
if (typeof tsconfigRaw !== 'string') {
|
|
35625
|
+
// these fields would affect the compilation result
|
|
35626
|
+
// https://esbuild.github.io/content-types/#tsconfig-json
|
|
35627
|
+
const meaningfulFields = [
|
|
35628
|
+
'jsxFactory',
|
|
35629
|
+
'jsxFragmentFactory',
|
|
35630
|
+
'useDefineForClassFields',
|
|
35631
|
+
'importsNotUsedAsValues'
|
|
35632
|
+
];
|
|
35633
|
+
const compilerOptionsForFile = {};
|
|
35634
|
+
if (loader === 'ts' || loader === 'tsx') {
|
|
35635
|
+
const loadedTsconfig = await loadTsconfigJsonForFile(filename);
|
|
35636
|
+
const loadedCompilerOptions = (_a = loadedTsconfig.compilerOptions) !== null && _a !== void 0 ? _a : {};
|
|
35637
|
+
for (const field of meaningfulFields) {
|
|
35638
|
+
if (field in loadedCompilerOptions) {
|
|
35639
|
+
// @ts-ignore TypeScript can't tell they are of the same type
|
|
35640
|
+
compilerOptionsForFile[field] = loadedCompilerOptions[field];
|
|
35641
|
+
}
|
|
35642
|
+
}
|
|
35643
|
+
// align with TypeScript 4.3
|
|
35644
|
+
// https://github.com/microsoft/TypeScript/pull/42663
|
|
35645
|
+
if (((_b = loadedCompilerOptions.target) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'esnext') {
|
|
35646
|
+
compilerOptionsForFile.useDefineForClassFields =
|
|
35647
|
+
(_c = loadedCompilerOptions.useDefineForClassFields) !== null && _c !== void 0 ? _c : true;
|
|
35648
|
+
}
|
|
35638
35649
|
}
|
|
35650
|
+
tsconfigRaw = {
|
|
35651
|
+
...tsconfigRaw,
|
|
35652
|
+
compilerOptions: {
|
|
35653
|
+
...compilerOptionsForFile,
|
|
35654
|
+
...tsconfigRaw === null || tsconfigRaw === void 0 ? void 0 : tsconfigRaw.compilerOptions
|
|
35655
|
+
}
|
|
35656
|
+
};
|
|
35639
35657
|
}
|
|
35640
35658
|
const resolvedOptions = {
|
|
35641
|
-
loader: loader,
|
|
35642
35659
|
sourcemap: true,
|
|
35643
35660
|
// ensure source file name contains full query
|
|
35644
35661
|
sourcefile: filename,
|
|
35645
|
-
|
|
35646
|
-
|
|
35662
|
+
...options,
|
|
35663
|
+
loader,
|
|
35664
|
+
tsconfigRaw
|
|
35647
35665
|
};
|
|
35648
35666
|
delete resolvedOptions.include;
|
|
35649
35667
|
delete resolvedOptions.exclude;
|
|
@@ -35669,7 +35687,7 @@ async function transformWithEsbuild(code, filename, options, inMap) {
|
|
|
35669
35687
|
}
|
|
35670
35688
|
}
|
|
35671
35689
|
catch (e) {
|
|
35672
|
-
debug$
|
|
35690
|
+
debug$d(`esbuild error with options used: `, resolvedOptions);
|
|
35673
35691
|
// patch error information
|
|
35674
35692
|
if (e.errors) {
|
|
35675
35693
|
e.frame = '';
|
|
@@ -43306,7 +43324,7 @@ function resolve$1(pkg, entry='.', options={}) {
|
|
|
43306
43324
|
// https://github.com/defunctzombie/package-browser-field-spec#ignore-a-module
|
|
43307
43325
|
const browserExternalId = '__vite-browser-external';
|
|
43308
43326
|
const isDebug$5 = process.env.DEBUG;
|
|
43309
|
-
const debug$
|
|
43327
|
+
const debug$c = createDebugger('vite:resolve-details', {
|
|
43310
43328
|
onlyWhenFocused: true
|
|
43311
43329
|
});
|
|
43312
43330
|
function resolvePlugin(baseOptions) {
|
|
@@ -43342,7 +43360,7 @@ function resolvePlugin(baseOptions) {
|
|
|
43342
43360
|
if (asSrc && id.startsWith(FS_PREFIX)) {
|
|
43343
43361
|
const fsPath = fsPathFromId(id);
|
|
43344
43362
|
res = tryFsResolve(fsPath, options);
|
|
43345
|
-
isDebug$5 && debug$
|
|
43363
|
+
isDebug$5 && debug$c(`[@fs] ${source.cyan(id)} -> ${source.dim(res)}`);
|
|
43346
43364
|
// always return here even if res doesn't exist since /@fs/ is explicit
|
|
43347
43365
|
// if the file doesn't exist it should be a 404
|
|
43348
43366
|
return res || fsPath;
|
|
@@ -43352,7 +43370,7 @@ function resolvePlugin(baseOptions) {
|
|
|
43352
43370
|
if (asSrc && id.startsWith('/')) {
|
|
43353
43371
|
const fsPath = path__default.resolve(root, id.slice(1));
|
|
43354
43372
|
if ((res = tryFsResolve(fsPath, options))) {
|
|
43355
|
-
isDebug$5 && debug$
|
|
43373
|
+
isDebug$5 && debug$c(`[url] ${source.cyan(id)} -> ${source.dim(res)}`);
|
|
43356
43374
|
return res;
|
|
43357
43375
|
}
|
|
43358
43376
|
}
|
|
@@ -43377,7 +43395,7 @@ function resolvePlugin(baseOptions) {
|
|
|
43377
43395
|
return res;
|
|
43378
43396
|
}
|
|
43379
43397
|
if ((res = tryFsResolve(fsPath, options))) {
|
|
43380
|
-
isDebug$5 && debug$
|
|
43398
|
+
isDebug$5 && debug$c(`[relative] ${source.cyan(id)} -> ${source.dim(res)}`);
|
|
43381
43399
|
const pkg = importer != null && idToPkgMap.get(importer);
|
|
43382
43400
|
if (pkg) {
|
|
43383
43401
|
idToPkgMap.set(res, pkg);
|
|
@@ -43391,7 +43409,7 @@ function resolvePlugin(baseOptions) {
|
|
|
43391
43409
|
}
|
|
43392
43410
|
// absolute fs paths
|
|
43393
43411
|
if (path__default.isAbsolute(id) && (res = tryFsResolve(id, options))) {
|
|
43394
|
-
isDebug$5 && debug$
|
|
43412
|
+
isDebug$5 && debug$c(`[fs] ${source.cyan(id)} -> ${source.dim(res)}`);
|
|
43395
43413
|
return res;
|
|
43396
43414
|
}
|
|
43397
43415
|
// external
|
|
@@ -43440,7 +43458,7 @@ function resolvePlugin(baseOptions) {
|
|
|
43440
43458
|
}
|
|
43441
43459
|
else {
|
|
43442
43460
|
if (!asSrc) {
|
|
43443
|
-
debug$
|
|
43461
|
+
debug$c(`externalized node built-in "${id}" to empty module. ` +
|
|
43444
43462
|
`(imported by: ${source.white.dim(importer)})`);
|
|
43445
43463
|
}
|
|
43446
43464
|
return isProduction
|
|
@@ -43449,7 +43467,7 @@ function resolvePlugin(baseOptions) {
|
|
|
43449
43467
|
}
|
|
43450
43468
|
}
|
|
43451
43469
|
}
|
|
43452
|
-
isDebug$5 && debug$
|
|
43470
|
+
isDebug$5 && debug$c(`[fallthrough] ${source.dim(id)}`);
|
|
43453
43471
|
},
|
|
43454
43472
|
load(id) {
|
|
43455
43473
|
if (id.startsWith(browserExternalId)) {
|
|
@@ -43656,7 +43674,7 @@ function resolvePackageData(id, basedir) {
|
|
|
43656
43674
|
return loadPackageData(pkgPath, cacheKey);
|
|
43657
43675
|
}
|
|
43658
43676
|
catch (e) {
|
|
43659
|
-
isDebug$5 && debug$
|
|
43677
|
+
isDebug$5 && debug$c(`${source.red(`[failed loading package.json]`)} ${id}`);
|
|
43660
43678
|
}
|
|
43661
43679
|
}
|
|
43662
43680
|
function loadPackageData(pkgPath, cacheKey = pkgPath) {
|
|
@@ -43771,7 +43789,7 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
|
|
|
43771
43789
|
const resolvedEntryPoint = tryFsResolve(entryPoint, options);
|
|
43772
43790
|
if (resolvedEntryPoint) {
|
|
43773
43791
|
isDebug$5 &&
|
|
43774
|
-
debug$
|
|
43792
|
+
debug$c(`[package entry] ${source.cyan(id)} -> ${source.dim(resolvedEntryPoint)}`);
|
|
43775
43793
|
setResolvedCache('.', resolvedEntryPoint, targetWeb);
|
|
43776
43794
|
return resolvedEntryPoint;
|
|
43777
43795
|
}
|
|
@@ -43838,7 +43856,7 @@ function resolveDeepImport(id, { webResolvedImports, setResolvedCache, getResolv
|
|
|
43838
43856
|
targetWeb);
|
|
43839
43857
|
if (resolved) {
|
|
43840
43858
|
isDebug$5 &&
|
|
43841
|
-
debug$
|
|
43859
|
+
debug$c(`[node/deep-import] ${source.cyan(id)} -> ${source.dim(resolved)}`);
|
|
43842
43860
|
setResolvedCache(id, resolved, targetWeb);
|
|
43843
43861
|
return resolved;
|
|
43844
43862
|
}
|
|
@@ -43854,7 +43872,7 @@ function tryResolveBrowserMapping(id, importer, options, isFilePath) {
|
|
|
43854
43872
|
const fsPath = path__default.join(pkg.dir, browserMappedPath);
|
|
43855
43873
|
if ((res = tryFsResolve(fsPath, options))) {
|
|
43856
43874
|
isDebug$5 &&
|
|
43857
|
-
debug$
|
|
43875
|
+
debug$c(`[browser mapped] ${source.cyan(id)} -> ${source.dim(res)}`);
|
|
43858
43876
|
idToPkgMap.set(res, pkg);
|
|
43859
43877
|
return {
|
|
43860
43878
|
id: res,
|
|
@@ -43890,6 +43908,7 @@ function equalWithoutSuffix(path, key, suffix) {
|
|
|
43890
43908
|
return key.endsWith(suffix) && key.slice(0, -suffix.length) === path;
|
|
43891
43909
|
}
|
|
43892
43910
|
|
|
43911
|
+
const debug$b = createDebugger('vite:ssr-external');
|
|
43893
43912
|
/**
|
|
43894
43913
|
* Heuristics for determining whether a dependency should be externalized for
|
|
43895
43914
|
* server-side rendering.
|
|
@@ -43933,7 +43952,7 @@ function resolveSSRExternal(config, knownImports, ssrExternals = new Set(), seen
|
|
|
43933
43952
|
}
|
|
43934
43953
|
catch (e) {
|
|
43935
43954
|
// resolve failed, assume include
|
|
43936
|
-
|
|
43955
|
+
debug$b(`Failed to resolve entries for package "${id}"\n`, e);
|
|
43937
43956
|
continue;
|
|
43938
43957
|
}
|
|
43939
43958
|
if (!entry) {
|
|
@@ -50372,17 +50391,6 @@ async function createPluginContainer({ plugins, logger, root, build: { rollupOpt
|
|
|
50372
50391
|
map: ctx._getCombinedSourcemap()
|
|
50373
50392
|
};
|
|
50374
50393
|
},
|
|
50375
|
-
watchChange(id, event = 'update') {
|
|
50376
|
-
const ctx = new Context();
|
|
50377
|
-
if (watchFiles.has(id)) {
|
|
50378
|
-
for (const plugin of plugins) {
|
|
50379
|
-
if (!plugin.watchChange)
|
|
50380
|
-
continue;
|
|
50381
|
-
ctx._activePlugin = plugin;
|
|
50382
|
-
plugin.watchChange.call(ctx, id, { event });
|
|
50383
|
-
}
|
|
50384
|
-
}
|
|
50385
|
-
},
|
|
50386
50394
|
async close() {
|
|
50387
50395
|
if (closed)
|
|
50388
50396
|
return;
|
|
@@ -50995,7 +51003,6 @@ async function doBuild(inlineConfig = {}) {
|
|
|
50995
51003
|
config.logger.error(msg, { error: e });
|
|
50996
51004
|
};
|
|
50997
51005
|
try {
|
|
50998
|
-
const pkgName = libOptions && getPkgName(config.root);
|
|
50999
51006
|
const buildOutputOptions = (output = {}) => {
|
|
51000
51007
|
return {
|
|
51001
51008
|
dir: outDir,
|
|
@@ -51006,7 +51013,7 @@ async function doBuild(inlineConfig = {}) {
|
|
|
51006
51013
|
entryFileNames: ssr
|
|
51007
51014
|
? `[name].js`
|
|
51008
51015
|
: libOptions
|
|
51009
|
-
? resolveLibFilename(libOptions, output.format || 'es',
|
|
51016
|
+
? resolveLibFilename(libOptions, output.format || 'es', config.root)
|
|
51010
51017
|
: path__default.posix.join(options.assetsDir, `[name].[hash].js`),
|
|
51011
51018
|
chunkFileNames: libOptions
|
|
51012
51019
|
? `[name].js`
|
|
@@ -51121,9 +51128,7 @@ function prepareOutDir(outDir, emptyOutDir, config) {
|
|
|
51121
51128
|
}
|
|
51122
51129
|
function getPkgName(root) {
|
|
51123
51130
|
const { name } = JSON.parse(lookupFile(root, ['package.json']) || `{}`);
|
|
51124
|
-
|
|
51125
|
-
throw new Error('no name found in package.json');
|
|
51126
|
-
return name.startsWith('@') ? name.split('/')[1] : name;
|
|
51131
|
+
return (name === null || name === void 0 ? void 0 : name.startsWith('@')) ? name.split('/')[1] : name;
|
|
51127
51132
|
}
|
|
51128
51133
|
function createMoveToVendorChunkFn(config) {
|
|
51129
51134
|
const cache = new Map();
|
|
@@ -51157,10 +51162,14 @@ function staticImportedByEntry(id, getModuleInfo, cache, importStack = []) {
|
|
|
51157
51162
|
cache.set(id, someImporterIs);
|
|
51158
51163
|
return someImporterIs;
|
|
51159
51164
|
}
|
|
51160
|
-
function resolveLibFilename(libOptions, format,
|
|
51161
|
-
|
|
51162
|
-
|
|
51163
|
-
|
|
51165
|
+
function resolveLibFilename(libOptions, format, root) {
|
|
51166
|
+
if (typeof libOptions.fileName === 'function') {
|
|
51167
|
+
return libOptions.fileName(format);
|
|
51168
|
+
}
|
|
51169
|
+
const name = libOptions.fileName || getPkgName(root);
|
|
51170
|
+
if (!name)
|
|
51171
|
+
throw new Error('Name in package.json is required if option "build.lib.fileName" is not provided.');
|
|
51172
|
+
return `${name}.${format}.js`;
|
|
51164
51173
|
}
|
|
51165
51174
|
function resolveBuildOutputs(outputs, libOptions, logger) {
|
|
51166
51175
|
if (libOptions) {
|
|
@@ -57646,7 +57655,7 @@ function readFileIfExists(value) {
|
|
|
57646
57655
|
* https://github.com/webpack/webpack-dev-server/blob/master/LICENSE
|
|
57647
57656
|
*/
|
|
57648
57657
|
async function createCertificate() {
|
|
57649
|
-
const { generate } = await Promise.resolve().then(function () { return require('./dep-
|
|
57658
|
+
const { generate } = await Promise.resolve().then(function () { return require('./dep-fcb82982.js'); }).then(function (n) { return n.index; });
|
|
57650
57659
|
const pems = generate(null, {
|
|
57651
57660
|
algorithm: 'sha256',
|
|
57652
57661
|
days: 30,
|
|
@@ -63895,6 +63904,157 @@ function proxyMiddleware(httpServer, config) {
|
|
|
63895
63904
|
};
|
|
63896
63905
|
}
|
|
63897
63906
|
|
|
63907
|
+
var lib = {exports: {}};
|
|
63908
|
+
|
|
63909
|
+
(function (module, exports) {
|
|
63910
|
+
|
|
63911
|
+
var url = require$$0__default$7;
|
|
63912
|
+
|
|
63913
|
+
module.exports = function historyApiFallback(options) {
|
|
63914
|
+
options = options || {};
|
|
63915
|
+
var logger = getLogger(options);
|
|
63916
|
+
|
|
63917
|
+
return function(req, res, next) {
|
|
63918
|
+
var headers = req.headers;
|
|
63919
|
+
if (req.method !== 'GET') {
|
|
63920
|
+
logger(
|
|
63921
|
+
'Not rewriting',
|
|
63922
|
+
req.method,
|
|
63923
|
+
req.url,
|
|
63924
|
+
'because the method is not GET.'
|
|
63925
|
+
);
|
|
63926
|
+
return next();
|
|
63927
|
+
} else if (!headers || typeof headers.accept !== 'string') {
|
|
63928
|
+
logger(
|
|
63929
|
+
'Not rewriting',
|
|
63930
|
+
req.method,
|
|
63931
|
+
req.url,
|
|
63932
|
+
'because the client did not send an HTTP accept header.'
|
|
63933
|
+
);
|
|
63934
|
+
return next();
|
|
63935
|
+
} else if (headers.accept.indexOf('application/json') === 0) {
|
|
63936
|
+
logger(
|
|
63937
|
+
'Not rewriting',
|
|
63938
|
+
req.method,
|
|
63939
|
+
req.url,
|
|
63940
|
+
'because the client prefers JSON.'
|
|
63941
|
+
);
|
|
63942
|
+
return next();
|
|
63943
|
+
} else if (!acceptsHtml(headers.accept, options)) {
|
|
63944
|
+
logger(
|
|
63945
|
+
'Not rewriting',
|
|
63946
|
+
req.method,
|
|
63947
|
+
req.url,
|
|
63948
|
+
'because the client does not accept HTML.'
|
|
63949
|
+
);
|
|
63950
|
+
return next();
|
|
63951
|
+
}
|
|
63952
|
+
|
|
63953
|
+
var parsedUrl = url.parse(req.url);
|
|
63954
|
+
var rewriteTarget;
|
|
63955
|
+
options.rewrites = options.rewrites || [];
|
|
63956
|
+
for (var i = 0; i < options.rewrites.length; i++) {
|
|
63957
|
+
var rewrite = options.rewrites[i];
|
|
63958
|
+
var match = parsedUrl.pathname.match(rewrite.from);
|
|
63959
|
+
if (match !== null) {
|
|
63960
|
+
rewriteTarget = evaluateRewriteRule(parsedUrl, match, rewrite.to, req);
|
|
63961
|
+
|
|
63962
|
+
if(rewriteTarget.charAt(0) !== '/') {
|
|
63963
|
+
logger(
|
|
63964
|
+
'We recommend using an absolute path for the rewrite target.',
|
|
63965
|
+
'Received a non-absolute rewrite target',
|
|
63966
|
+
rewriteTarget,
|
|
63967
|
+
'for URL',
|
|
63968
|
+
req.url
|
|
63969
|
+
);
|
|
63970
|
+
}
|
|
63971
|
+
|
|
63972
|
+
logger('Rewriting', req.method, req.url, 'to', rewriteTarget);
|
|
63973
|
+
req.url = rewriteTarget;
|
|
63974
|
+
return next();
|
|
63975
|
+
}
|
|
63976
|
+
}
|
|
63977
|
+
|
|
63978
|
+
var pathname = parsedUrl.pathname;
|
|
63979
|
+
if (pathname.lastIndexOf('.') > pathname.lastIndexOf('/') &&
|
|
63980
|
+
options.disableDotRule !== true) {
|
|
63981
|
+
logger(
|
|
63982
|
+
'Not rewriting',
|
|
63983
|
+
req.method,
|
|
63984
|
+
req.url,
|
|
63985
|
+
'because the path includes a dot (.) character.'
|
|
63986
|
+
);
|
|
63987
|
+
return next();
|
|
63988
|
+
}
|
|
63989
|
+
|
|
63990
|
+
rewriteTarget = options.index || '/index.html';
|
|
63991
|
+
logger('Rewriting', req.method, req.url, 'to', rewriteTarget);
|
|
63992
|
+
req.url = rewriteTarget;
|
|
63993
|
+
next();
|
|
63994
|
+
};
|
|
63995
|
+
};
|
|
63996
|
+
|
|
63997
|
+
function evaluateRewriteRule(parsedUrl, match, rule, req) {
|
|
63998
|
+
if (typeof rule === 'string') {
|
|
63999
|
+
return rule;
|
|
64000
|
+
} else if (typeof rule !== 'function') {
|
|
64001
|
+
throw new Error('Rewrite rule can only be of type string or function.');
|
|
64002
|
+
}
|
|
64003
|
+
|
|
64004
|
+
return rule({
|
|
64005
|
+
parsedUrl: parsedUrl,
|
|
64006
|
+
match: match,
|
|
64007
|
+
request: req
|
|
64008
|
+
});
|
|
64009
|
+
}
|
|
64010
|
+
|
|
64011
|
+
function acceptsHtml(header, options) {
|
|
64012
|
+
options.htmlAcceptHeaders = options.htmlAcceptHeaders || ['text/html', '*/*'];
|
|
64013
|
+
for (var i = 0; i < options.htmlAcceptHeaders.length; i++) {
|
|
64014
|
+
if (header.indexOf(options.htmlAcceptHeaders[i]) !== -1) {
|
|
64015
|
+
return true;
|
|
64016
|
+
}
|
|
64017
|
+
}
|
|
64018
|
+
return false;
|
|
64019
|
+
}
|
|
64020
|
+
|
|
64021
|
+
function getLogger(options) {
|
|
64022
|
+
if (options && options.logger) {
|
|
64023
|
+
return options.logger;
|
|
64024
|
+
} else if (options && options.verbose) {
|
|
64025
|
+
return console.log.bind(console);
|
|
64026
|
+
}
|
|
64027
|
+
return function(){};
|
|
64028
|
+
}
|
|
64029
|
+
}(lib));
|
|
64030
|
+
|
|
64031
|
+
var history = lib.exports;
|
|
64032
|
+
|
|
64033
|
+
function spaFallbackMiddleware(root) {
|
|
64034
|
+
const historySpaFallbackMiddleware = history({
|
|
64035
|
+
logger: createDebugger('vite:spa-fallback'),
|
|
64036
|
+
// support /dir/ without explicit index.html
|
|
64037
|
+
rewrites: [
|
|
64038
|
+
{
|
|
64039
|
+
from: /\/$/,
|
|
64040
|
+
to({ parsedUrl }) {
|
|
64041
|
+
const rewritten = parsedUrl.pathname + 'index.html';
|
|
64042
|
+
if (fs__default.existsSync(path__default.join(root, rewritten))) {
|
|
64043
|
+
return rewritten;
|
|
64044
|
+
}
|
|
64045
|
+
else {
|
|
64046
|
+
return `/index.html`;
|
|
64047
|
+
}
|
|
64048
|
+
}
|
|
64049
|
+
}
|
|
64050
|
+
]
|
|
64051
|
+
});
|
|
64052
|
+
// Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
|
|
64053
|
+
return function viteSpaFallbackMiddleware(req, res, next) {
|
|
64054
|
+
return historySpaFallbackMiddleware(req, res, next);
|
|
64055
|
+
};
|
|
64056
|
+
}
|
|
64057
|
+
|
|
63898
64058
|
/*!
|
|
63899
64059
|
* etag
|
|
63900
64060
|
* Copyright(c) 2014-2016 Douglas Christopher Wilson
|
|
@@ -64348,6 +64508,7 @@ async function ssrTransform(code, inMap, url) {
|
|
|
64348
64508
|
});
|
|
64349
64509
|
let uid = 0;
|
|
64350
64510
|
const deps = new Set();
|
|
64511
|
+
const dynamicDeps = new Set();
|
|
64351
64512
|
const idToImportMap = new Map();
|
|
64352
64513
|
const declaredConst = new Set();
|
|
64353
64514
|
function defineImport(node, source) {
|
|
@@ -64486,6 +64647,9 @@ async function ssrTransform(code, inMap, url) {
|
|
|
64486
64647
|
},
|
|
64487
64648
|
onDynamicImport(node) {
|
|
64488
64649
|
s.overwrite(node.start, node.start + 6, ssrDynamicImportKey);
|
|
64650
|
+
if (node.type === 'ImportExpression' && node.source.type === 'Literal') {
|
|
64651
|
+
dynamicDeps.add(node.source.value);
|
|
64652
|
+
}
|
|
64489
64653
|
}
|
|
64490
64654
|
});
|
|
64491
64655
|
let map = s.generateMap({ hires: true });
|
|
@@ -64506,7 +64670,8 @@ async function ssrTransform(code, inMap, url) {
|
|
|
64506
64670
|
return {
|
|
64507
64671
|
code: s.toString(),
|
|
64508
64672
|
map,
|
|
64509
|
-
deps: [...deps]
|
|
64673
|
+
deps: [...deps],
|
|
64674
|
+
dynamicDeps: [...dynamicDeps]
|
|
64510
64675
|
};
|
|
64511
64676
|
}
|
|
64512
64677
|
/**
|
|
@@ -65505,132 +65670,6 @@ function indexHtmlMiddleware(server) {
|
|
|
65505
65670
|
};
|
|
65506
65671
|
}
|
|
65507
65672
|
|
|
65508
|
-
var lib = {exports: {}};
|
|
65509
|
-
|
|
65510
|
-
(function (module, exports) {
|
|
65511
|
-
|
|
65512
|
-
var url = require$$0__default$7;
|
|
65513
|
-
|
|
65514
|
-
module.exports = function historyApiFallback(options) {
|
|
65515
|
-
options = options || {};
|
|
65516
|
-
var logger = getLogger(options);
|
|
65517
|
-
|
|
65518
|
-
return function(req, res, next) {
|
|
65519
|
-
var headers = req.headers;
|
|
65520
|
-
if (req.method !== 'GET') {
|
|
65521
|
-
logger(
|
|
65522
|
-
'Not rewriting',
|
|
65523
|
-
req.method,
|
|
65524
|
-
req.url,
|
|
65525
|
-
'because the method is not GET.'
|
|
65526
|
-
);
|
|
65527
|
-
return next();
|
|
65528
|
-
} else if (!headers || typeof headers.accept !== 'string') {
|
|
65529
|
-
logger(
|
|
65530
|
-
'Not rewriting',
|
|
65531
|
-
req.method,
|
|
65532
|
-
req.url,
|
|
65533
|
-
'because the client did not send an HTTP accept header.'
|
|
65534
|
-
);
|
|
65535
|
-
return next();
|
|
65536
|
-
} else if (headers.accept.indexOf('application/json') === 0) {
|
|
65537
|
-
logger(
|
|
65538
|
-
'Not rewriting',
|
|
65539
|
-
req.method,
|
|
65540
|
-
req.url,
|
|
65541
|
-
'because the client prefers JSON.'
|
|
65542
|
-
);
|
|
65543
|
-
return next();
|
|
65544
|
-
} else if (!acceptsHtml(headers.accept, options)) {
|
|
65545
|
-
logger(
|
|
65546
|
-
'Not rewriting',
|
|
65547
|
-
req.method,
|
|
65548
|
-
req.url,
|
|
65549
|
-
'because the client does not accept HTML.'
|
|
65550
|
-
);
|
|
65551
|
-
return next();
|
|
65552
|
-
}
|
|
65553
|
-
|
|
65554
|
-
var parsedUrl = url.parse(req.url);
|
|
65555
|
-
var rewriteTarget;
|
|
65556
|
-
options.rewrites = options.rewrites || [];
|
|
65557
|
-
for (var i = 0; i < options.rewrites.length; i++) {
|
|
65558
|
-
var rewrite = options.rewrites[i];
|
|
65559
|
-
var match = parsedUrl.pathname.match(rewrite.from);
|
|
65560
|
-
if (match !== null) {
|
|
65561
|
-
rewriteTarget = evaluateRewriteRule(parsedUrl, match, rewrite.to, req);
|
|
65562
|
-
|
|
65563
|
-
if(rewriteTarget.charAt(0) !== '/') {
|
|
65564
|
-
logger(
|
|
65565
|
-
'We recommend using an absolute path for the rewrite target.',
|
|
65566
|
-
'Received a non-absolute rewrite target',
|
|
65567
|
-
rewriteTarget,
|
|
65568
|
-
'for URL',
|
|
65569
|
-
req.url
|
|
65570
|
-
);
|
|
65571
|
-
}
|
|
65572
|
-
|
|
65573
|
-
logger('Rewriting', req.method, req.url, 'to', rewriteTarget);
|
|
65574
|
-
req.url = rewriteTarget;
|
|
65575
|
-
return next();
|
|
65576
|
-
}
|
|
65577
|
-
}
|
|
65578
|
-
|
|
65579
|
-
var pathname = parsedUrl.pathname;
|
|
65580
|
-
if (pathname.lastIndexOf('.') > pathname.lastIndexOf('/') &&
|
|
65581
|
-
options.disableDotRule !== true) {
|
|
65582
|
-
logger(
|
|
65583
|
-
'Not rewriting',
|
|
65584
|
-
req.method,
|
|
65585
|
-
req.url,
|
|
65586
|
-
'because the path includes a dot (.) character.'
|
|
65587
|
-
);
|
|
65588
|
-
return next();
|
|
65589
|
-
}
|
|
65590
|
-
|
|
65591
|
-
rewriteTarget = options.index || '/index.html';
|
|
65592
|
-
logger('Rewriting', req.method, req.url, 'to', rewriteTarget);
|
|
65593
|
-
req.url = rewriteTarget;
|
|
65594
|
-
next();
|
|
65595
|
-
};
|
|
65596
|
-
};
|
|
65597
|
-
|
|
65598
|
-
function evaluateRewriteRule(parsedUrl, match, rule, req) {
|
|
65599
|
-
if (typeof rule === 'string') {
|
|
65600
|
-
return rule;
|
|
65601
|
-
} else if (typeof rule !== 'function') {
|
|
65602
|
-
throw new Error('Rewrite rule can only be of type string or function.');
|
|
65603
|
-
}
|
|
65604
|
-
|
|
65605
|
-
return rule({
|
|
65606
|
-
parsedUrl: parsedUrl,
|
|
65607
|
-
match: match,
|
|
65608
|
-
request: req
|
|
65609
|
-
});
|
|
65610
|
-
}
|
|
65611
|
-
|
|
65612
|
-
function acceptsHtml(header, options) {
|
|
65613
|
-
options.htmlAcceptHeaders = options.htmlAcceptHeaders || ['text/html', '*/*'];
|
|
65614
|
-
for (var i = 0; i < options.htmlAcceptHeaders.length; i++) {
|
|
65615
|
-
if (header.indexOf(options.htmlAcceptHeaders[i]) !== -1) {
|
|
65616
|
-
return true;
|
|
65617
|
-
}
|
|
65618
|
-
}
|
|
65619
|
-
return false;
|
|
65620
|
-
}
|
|
65621
|
-
|
|
65622
|
-
function getLogger(options) {
|
|
65623
|
-
if (options && options.logger) {
|
|
65624
|
-
return options.logger;
|
|
65625
|
-
} else if (options && options.verbose) {
|
|
65626
|
-
return console.log.bind(console);
|
|
65627
|
-
}
|
|
65628
|
-
return function(){};
|
|
65629
|
-
}
|
|
65630
|
-
}(lib));
|
|
65631
|
-
|
|
65632
|
-
var history = lib.exports;
|
|
65633
|
-
|
|
65634
65673
|
const logTime = createDebugger('vite:time');
|
|
65635
65674
|
function timeMiddleware(root) {
|
|
65636
65675
|
// Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
|
|
@@ -71465,7 +71504,7 @@ function esbuildDepPlugin(qualified, exportsData, config, ssr) {
|
|
|
71465
71504
|
namespace: 'browser-external'
|
|
71466
71505
|
};
|
|
71467
71506
|
}
|
|
71468
|
-
if (isExternalUrl(resolved)) {
|
|
71507
|
+
if (isExternalUrl(resolved) || (ssr && isBuiltin(id))) {
|
|
71469
71508
|
return {
|
|
71470
71509
|
path: resolved,
|
|
71471
71510
|
external: true
|
|
@@ -75428,24 +75467,7 @@ async function createServer(inlineConfig = {}) {
|
|
|
75428
75467
|
middlewares.use(serveStaticMiddleware(root, config));
|
|
75429
75468
|
// spa fallback
|
|
75430
75469
|
if (!middlewareMode || middlewareMode === 'html') {
|
|
75431
|
-
middlewares.use(
|
|
75432
|
-
logger: createDebugger('vite:spa-fallback'),
|
|
75433
|
-
// support /dir/ without explicit index.html
|
|
75434
|
-
rewrites: [
|
|
75435
|
-
{
|
|
75436
|
-
from: /\/$/,
|
|
75437
|
-
to({ parsedUrl }) {
|
|
75438
|
-
const rewritten = parsedUrl.pathname + 'index.html';
|
|
75439
|
-
if (fs__default.existsSync(path__default.join(root, rewritten))) {
|
|
75440
|
-
return rewritten;
|
|
75441
|
-
}
|
|
75442
|
-
else {
|
|
75443
|
-
return `/index.html`;
|
|
75444
|
-
}
|
|
75445
|
-
}
|
|
75446
|
-
}
|
|
75447
|
-
]
|
|
75448
|
-
}));
|
|
75470
|
+
middlewares.use(spaFallbackMiddleware(root));
|
|
75449
75471
|
}
|
|
75450
75472
|
// run post config hooks
|
|
75451
75473
|
// This is applied before the html middleware so that user middleware can
|
|
@@ -75857,6 +75879,7 @@ function importAnalysisPlugin(config) {
|
|
|
75857
75879
|
this.error(`Failed to resolve import "${url}" from "${path__default.relative(process.cwd(), importer)}". Does the file exist?`, pos);
|
|
75858
75880
|
}
|
|
75859
75881
|
const isRelative = url.startsWith('.');
|
|
75882
|
+
const isSelfImport = !isRelative && cleanUrl(url) === cleanUrl(importer);
|
|
75860
75883
|
// normalize all imports into resolved URLs
|
|
75861
75884
|
// e.g. `import 'foo'` -> `import '/@fs/.../node_modules/foo/index.js`
|
|
75862
75885
|
if (resolved.id.startsWith(root + '/')) {
|
|
@@ -75884,10 +75907,11 @@ function importAnalysisPlugin(config) {
|
|
|
75884
75907
|
if (!ssr) {
|
|
75885
75908
|
// mark non-js/css imports with `?import`
|
|
75886
75909
|
url = markExplicitImport(url);
|
|
75887
|
-
// for relative js/css imports,
|
|
75910
|
+
// for relative js/css imports, or self-module virtual imports
|
|
75911
|
+
// (e.g. vue blocks), inherit importer's version query
|
|
75888
75912
|
// do not do this for unknown type imports, otherwise the appended
|
|
75889
75913
|
// query can break 3rd party plugin's extension checks.
|
|
75890
|
-
if (isRelative && !/[\?&]import=?\b/.test(url)) {
|
|
75914
|
+
if ((isRelative || isSelfImport) && !/[\?&]import=?\b/.test(url)) {
|
|
75891
75915
|
const versionMatch = importer.match(DEP_VERSION_RE);
|
|
75892
75916
|
if (versionMatch) {
|
|
75893
75917
|
url = injectQuery(url, versionMatch[1]);
|
|
@@ -76755,7 +76779,18 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development')
|
|
|
76755
76779
|
configEnv.mode = mode;
|
|
76756
76780
|
// resolve plugins
|
|
76757
76781
|
const rawUserPlugins = (config.plugins || []).flat().filter((p) => {
|
|
76758
|
-
|
|
76782
|
+
if (!p) {
|
|
76783
|
+
return false;
|
|
76784
|
+
}
|
|
76785
|
+
else if (!p.apply) {
|
|
76786
|
+
return true;
|
|
76787
|
+
}
|
|
76788
|
+
else if (typeof p.apply === 'function') {
|
|
76789
|
+
return p.apply({ ...config, mode }, configEnv);
|
|
76790
|
+
}
|
|
76791
|
+
else {
|
|
76792
|
+
return p.apply === command;
|
|
76793
|
+
}
|
|
76759
76794
|
});
|
|
76760
76795
|
const [prePlugins, normalPlugins, postPlugins] = sortUserPlugins(rawUserPlugins);
|
|
76761
76796
|
// run config hooks
|
|
@@ -77346,5 +77381,6 @@ exports.send = send$1;
|
|
|
77346
77381
|
exports.sirv = sirv;
|
|
77347
77382
|
exports.sortUserPlugins = sortUserPlugins;
|
|
77348
77383
|
exports.source = source;
|
|
77384
|
+
exports.transformWithEsbuild = transformWithEsbuild;
|
|
77349
77385
|
exports.vary = vary$1;
|
|
77350
|
-
//# sourceMappingURL=dep-
|
|
77386
|
+
//# sourceMappingURL=dep-05fcddd5.js.map
|