🔧
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { P as getDefaultExportFromCjs } from './dep-Bxmd1Uxj.js';
|
||||
import { P as getDefaultExportFromCjs } from './dep-DBxKXgDP.js';
|
||||
import require$$0 from 'path';
|
||||
import { l as lib } from './dep-3RmXg9uo.js';
|
||||
|
||||
@@ -7510,14 +7510,17 @@ const teardownSIGTERMListener = (callback) => {
|
||||
}
|
||||
}
|
||||
};
|
||||
function getServerUrlByHost(server, host) {
|
||||
if (typeof host !== "string") {
|
||||
return server.resolvedUrls?.local[0] ?? server.resolvedUrls?.network[0];
|
||||
function getServerUrlByHost(resolvedUrls, host) {
|
||||
if (typeof host === "string") {
|
||||
const matchedUrl = [
|
||||
...resolvedUrls?.local ?? [],
|
||||
...resolvedUrls?.network ?? []
|
||||
].find((url) => url.includes(host));
|
||||
if (matchedUrl) {
|
||||
return matchedUrl;
|
||||
}
|
||||
}
|
||||
return [
|
||||
...server.resolvedUrls?.local ?? [],
|
||||
...server.resolvedUrls?.network ?? []
|
||||
].find((url) => url.includes(host));
|
||||
return resolvedUrls?.local[0] ?? resolvedUrls?.network[0];
|
||||
}
|
||||
|
||||
const LogLevels = {
|
||||
@@ -10556,7 +10559,7 @@ async function fileToBuiltUrl(pluginContext, id, skipPublicCheck = false, forceI
|
||||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
const { file, postfix } = splitFileAndPostfix(id);
|
||||
let { file, postfix } = splitFileAndPostfix(id);
|
||||
const content = await fsp.readFile(file);
|
||||
let url;
|
||||
if (shouldInline(environment, file, id, content, pluginContext, forceInline)) {
|
||||
@@ -10572,6 +10575,9 @@ async function fileToBuiltUrl(pluginContext, id, skipPublicCheck = false, forceI
|
||||
originalFileName,
|
||||
source: content
|
||||
});
|
||||
if (environment.config.command === "build" && noInlineRE.test(postfix)) {
|
||||
postfix = postfix.replace(noInlineRE, "").replace(/^&/, "?");
|
||||
}
|
||||
url = `__VITE_ASSET__${referenceId}__${postfix ? `$_${postfix}__` : ``}`;
|
||||
}
|
||||
cache.set(id, url);
|
||||
@@ -12219,7 +12225,9 @@ function encodeQueryItem(key, value) {
|
||||
return encodeQueryKey(key);
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
return value.map((_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`).join("&");
|
||||
return value.map(
|
||||
(_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`
|
||||
).join("&");
|
||||
}
|
||||
return `${encodeQueryKey(key)}=${encodeQueryValue(value)}`;
|
||||
}
|
||||
@@ -13018,7 +13026,7 @@ function esbuildCjsExternalPlugin(externals, platform) {
|
||||
(args) => ({
|
||||
contents: `import * as m from ${JSON.stringify(
|
||||
nonFacadePrefix + args.path
|
||||
)};module.exports = m;`
|
||||
)};module.exports = { ...m };`
|
||||
})
|
||||
);
|
||||
}
|
||||
@@ -16441,7 +16449,7 @@ function throwFileNotFoundInOptimizedDep(id) {
|
||||
|
||||
var main = {exports: {}};
|
||||
|
||||
var version$1 = "16.4.7";
|
||||
var version$1 = "16.5.0";
|
||||
var require$$4 = {
|
||||
version: version$1};
|
||||
|
||||
@@ -16536,10 +16544,6 @@ function _parseVault (options) {
|
||||
return DotenvModule.parse(decrypted)
|
||||
}
|
||||
|
||||
function _log (message) {
|
||||
console.log(`[dotenv@${version}][INFO] ${message}`);
|
||||
}
|
||||
|
||||
function _warn (message) {
|
||||
console.log(`[dotenv@${version}][WARN] ${message}`);
|
||||
}
|
||||
@@ -16635,7 +16639,10 @@ function _resolveHome (envPath) {
|
||||
}
|
||||
|
||||
function _configVault (options) {
|
||||
_log('Loading env from encrypted .env.vault');
|
||||
const debug = Boolean(options && options.debug);
|
||||
if (debug) {
|
||||
_debug('Loading env from encrypted .env.vault');
|
||||
}
|
||||
|
||||
const parsed = DotenvModule._parseVault(options);
|
||||
|
||||
@@ -25643,20 +25650,46 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
||||
function defineExport(name, local = name) {
|
||||
s.appendLeft(
|
||||
fileStartIndex,
|
||||
`Object.defineProperty(${ssrModuleExportsKey}, ${JSON.stringify(name)}, { enumerable: true, configurable: true, get(){ return ${local} }});
|
||||
`Object.defineProperty(${ssrModuleExportsKey}, ${JSON.stringify(name)}, { enumerable: true, configurable: true, get(){ try { return ${local} } catch {} }});
|
||||
`
|
||||
);
|
||||
}
|
||||
const imports = [];
|
||||
const exports = [];
|
||||
const reExportImportIdMap = /* @__PURE__ */ new Map();
|
||||
for (const node of ast.body) {
|
||||
if (node.type === "ImportDeclaration") {
|
||||
imports.push(node);
|
||||
} else if (node.type === "ExportNamedDeclaration" || node.type === "ExportDefaultDeclaration" || node.type === "ExportAllDeclaration") {
|
||||
} else if (node.type === "ExportDefaultDeclaration") {
|
||||
exports.push(node);
|
||||
} else if (node.type === "ExportNamedDeclaration" || node.type === "ExportAllDeclaration") {
|
||||
imports.push(node);
|
||||
exports.push(node);
|
||||
}
|
||||
}
|
||||
for (const node of imports) {
|
||||
if (node.type === "ExportNamedDeclaration") {
|
||||
if (node.source) {
|
||||
const importId2 = defineImport(
|
||||
hoistIndex,
|
||||
node,
|
||||
{
|
||||
importedNames: node.specifiers.map(
|
||||
(s2) => getIdentifierNameOrLiteralValue$1(s2.local)
|
||||
)
|
||||
}
|
||||
);
|
||||
reExportImportIdMap.set(node, importId2);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (node.type === "ExportAllDeclaration") {
|
||||
if (node.source) {
|
||||
const importId2 = defineImport(hoistIndex, node);
|
||||
reExportImportIdMap.set(node, importId2);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
const importId = defineImport(hoistIndex, node, {
|
||||
importedNames: node.specifiers.map((s2) => {
|
||||
if (s2.type === "ImportSpecifier")
|
||||
@@ -25699,17 +25732,8 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
||||
}
|
||||
s.remove(node.start, node.declaration.start);
|
||||
} else {
|
||||
s.remove(node.start, node.end);
|
||||
if (node.source) {
|
||||
const importId = defineImport(
|
||||
node.start,
|
||||
node,
|
||||
{
|
||||
importedNames: node.specifiers.map(
|
||||
(s2) => getIdentifierNameOrLiteralValue$1(s2.local)
|
||||
)
|
||||
}
|
||||
);
|
||||
const importId = reExportImportIdMap.get(node);
|
||||
for (const spec of node.specifiers) {
|
||||
const exportedAs = getIdentifierNameOrLiteralValue$1(
|
||||
spec.exported
|
||||
@@ -25724,6 +25748,7 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
s.remove(node.start, node.end);
|
||||
for (const spec of node.specifiers) {
|
||||
const local = spec.local.name;
|
||||
const binding = idToImportMap.get(local);
|
||||
@@ -25744,20 +25769,19 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
||||
node.start + 15
|
||||
/* 'export default '.length */
|
||||
);
|
||||
s.append(
|
||||
`
|
||||
Object.defineProperty(${ssrModuleExportsKey}, "default", { enumerable: true, configurable: true, value: ${name} });`
|
||||
);
|
||||
defineExport("default", name);
|
||||
} else {
|
||||
const name = `__vite_ssr_export_default__`;
|
||||
s.update(
|
||||
node.start,
|
||||
node.start + 14,
|
||||
`${ssrModuleExportsKey}.default =`
|
||||
`const ${name} =`
|
||||
);
|
||||
defineExport("default", name);
|
||||
}
|
||||
}
|
||||
if (node.type === "ExportAllDeclaration") {
|
||||
const importId = defineImport(node.start, node);
|
||||
const importId = reExportImportIdMap.get(node);
|
||||
if (node.exported) {
|
||||
const exportedAs = getIdentifierNameOrLiteralValue$1(
|
||||
node.exported
|
||||
@@ -26324,6 +26348,7 @@ const baseOpen = async options => {
|
||||
'firefox.desktop': 'firefox',
|
||||
'com.microsoft.msedge': 'edge',
|
||||
'com.microsoft.edge': 'edge',
|
||||
'com.microsoft.edgemac': 'edge',
|
||||
'microsoft-edge.desktop': 'edge',
|
||||
};
|
||||
|
||||
@@ -35323,8 +35348,11 @@ function sirv (dir, opts={}) {
|
||||
}
|
||||
|
||||
const knownJavascriptExtensionRE = /\.(?:[tj]sx?|[cm][tj]s)$/;
|
||||
const ERR_DENIED_FILE = "ERR_DENIED_FILE";
|
||||
const sirvOptions = ({
|
||||
getHeaders
|
||||
config,
|
||||
getHeaders,
|
||||
disableFsServeCheck
|
||||
}) => {
|
||||
return {
|
||||
dev: true,
|
||||
@@ -35340,6 +35368,19 @@ const sirvOptions = ({
|
||||
res.setHeader(name, headers[name]);
|
||||
}
|
||||
}
|
||||
},
|
||||
shouldServe: disableFsServeCheck ? void 0 : (filePath) => {
|
||||
const servingAccessResult = checkLoadingAccess(config, filePath);
|
||||
if (servingAccessResult === "denied") {
|
||||
const error = new Error("denied access");
|
||||
error.code = ERR_DENIED_FILE;
|
||||
error.path = filePath;
|
||||
throw error;
|
||||
}
|
||||
if (servingAccessResult === "fallback") {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -35348,7 +35389,9 @@ function servePublicMiddleware(server, publicFiles) {
|
||||
const serve = sirv(
|
||||
dir,
|
||||
sirvOptions({
|
||||
getHeaders: () => server.config.server.headers
|
||||
config: server.config,
|
||||
getHeaders: () => server.config.server.headers,
|
||||
disableFsServeCheck: true
|
||||
})
|
||||
);
|
||||
const toFilePath = (url) => {
|
||||
@@ -35374,6 +35417,7 @@ function serveStaticMiddleware(server) {
|
||||
const serve = sirv(
|
||||
dir,
|
||||
sirvOptions({
|
||||
config: server.config,
|
||||
getHeaders: () => server.config.server.headers
|
||||
})
|
||||
);
|
||||
@@ -35404,38 +35448,46 @@ function serveStaticMiddleware(server) {
|
||||
if (resolvedPathname.endsWith("/") && fileUrl[fileUrl.length - 1] !== "/") {
|
||||
fileUrl = withTrailingSlash(fileUrl);
|
||||
}
|
||||
if (!ensureServingAccess(fileUrl, server, res, next)) {
|
||||
return;
|
||||
}
|
||||
if (redirectedPathname) {
|
||||
url.pathname = encodeURI(redirectedPathname);
|
||||
req.url = url.href.slice(url.origin.length);
|
||||
}
|
||||
serve(req, res, next);
|
||||
try {
|
||||
serve(req, res, next);
|
||||
} catch (e) {
|
||||
if (e && "code" in e && e.code === ERR_DENIED_FILE) {
|
||||
respondWithAccessDenied(e.path, server, res);
|
||||
return;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
}
|
||||
function serveRawFsMiddleware(server) {
|
||||
const serveFromRoot = sirv(
|
||||
"/",
|
||||
sirvOptions({ getHeaders: () => server.config.server.headers })
|
||||
sirvOptions({
|
||||
config: server.config,
|
||||
getHeaders: () => server.config.server.headers
|
||||
})
|
||||
);
|
||||
return function viteServeRawFsMiddleware(req, res, next) {
|
||||
if (req.url.startsWith(FS_PREFIX)) {
|
||||
const url = new URL(req.url, "http://example.com");
|
||||
const pathname = decodeURI(url.pathname);
|
||||
if (!ensureServingAccess(
|
||||
slash$1(path$b.resolve(fsPathFromId(pathname))),
|
||||
server,
|
||||
res,
|
||||
next
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
let newPathname = pathname.slice(FS_PREFIX.length);
|
||||
if (isWindows$3) newPathname = newPathname.replace(/^[A-Z]:/i, "");
|
||||
url.pathname = encodeURI(newPathname);
|
||||
req.url = url.href.slice(url.origin.length);
|
||||
serveFromRoot(req, res, next);
|
||||
try {
|
||||
serveFromRoot(req, res, next);
|
||||
} catch (e) {
|
||||
if (e && "code" in e && e.code === ERR_DENIED_FILE) {
|
||||
respondWithAccessDenied(e.path, server, res);
|
||||
return;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
@@ -35459,25 +35511,35 @@ function isFileLoadingAllowed(config, filePath) {
|
||||
if (fs.allow.some((uri) => isUriInFilePath(uri, filePath))) return true;
|
||||
return false;
|
||||
}
|
||||
function ensureServingAccess(url, server, res, next) {
|
||||
function checkLoadingAccess(config, path2) {
|
||||
if (isFileLoadingAllowed(config, slash$1(path2))) {
|
||||
return "allowed";
|
||||
}
|
||||
if (isFileReadable(path2)) {
|
||||
return "denied";
|
||||
}
|
||||
return "fallback";
|
||||
}
|
||||
function checkServingAccess(url, server) {
|
||||
if (isFileServingAllowed(url, server)) {
|
||||
return true;
|
||||
return "allowed";
|
||||
}
|
||||
if (isFileReadable(cleanUrl(url))) {
|
||||
const urlMessage = `The request url "${url}" is outside of Vite serving allow list.`;
|
||||
const hintMessage = `
|
||||
return "denied";
|
||||
}
|
||||
return "fallback";
|
||||
}
|
||||
function respondWithAccessDenied(url, server, res) {
|
||||
const urlMessage = `The request url "${url}" is outside of Vite serving allow list.`;
|
||||
const hintMessage = `
|
||||
${server.config.server.fs.allow.map((i) => `- ${i}`).join("\n")}
|
||||
|
||||
Refer to docs https://vite.dev/config/server-options.html#server-fs-allow for configurations and more details.`;
|
||||
server.config.logger.error(urlMessage);
|
||||
server.config.logger.warnOnce(hintMessage + "\n");
|
||||
res.statusCode = 403;
|
||||
res.write(renderRestrictedErrorHTML(urlMessage + "\n" + hintMessage));
|
||||
res.end();
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
return false;
|
||||
server.config.logger.error(urlMessage);
|
||||
server.config.logger.warnOnce(hintMessage + "\n");
|
||||
res.statusCode = 403;
|
||||
res.write(renderRestrictedErrorHTML(urlMessage + "\n" + hintMessage));
|
||||
res.end();
|
||||
}
|
||||
function renderRestrictedErrorHTML(msg) {
|
||||
const html = String.raw;
|
||||
@@ -37055,7 +37117,18 @@ const rawRE = /[?&]raw\b/;
|
||||
const inlineRE$2 = /[?&]inline\b/;
|
||||
const svgRE = /\.svg\b/;
|
||||
function deniedServingAccessForTransform(url, server, res, next) {
|
||||
return (rawRE.test(url) || urlRE.test(url) || inlineRE$2.test(url) || svgRE.test(url)) && !ensureServingAccess(url, server, res, next);
|
||||
if (rawRE.test(url) || urlRE.test(url) || inlineRE$2.test(url) || svgRE.test(url)) {
|
||||
const servingAccessResult = checkServingAccess(url, server);
|
||||
if (servingAccessResult === "denied") {
|
||||
respondWithAccessDenied(url, server, res);
|
||||
return true;
|
||||
}
|
||||
if (servingAccessResult === "fallback") {
|
||||
next();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function cachedTransformMiddleware(server) {
|
||||
return function viteCachedTransformMiddleware(req, res, next) {
|
||||
@@ -37091,6 +37164,12 @@ function transformMiddleware(server) {
|
||||
"\0"
|
||||
);
|
||||
} catch (e) {
|
||||
if (e instanceof URIError) {
|
||||
server.config.logger.warn(
|
||||
colors$1.yellow("Malformed URI sequence in request URL")
|
||||
);
|
||||
return next();
|
||||
}
|
||||
return next(e);
|
||||
}
|
||||
const withoutQuery = cleanUrl(url);
|
||||
@@ -38429,7 +38508,7 @@ async function _createServer(inlineConfig = {}, options) {
|
||||
},
|
||||
openBrowser() {
|
||||
const options2 = server.config.server;
|
||||
const url = getServerUrlByHost(server, options2.host);
|
||||
const url = getServerUrlByHost(server.resolvedUrls, options2.host);
|
||||
if (url) {
|
||||
const path2 = typeof options2.open === "string" ? new URL(options2.open, url).href : url;
|
||||
if (server.config.server.preTransformRequests) {
|
||||
@@ -42761,8 +42840,6 @@ function resolveCSSOptions(options) {
|
||||
if (resolved.transformer === "lightningcss") {
|
||||
resolved.lightningcss ??= {};
|
||||
resolved.lightningcss.targets ??= convertTargets(ESBUILD_MODULES_TARGET);
|
||||
} else {
|
||||
resolved.lightningcss = void 0;
|
||||
}
|
||||
return resolved;
|
||||
}
|
||||
@@ -43443,6 +43520,7 @@ function getEmptyChunkReplacer(pureCssChunkNames, outputFormat) {
|
||||
}
|
||||
);
|
||||
}
|
||||
const fileURLWithWindowsDriveRE = /^file:\/\/\/[a-zA-Z]:\//;
|
||||
function createCSSResolvers(config) {
|
||||
let cssResolve;
|
||||
let sassResolve;
|
||||
@@ -43472,7 +43550,7 @@ function createCSSResolvers(config) {
|
||||
args[1] = fileURLToPath$1(args[1], {
|
||||
windows: (
|
||||
// file:///foo cannot be converted to path with windows mode
|
||||
isWindows$3 && args[1].startsWith("file:///") ? false : void 0
|
||||
isWindows$3 && !fileURLWithWindowsDriveRE.test(args[1]) ? false : void 0
|
||||
)
|
||||
});
|
||||
}
|
||||
@@ -43834,8 +43912,8 @@ function createCachedImport(imp) {
|
||||
return cached;
|
||||
};
|
||||
}
|
||||
const importPostcssImport = createCachedImport(() => import('./dep-DYEId0Fh.js').then(function (n) { return n.i; }));
|
||||
const importPostcssModules = createCachedImport(() => import('./dep-yVbOhD1o.js').then(function (n) { return n.i; }));
|
||||
const importPostcssImport = createCachedImport(() => import('./dep-AiMcmC_f.js').then(function (n) { return n.i; }));
|
||||
const importPostcssModules = createCachedImport(() => import('./dep-SgSik2vo.js').then(function (n) { return n.i; }));
|
||||
const importPostcss = createCachedImport(() => import('postcss'));
|
||||
const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
|
||||
let alwaysFakeWorkerWorkerControllerCache;
|
||||
@@ -44076,23 +44154,23 @@ async function minifyCSS(css, config, inlined) {
|
||||
code: Buffer.from(css),
|
||||
minify: true
|
||||
});
|
||||
if (warnings.length) {
|
||||
const messages = warnings.map(
|
||||
(warning) => `${warning.message}
|
||||
` + generateCodeFrame(css, {
|
||||
line: warning.loc.line,
|
||||
column: warning.loc.column - 1
|
||||
// 1-based
|
||||
})
|
||||
);
|
||||
config.logger.warn(
|
||||
colors$1.yellow(`warnings when minifying css:
|
||||
${messages.join("\n")}`)
|
||||
);
|
||||
for (const warning of warnings) {
|
||||
let msg = `[lightningcss minify] ${warning.message}`;
|
||||
msg += `
|
||||
${generateCodeFrame(css, {
|
||||
line: warning.loc.line,
|
||||
column: warning.loc.column - 1
|
||||
// 1-based
|
||||
})}`;
|
||||
config.logger.warn(colors$1.yellow(msg));
|
||||
}
|
||||
return decoder.decode(code) + (inlined ? "" : "\n");
|
||||
} catch (e) {
|
||||
e.message = `[lightningcss minify] ${e.message}`;
|
||||
const friendlyMessage = getLightningCssErrorMessageForIeSyntaxes(css);
|
||||
if (friendlyMessage) {
|
||||
e.message += friendlyMessage;
|
||||
}
|
||||
if (e.loc) {
|
||||
e.loc = {
|
||||
line: e.loc.line,
|
||||
@@ -44113,7 +44191,7 @@ ${messages.join("\n")}`)
|
||||
if (warnings.length) {
|
||||
const msgs = await formatMessages(warnings, { kind: "warning" });
|
||||
config.logger.warn(
|
||||
colors$1.yellow(`warnings when minifying css:
|
||||
colors$1.yellow(`[esbuild css minify]
|
||||
${msgs.join("\n")}`)
|
||||
);
|
||||
}
|
||||
@@ -44999,11 +45077,9 @@ async function compileLightningCSS(environment, id, src, deps, workerController,
|
||||
};
|
||||
try {
|
||||
const code = fs__default.readFileSync(e.fileName, "utf-8");
|
||||
const commonIeMessage = ", which was used in the past to support old Internet Explorer versions. This is not a valid CSS syntax and will be ignored by modern browsers. \nWhile this is not supported by LightningCSS, you can set `css.lightningcss.errorRecovery: true` to strip these codes.";
|
||||
if (/[\s;{]\*[a-zA-Z-][\w-]+\s*:/.test(code)) {
|
||||
e.message += ".\nThis file contains star property hack (e.g. `*zoom`)" + commonIeMessage;
|
||||
} else if (/min-width:\s*0\\0/.test(code)) {
|
||||
e.message += ".\nThis file contains @media zero hack (e.g. `@media (min-width: 0\\0)`)" + commonIeMessage;
|
||||
const friendlyMessage = getLightningCssErrorMessageForIeSyntaxes(code);
|
||||
if (friendlyMessage) {
|
||||
e.message += friendlyMessage;
|
||||
}
|
||||
} catch {
|
||||
}
|
||||
@@ -45071,6 +45147,16 @@ ${generateCodeFrame(src, {
|
||||
modules
|
||||
};
|
||||
}
|
||||
function getLightningCssErrorMessageForIeSyntaxes(code) {
|
||||
const commonIeMessage = ", which was used in the past to support old Internet Explorer versions. This is not a valid CSS syntax and will be ignored by modern browsers. \nWhile this is not supported by LightningCSS, you can set `css.lightningcss.errorRecovery: true` to strip these codes.";
|
||||
if (/[\s;{]\*[a-zA-Z-][\w-]+\s*:/.test(code)) {
|
||||
return ".\nThis file contains star property hack (e.g. `*zoom`)" + commonIeMessage;
|
||||
}
|
||||
if (/min-width:\s*0\\0/.test(code)) {
|
||||
return ".\nThis file contains @media zero hack (e.g. `@media (min-width: 0\\0)`)" + commonIeMessage;
|
||||
}
|
||||
return void 0;
|
||||
}
|
||||
const map = {
|
||||
chrome: "chrome",
|
||||
edge: "edge",
|
||||
@@ -45381,19 +45467,11 @@ function buildImportAnalysisPlugin(config) {
|
||||
if (code.indexOf(isModernFlag) > -1) {
|
||||
const re = new RegExp(isModernFlag, "g");
|
||||
const isModern = String(format === "es");
|
||||
if (this.environment.config.build.sourcemap) {
|
||||
const s = new MagicString(code);
|
||||
let match;
|
||||
while (match = re.exec(code)) {
|
||||
s.update(match.index, match.index + isModernFlag.length, isModern);
|
||||
}
|
||||
return {
|
||||
code: s.toString(),
|
||||
map: s.generateMap({ hires: "boundary" })
|
||||
};
|
||||
} else {
|
||||
return code.replace(re, isModern);
|
||||
}
|
||||
const isModernWithPadding = isModern + " ".repeat(isModernFlag.length - isModern.length);
|
||||
return {
|
||||
code: code.replace(re, isModernWithPadding),
|
||||
map: null
|
||||
};
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@@ -48244,7 +48322,7 @@ async function preview(inlineConfig = {}) {
|
||||
config
|
||||
);
|
||||
if (options.open) {
|
||||
const url = getServerUrlByHost(server, options.host);
|
||||
const url = getServerUrlByHost(server.resolvedUrls, options.host);
|
||||
if (url) {
|
||||
const path2 = typeof options.open === "string" ? new URL(options.open, url).href : url;
|
||||
openBrowser(path2, true, logger);
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Q as commonjsGlobal, P as getDefaultExportFromCjs } from './dep-Bxmd1Uxj.js';
|
||||
import { Q as commonjsGlobal, P as getDefaultExportFromCjs } from './dep-DBxKXgDP.js';
|
||||
import require$$0$2 from 'fs';
|
||||
import require$$0 from 'postcss';
|
||||
import require$$0$1 from 'path';
|
||||
Reference in New Issue
Block a user