vite 2.7.0-beta.2 → 2.7.0-beta.3
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 +4 -0
- package/dist/node/chunks/{dep-caa1572d.js → dep-5243d0d3.js} +76 -77
- package/dist/node/chunks/dep-5243d0d3.js.map +1 -0
- package/dist/node/chunks/{dep-b89007db.js → dep-59a3bcf9.js} +2 -2
- package/dist/node/chunks/{dep-b89007db.js.map → dep-59a3bcf9.js.map} +1 -1
- package/dist/node/chunks/{dep-39172335.js → dep-777faa4b.js} +2 -2
- package/dist/node/chunks/{dep-39172335.js.map → dep-777faa4b.js.map} +1 -1
- package/dist/node/chunks/{dep-e85c9ca9.js → dep-c1084913.js} +2 -2
- package/dist/node/chunks/{dep-e85c9ca9.js.map → dep-c1084913.js.map} +1 -1
- package/dist/node/cli.js +4 -4
- package/dist/node/index.js +1 -1
- package/package.json +1 -1
- package/dist/node/chunks/dep-caa1572d.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -4058,9 +4058,6 @@ function prettifyUrl(url, root) {
|
|
|
4058
4058
|
function isObject$3(value) {
|
|
4059
4059
|
return Object.prototype.toString.call(value) === '[object Object]';
|
|
4060
4060
|
}
|
|
4061
|
-
function isDefined(value) {
|
|
4062
|
-
return value != null;
|
|
4063
|
-
}
|
|
4064
4061
|
function lookupFile(dir, formats, pathOnly = false) {
|
|
4065
4062
|
for (const format of formats) {
|
|
4066
4063
|
const fullPath = path__default.join(dir, format);
|
|
@@ -4276,9 +4273,6 @@ function combineSourcemaps(filename, sourcemapList) {
|
|
|
4276
4273
|
}
|
|
4277
4274
|
return map;
|
|
4278
4275
|
}
|
|
4279
|
-
function unique(arr) {
|
|
4280
|
-
return Array.from(new Set(arr));
|
|
4281
|
-
}
|
|
4282
4276
|
function resolveHostname(optionsHost) {
|
|
4283
4277
|
let host;
|
|
4284
4278
|
if (optionsHost === undefined ||
|
|
@@ -20383,7 +20377,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
20383
20377
|
replacer: urlReplacer
|
|
20384
20378
|
}));
|
|
20385
20379
|
if (isModule) {
|
|
20386
|
-
postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-
|
|
20380
|
+
postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-c1084913.js'); }).then(function (n) { return n.index; })).default({
|
|
20387
20381
|
...modulesOptions,
|
|
20388
20382
|
getJSON(cssFileName, _modules, outputFileName) {
|
|
20389
20383
|
modules = _modules;
|
|
@@ -21348,7 +21342,7 @@ const assetAttrsConfig = {
|
|
|
21348
21342
|
const isAsyncScriptMap = new WeakMap();
|
|
21349
21343
|
async function traverseHtml(html, filePath, visitor) {
|
|
21350
21344
|
// lazy load compiler
|
|
21351
|
-
const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-
|
|
21345
|
+
const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-59a3bcf9.js'); }).then(function (n) { return n.compilerDom_cjs; });
|
|
21352
21346
|
// @vue/compiler-core doesn't like lowercase doctypes
|
|
21353
21347
|
html = html.replace(/<!doctype\s/i, '<!DOCTYPE ');
|
|
21354
21348
|
try {
|
|
@@ -30553,97 +30547,115 @@ const debug$c = createDebugger('vite:ssr-external');
|
|
|
30553
30547
|
* Heuristics for determining whether a dependency should be externalized for
|
|
30554
30548
|
* server-side rendering.
|
|
30555
30549
|
*/
|
|
30556
|
-
function resolveSSRExternal(config, knownImports
|
|
30557
|
-
var _a
|
|
30558
|
-
|
|
30550
|
+
function resolveSSRExternal(config, knownImports) {
|
|
30551
|
+
var _a;
|
|
30552
|
+
const ssrConfig = config.ssr;
|
|
30553
|
+
if ((ssrConfig === null || ssrConfig === void 0 ? void 0 : ssrConfig.noExternal) === true) {
|
|
30559
30554
|
return [];
|
|
30560
30555
|
}
|
|
30561
|
-
const
|
|
30556
|
+
const ssrExternals = new Set();
|
|
30557
|
+
const seen = new Set();
|
|
30558
|
+
(_a = ssrConfig === null || ssrConfig === void 0 ? void 0 : ssrConfig.external) === null || _a === void 0 ? void 0 : _a.forEach((id) => {
|
|
30559
|
+
ssrExternals.add(id);
|
|
30560
|
+
seen.add(id);
|
|
30561
|
+
});
|
|
30562
|
+
collectExternals(config.root, ssrExternals, seen);
|
|
30563
|
+
for (const dep of knownImports) {
|
|
30564
|
+
// Assume external if not yet seen
|
|
30565
|
+
// At this point, the project root and any linked packages have had their dependencies checked,
|
|
30566
|
+
// so we can safely mark any knownImports not yet seen as external. They are guaranteed to be
|
|
30567
|
+
// dependencies of packages in node_modules.
|
|
30568
|
+
if (!seen.has(dep)) {
|
|
30569
|
+
ssrExternals.add(dep);
|
|
30570
|
+
}
|
|
30571
|
+
}
|
|
30572
|
+
// ensure `vite/dynamic-import-polyfill` is bundled (issue #1865)
|
|
30573
|
+
ssrExternals.delete('vite');
|
|
30574
|
+
let externals = [...ssrExternals];
|
|
30575
|
+
if (ssrConfig === null || ssrConfig === void 0 ? void 0 : ssrConfig.noExternal) {
|
|
30576
|
+
externals = externals.filter(createFilter$1(undefined, ssrConfig.noExternal, { resolve: false }));
|
|
30577
|
+
}
|
|
30578
|
+
return externals;
|
|
30579
|
+
}
|
|
30580
|
+
// do we need to do this ahead of time or could we do it lazily?
|
|
30581
|
+
function collectExternals(root, ssrExternals, seen) {
|
|
30582
|
+
var _a;
|
|
30562
30583
|
const pkgContent = lookupFile(root, ['package.json']);
|
|
30563
30584
|
if (!pkgContent) {
|
|
30564
|
-
return
|
|
30585
|
+
return;
|
|
30565
30586
|
}
|
|
30566
30587
|
const pkg = JSON.parse(pkgContent);
|
|
30567
|
-
const
|
|
30568
|
-
|
|
30569
|
-
...
|
|
30570
|
-
|
|
30571
|
-
...Object.keys(pkg.dependencies || {})
|
|
30572
|
-
]);
|
|
30588
|
+
const deps = {
|
|
30589
|
+
...pkg.devDependencies,
|
|
30590
|
+
...pkg.dependencies
|
|
30591
|
+
};
|
|
30573
30592
|
const resolveOptions = {
|
|
30574
30593
|
root,
|
|
30575
30594
|
isProduction: false,
|
|
30576
30595
|
isBuild: true
|
|
30577
30596
|
};
|
|
30578
30597
|
const depsToTrace = new Set();
|
|
30579
|
-
for (const id
|
|
30580
|
-
if (seen.has(id))
|
|
30598
|
+
for (const id in deps) {
|
|
30599
|
+
if (seen.has(id))
|
|
30581
30600
|
continue;
|
|
30582
|
-
}
|
|
30583
30601
|
seen.add(id);
|
|
30584
|
-
let
|
|
30602
|
+
let esmEntry;
|
|
30585
30603
|
let requireEntry;
|
|
30586
30604
|
try {
|
|
30587
|
-
|
|
30605
|
+
esmEntry = (_a = tryNodeResolve(id, undefined, resolveOptions, true, // we set `targetWeb` to `true` to get the ESM entry
|
|
30606
|
+
undefined, true)) === null || _a === void 0 ? void 0 : _a.id;
|
|
30588
30607
|
// normalizePath required for windows. tryNodeResolve uses normalizePath
|
|
30589
30608
|
// which returns with '/', require.resolve returns with '\\'
|
|
30590
30609
|
requireEntry = normalizePath$4(require.resolve(id, { paths: [root] }));
|
|
30591
30610
|
}
|
|
30592
30611
|
catch (e) {
|
|
30612
|
+
try {
|
|
30613
|
+
// no main entry, but deep imports may be allowed
|
|
30614
|
+
const pkgPath = resolveFrom$3(`${id}/package.json`, root);
|
|
30615
|
+
if (pkgPath.includes('node_modules')) {
|
|
30616
|
+
ssrExternals.add(id);
|
|
30617
|
+
}
|
|
30618
|
+
else {
|
|
30619
|
+
depsToTrace.add(path__default.dirname(pkgPath));
|
|
30620
|
+
}
|
|
30621
|
+
continue;
|
|
30622
|
+
}
|
|
30623
|
+
catch { }
|
|
30593
30624
|
// resolve failed, assume include
|
|
30594
30625
|
debug$c(`Failed to resolve entries for package "${id}"\n`, e);
|
|
30595
30626
|
continue;
|
|
30596
30627
|
}
|
|
30597
|
-
|
|
30598
|
-
|
|
30628
|
+
// no esm entry but has require entry
|
|
30629
|
+
if (!esmEntry) {
|
|
30599
30630
|
ssrExternals.add(id);
|
|
30600
|
-
continue;
|
|
30601
30631
|
}
|
|
30602
|
-
|
|
30603
|
-
|
|
30604
|
-
|
|
30605
|
-
depsToTrace.add(
|
|
30606
|
-
continue;
|
|
30632
|
+
// trace the dependencies of linked packages
|
|
30633
|
+
else if (!esmEntry.includes('node_modules')) {
|
|
30634
|
+
const pkgPath = resolveFrom$3(`${id}/package.json`, root);
|
|
30635
|
+
depsToTrace.add(path__default.dirname(pkgPath));
|
|
30607
30636
|
}
|
|
30608
|
-
|
|
30609
|
-
|
|
30637
|
+
// has separate esm/require entry, assume require entry is cjs
|
|
30638
|
+
else if (esmEntry !== requireEntry) {
|
|
30610
30639
|
ssrExternals.add(id);
|
|
30611
30640
|
}
|
|
30612
|
-
|
|
30613
|
-
|
|
30614
|
-
|
|
30615
|
-
|
|
30616
|
-
|
|
30617
|
-
}
|
|
30618
|
-
if (pkg.type === 'module' || entry.endsWith('.mjs')) {
|
|
30641
|
+
// if we're externalizing ESM and CJS should basically just always do it?
|
|
30642
|
+
// or are there others like SystemJS / AMD that we'd need to handle?
|
|
30643
|
+
// for now, we'll just leave this as is
|
|
30644
|
+
else if (/\.m?js$/.test(esmEntry)) {
|
|
30645
|
+
if (pkg.type === "module" || esmEntry.endsWith('.mjs')) {
|
|
30619
30646
|
ssrExternals.add(id);
|
|
30620
30647
|
continue;
|
|
30621
30648
|
}
|
|
30622
30649
|
// check if the entry is cjs
|
|
30623
|
-
const content = fs__default.readFileSync(
|
|
30650
|
+
const content = fs__default.readFileSync(esmEntry, 'utf-8');
|
|
30624
30651
|
if (/\bmodule\.exports\b|\bexports[.\[]|\brequire\s*\(/.test(content)) {
|
|
30625
30652
|
ssrExternals.add(id);
|
|
30626
30653
|
}
|
|
30627
30654
|
}
|
|
30628
30655
|
}
|
|
30629
|
-
for (const
|
|
30630
|
-
|
|
30631
|
-
resolveSSRExternal({
|
|
30632
|
-
...config,
|
|
30633
|
-
root: depRoot
|
|
30634
|
-
}, knownImports, ssrExternals, seen);
|
|
30635
|
-
}
|
|
30636
|
-
if ((_c = config.ssr) === null || _c === void 0 ? void 0 : _c.external) {
|
|
30637
|
-
config.ssr.external.forEach((id) => ssrExternals.add(id));
|
|
30656
|
+
for (const depRoot of depsToTrace) {
|
|
30657
|
+
collectExternals(depRoot, ssrExternals, seen);
|
|
30638
30658
|
}
|
|
30639
|
-
let externals = [...ssrExternals];
|
|
30640
|
-
if ((_d = config.ssr) === null || _d === void 0 ? void 0 : _d.noExternal) {
|
|
30641
|
-
const filter = createFilter$1(undefined, config.ssr.noExternal, {
|
|
30642
|
-
resolve: false
|
|
30643
|
-
});
|
|
30644
|
-
externals = externals.filter((id) => filter(id));
|
|
30645
|
-
}
|
|
30646
|
-
return externals.filter((id) => id !== 'vite');
|
|
30647
30659
|
}
|
|
30648
30660
|
function shouldExternalizeForSSR(id, externals) {
|
|
30649
30661
|
const should = externals.some((e) => {
|
|
@@ -30658,17 +30670,6 @@ function shouldExternalizeForSSR(id, externals) {
|
|
|
30658
30670
|
});
|
|
30659
30671
|
return should;
|
|
30660
30672
|
}
|
|
30661
|
-
function getNpmPackageName(importPath) {
|
|
30662
|
-
const parts = importPath.split('/');
|
|
30663
|
-
if (parts[0].startsWith('@')) {
|
|
30664
|
-
if (!parts[1])
|
|
30665
|
-
return null;
|
|
30666
|
-
return `${parts[0]}/${parts[1]}`;
|
|
30667
|
-
}
|
|
30668
|
-
else {
|
|
30669
|
-
return parts[0];
|
|
30670
|
-
}
|
|
30671
|
-
}
|
|
30672
30673
|
|
|
30673
30674
|
function ssrManifestPlugin(config) {
|
|
30674
30675
|
// module id => preload assets mapping
|
|
@@ -49230,7 +49231,7 @@ function readFileIfExists(value) {
|
|
|
49230
49231
|
* https://github.com/webpack/webpack-dev-server/blob/master/LICENSE
|
|
49231
49232
|
*/
|
|
49232
49233
|
async function createCertificate() {
|
|
49233
|
-
const { generate } = await Promise.resolve().then(function () { return require('./dep-
|
|
49234
|
+
const { generate } = await Promise.resolve().then(function () { return require('./dep-777faa4b.js'); }).then(function (n) { return n.index; });
|
|
49234
49235
|
const pems = generate(null, {
|
|
49235
49236
|
algorithm: 'sha256',
|
|
49236
49237
|
days: 30,
|
|
@@ -67181,11 +67182,9 @@ async function createServer(inlineConfig = {}) {
|
|
|
67181
67182
|
},
|
|
67182
67183
|
transformIndexHtml: null,
|
|
67183
67184
|
ssrLoadModule(url) {
|
|
67184
|
-
|
|
67185
|
-
|
|
67186
|
-
|
|
67187
|
-
: []);
|
|
67188
|
-
}
|
|
67185
|
+
server._ssrExternals || (server._ssrExternals = resolveSSRExternal(config, server._optimizeDepsMetadata
|
|
67186
|
+
? Object.keys(server._optimizeDepsMetadata.optimized)
|
|
67187
|
+
: []));
|
|
67189
67188
|
return ssrLoadModule(url, server);
|
|
67190
67189
|
},
|
|
67191
67190
|
ssrFixStacktrace(e) {
|
|
@@ -81994,4 +81993,4 @@ exports.send = send$1;
|
|
|
81994
81993
|
exports.sortUserPlugins = sortUserPlugins;
|
|
81995
81994
|
exports.source = source;
|
|
81996
81995
|
exports.transformWithEsbuild = transformWithEsbuild;
|
|
81997
|
-
//# sourceMappingURL=dep-
|
|
81996
|
+
//# sourceMappingURL=dep-5243d0d3.js.map
|