vite 5.0.0-beta.11 → 5.0.0-beta.12
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z as commonjsGlobal, y as getDefaultExportFromCjs } from './dep-
|
|
1
|
+
import { z as commonjsGlobal, y as getDefaultExportFromCjs } from './dep-poYMMaJ-.js';
|
|
2
2
|
import require$$0__default from 'fs';
|
|
3
3
|
import require$$0 from 'postcss';
|
|
4
4
|
import require$$0$1 from 'path';
|
|
@@ -27426,6 +27426,7 @@ function hasESMSyntax(code) {
|
|
|
27426
27426
|
|
|
27427
27427
|
const normalizedClientEntry$1 = normalizePath$3(CLIENT_ENTRY);
|
|
27428
27428
|
const normalizedEnvEntry$1 = normalizePath$3(ENV_ENTRY);
|
|
27429
|
+
const ERR_RESOLVE_PACKAGE_ENTRY_FAIL = 'ERR_RESOLVE_PACKAGE_ENTRY_FAIL';
|
|
27429
27430
|
// special id for paths marked with browser: false
|
|
27430
27431
|
// https://github.com/defunctzombie/package-browser-field-spec#ignore-a-module
|
|
27431
27432
|
const browserExternalId = '__vite-browser-external';
|
|
@@ -27778,7 +27779,8 @@ function tryCleanFsResolve(file, options, tryIndex = true, targetWeb = true, ski
|
|
|
27778
27779
|
}
|
|
27779
27780
|
}
|
|
27780
27781
|
catch (e) {
|
|
27781
|
-
if
|
|
27782
|
+
// This check is best effort, so if an entry is not found, skip error for now
|
|
27783
|
+
if (e.code !== ERR_RESOLVE_PACKAGE_ENTRY_FAIL && e.code !== 'ENOENT')
|
|
27782
27784
|
throw e;
|
|
27783
27785
|
}
|
|
27784
27786
|
}
|
|
@@ -28026,14 +28028,8 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
|
|
|
28026
28028
|
if (data.exports) {
|
|
28027
28029
|
entryPoint = resolveExportsOrImports(data, '.', options, targetWeb, 'exports');
|
|
28028
28030
|
}
|
|
28029
|
-
|
|
28030
|
-
|
|
28031
|
-
// This is because .mjs files can technically import .cjs files which would
|
|
28032
|
-
// make them invalid for pure ESM environments - so if other module/browser
|
|
28033
|
-
// fields are present, prioritize those instead.
|
|
28034
|
-
if (targetWeb &&
|
|
28035
|
-
options.browserField &&
|
|
28036
|
-
(!entryPoint || entryPoint.endsWith('.mjs'))) {
|
|
28031
|
+
// handle edge case with browser and module field semantics
|
|
28032
|
+
if (!entryPoint && targetWeb && options.browserField) {
|
|
28037
28033
|
// check browser field
|
|
28038
28034
|
// https://github.com/defunctzombie/package-browser-field-spec
|
|
28039
28035
|
const browserEntry = typeof data.browser === 'string'
|
|
@@ -28070,8 +28066,7 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
|
|
|
28070
28066
|
}
|
|
28071
28067
|
}
|
|
28072
28068
|
// fallback to mainFields if still not resolved
|
|
28073
|
-
|
|
28074
|
-
if (!resolvedFromExports && (!entryPoint || entryPoint.endsWith('.mjs'))) {
|
|
28069
|
+
if (!entryPoint) {
|
|
28075
28070
|
for (const field of options.mainFields) {
|
|
28076
28071
|
if (field === 'browser')
|
|
28077
28072
|
continue; // already checked above
|
|
@@ -28117,9 +28112,11 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
|
|
|
28117
28112
|
packageEntryFailure(id);
|
|
28118
28113
|
}
|
|
28119
28114
|
function packageEntryFailure(id, details) {
|
|
28120
|
-
|
|
28115
|
+
const err = new Error(`Failed to resolve entry for package "${id}". ` +
|
|
28121
28116
|
`The package may have incorrect main/module/exports specified in its package.json` +
|
|
28122
28117
|
(details ? ': ' + details : '.'));
|
|
28118
|
+
err.code = ERR_RESOLVE_PACKAGE_ENTRY_FAIL;
|
|
28119
|
+
throw err;
|
|
28123
28120
|
}
|
|
28124
28121
|
function resolveExportsOrImports(pkg, key, options, targetWeb, type) {
|
|
28125
28122
|
const additionalConditions = new Set(options.overrideConditions || [
|
|
@@ -37686,6 +37683,7 @@ const inlineRE = /[?&]inline\b/;
|
|
|
37686
37683
|
const inlineCSSRE = /[?&]inline-css\b/;
|
|
37687
37684
|
const styleAttrRE = /[?&]style-attr\b/;
|
|
37688
37685
|
const varRE = /^var\(/i;
|
|
37686
|
+
const nonEscapedDoubleQuoteRe = /(?<!\\)(")/g;
|
|
37689
37687
|
const cssBundleName = 'style.css';
|
|
37690
37688
|
const isCSSRequest = (request) => CSS_LANGS_RE.test(request);
|
|
37691
37689
|
const isModuleCSSRequest = (request) => cssModuleRE.test(request);
|
|
@@ -38467,8 +38465,8 @@ function createCachedImport(imp) {
|
|
|
38467
38465
|
return cached;
|
|
38468
38466
|
};
|
|
38469
38467
|
}
|
|
38470
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
|
38471
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
|
38468
|
+
const importPostcssImport = createCachedImport(() => import('./dep-cjQQUT93.js').then(function (n) { return n.i; }));
|
|
38469
|
+
const importPostcssModules = createCachedImport(() => import('./dep-BF1HzV2j.js').then(function (n) { return n.i; }));
|
|
38472
38470
|
const importPostcss = createCachedImport(() => import('postcss'));
|
|
38473
38471
|
/**
|
|
38474
38472
|
* @experimental
|
|
@@ -38653,10 +38651,19 @@ async function doUrlReplace(rawUrl, matched, replacer, funcName = 'url') {
|
|
|
38653
38651
|
if (skipUrlReplacer(rawUrl)) {
|
|
38654
38652
|
return matched;
|
|
38655
38653
|
}
|
|
38656
|
-
|
|
38654
|
+
let newUrl = await replacer(rawUrl);
|
|
38655
|
+
// The new url might need wrapping even if the original did not have it, e.g. if a space was added during replacement
|
|
38657
38656
|
if (wrap === '' && newUrl !== encodeURI(newUrl)) {
|
|
38658
|
-
|
|
38659
|
-
|
|
38657
|
+
wrap = '"';
|
|
38658
|
+
}
|
|
38659
|
+
// If wrapping in single quotes and newUrl also contains single quotes, switch to double quotes.
|
|
38660
|
+
// Give preference to double quotes since SVG inlining converts double quotes to single quotes.
|
|
38661
|
+
if (wrap === "'" && newUrl.includes("'")) {
|
|
38662
|
+
wrap = '"';
|
|
38663
|
+
}
|
|
38664
|
+
// Escape double quotes if they exist (they also tend to be rarer than single quotes)
|
|
38665
|
+
if (wrap === '"' && newUrl.includes('"')) {
|
|
38666
|
+
newUrl = newUrl.replace(nonEscapedDoubleQuoteRe, '\\"');
|
|
38660
38667
|
}
|
|
38661
38668
|
return `${funcName}(${wrap}${newUrl}${wrap})`;
|
|
38662
38669
|
}
|
|
@@ -54866,7 +54873,6 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
54866
54873
|
const importId = `__vite_ssr_import_${uid++}__`;
|
|
54867
54874
|
// Reduce metadata to undefined if it's all default values
|
|
54868
54875
|
if (metadata &&
|
|
54869
|
-
metadata.isExportAll !== true &&
|
|
54870
54876
|
(metadata.namedImportSpecifiers == null ||
|
|
54871
54877
|
metadata.namedImportSpecifiers.length === 0)) {
|
|
54872
54878
|
metadata = undefined;
|
|
@@ -54972,9 +54978,7 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
54972
54978
|
// export * from './foo'
|
|
54973
54979
|
if (node.type === 'ExportAllDeclaration') {
|
|
54974
54980
|
s.remove(node.start, node.end);
|
|
54975
|
-
const importId = defineImport(node.source.value
|
|
54976
|
-
isExportAll: true,
|
|
54977
|
-
});
|
|
54981
|
+
const importId = defineImport(node.source.value);
|
|
54978
54982
|
// hoist re-exports near the defined import so they are immediately exported
|
|
54979
54983
|
if (node.exported) {
|
|
54980
54984
|
defineExport(hoistIndex, node.exported.name, `${importId}`);
|
package/dist/node/cli.js
CHANGED
|
@@ -2,7 +2,7 @@ import path from 'node:path';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import { performance } from 'node:perf_hooks';
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
|
-
import { x as colors, k as createLogger, r as resolveConfig } from './chunks/dep-
|
|
5
|
+
import { x as colors, k as createLogger, r as resolveConfig } from './chunks/dep-poYMMaJ-.js';
|
|
6
6
|
import { VERSION } from './constants.js';
|
|
7
7
|
import 'node:fs/promises';
|
|
8
8
|
import 'node:url';
|
|
@@ -759,7 +759,7 @@ cli
|
|
|
759
759
|
filterDuplicateOptions(options);
|
|
760
760
|
// output structure is preserved even after bundling so require()
|
|
761
761
|
// is ok here
|
|
762
|
-
const { createServer } = await import('./chunks/dep-
|
|
762
|
+
const { createServer } = await import('./chunks/dep-poYMMaJ-.js').then(function (n) { return n.C; });
|
|
763
763
|
try {
|
|
764
764
|
const server = await createServer({
|
|
765
765
|
root,
|
|
@@ -840,7 +840,7 @@ cli
|
|
|
840
840
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
841
841
|
.action(async (root, options) => {
|
|
842
842
|
filterDuplicateOptions(options);
|
|
843
|
-
const { build } = await import('./chunks/dep-
|
|
843
|
+
const { build } = await import('./chunks/dep-poYMMaJ-.js').then(function (n) { return n.B; });
|
|
844
844
|
const buildOptions = cleanOptions(options);
|
|
845
845
|
try {
|
|
846
846
|
await build({
|
|
@@ -868,7 +868,7 @@ cli
|
|
|
868
868
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
869
869
|
.action(async (root, options) => {
|
|
870
870
|
filterDuplicateOptions(options);
|
|
871
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
871
|
+
const { optimizeDeps } = await import('./chunks/dep-poYMMaJ-.js').then(function (n) { return n.A; });
|
|
872
872
|
try {
|
|
873
873
|
const config = await resolveConfig({
|
|
874
874
|
root,
|
|
@@ -894,7 +894,7 @@ cli
|
|
|
894
894
|
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
|
895
895
|
.action(async (root, options) => {
|
|
896
896
|
filterDuplicateOptions(options);
|
|
897
|
-
const { preview } = await import('./chunks/dep-
|
|
897
|
+
const { preview } = await import('./chunks/dep-poYMMaJ-.js').then(function (n) { return n.D; });
|
|
898
898
|
try {
|
|
899
899
|
const server = await preview({
|
|
900
900
|
root,
|
package/dist/node/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as isInNodeModules } from './chunks/dep-
|
|
2
|
-
export { b as build, e as buildErrorMessage, h as createFilter, k as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, u as isFileServingAllowed, l as loadConfigFromFile, v as loadEnv, g as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, r as resolveConfig, w as resolveEnvPrefix, q as searchForWorkspaceRoot, j as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-
|
|
1
|
+
import { i as isInNodeModules } from './chunks/dep-poYMMaJ-.js';
|
|
2
|
+
export { b as build, e as buildErrorMessage, h as createFilter, k as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, u as isFileServingAllowed, l as loadConfigFromFile, v as loadEnv, g as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, r as resolveConfig, w as resolveEnvPrefix, q as searchForWorkspaceRoot, j as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-poYMMaJ-.js';
|
|
3
3
|
export { VERSION as version } from './constants.js';
|
|
4
4
|
export { version as esbuildVersion } from 'esbuild';
|
|
5
5
|
export { VERSION as rollupVersion } from 'rollup';
|