v1.0 with SW PWA enabled
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { C as getDefaultExportFromCjs } from './dep-C6uTJdX2.js';
|
||||
import { C as getDefaultExportFromCjs } from './dep-BK3b2jBa.js';
|
||||
import require$$0 from 'path';
|
||||
import require$$0__default from 'fs';
|
||||
import { l as lib } from './dep-IQS-Za7F.js';
|
||||
@ -263,83 +263,83 @@ pify$1.all = pify$1;
|
||||
|
||||
var pifyExports = pify$2.exports;
|
||||
|
||||
var fs = require$$0__default;
|
||||
var path$3 = require$$0;
|
||||
var pify = pifyExports;
|
||||
|
||||
var stat = pify(fs.stat);
|
||||
var readFile = pify(fs.readFile);
|
||||
var resolve = path$3.resolve;
|
||||
|
||||
var cache = Object.create(null);
|
||||
|
||||
function convert(content, encoding) {
|
||||
if (Buffer.isEncoding(encoding)) {
|
||||
return content.toString(encoding);
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
readCache$1.exports = function (path, encoding) {
|
||||
path = resolve(path);
|
||||
|
||||
return stat(path).then(function (stats) {
|
||||
var item = cache[path];
|
||||
|
||||
if (item && item.mtime.getTime() === stats.mtime.getTime()) {
|
||||
return convert(item.content, encoding);
|
||||
}
|
||||
|
||||
return readFile(path).then(function (data) {
|
||||
cache[path] = {
|
||||
mtime: stats.mtime,
|
||||
content: data
|
||||
};
|
||||
|
||||
return convert(data, encoding);
|
||||
});
|
||||
}).catch(function (err) {
|
||||
cache[path] = null;
|
||||
return Promise.reject(err);
|
||||
});
|
||||
};
|
||||
|
||||
readCache$1.exports.sync = function (path, encoding) {
|
||||
path = resolve(path);
|
||||
|
||||
try {
|
||||
var stats = fs.statSync(path);
|
||||
var item = cache[path];
|
||||
|
||||
if (item && item.mtime.getTime() === stats.mtime.getTime()) {
|
||||
return convert(item.content, encoding);
|
||||
}
|
||||
|
||||
var data = fs.readFileSync(path);
|
||||
|
||||
cache[path] = {
|
||||
mtime: stats.mtime,
|
||||
content: data
|
||||
};
|
||||
|
||||
return convert(data, encoding);
|
||||
} catch (err) {
|
||||
cache[path] = null;
|
||||
throw err;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
readCache$1.exports.get = function (path, encoding) {
|
||||
path = resolve(path);
|
||||
if (cache[path]) {
|
||||
return convert(cache[path].content, encoding);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
readCache$1.exports.clear = function () {
|
||||
cache = Object.create(null);
|
||||
var fs = require$$0__default;
|
||||
var path$3 = require$$0;
|
||||
var pify = pifyExports;
|
||||
|
||||
var stat = pify(fs.stat);
|
||||
var readFile = pify(fs.readFile);
|
||||
var resolve = path$3.resolve;
|
||||
|
||||
var cache = Object.create(null);
|
||||
|
||||
function convert(content, encoding) {
|
||||
if (Buffer.isEncoding(encoding)) {
|
||||
return content.toString(encoding);
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
readCache$1.exports = function (path, encoding) {
|
||||
path = resolve(path);
|
||||
|
||||
return stat(path).then(function (stats) {
|
||||
var item = cache[path];
|
||||
|
||||
if (item && item.mtime.getTime() === stats.mtime.getTime()) {
|
||||
return convert(item.content, encoding);
|
||||
}
|
||||
|
||||
return readFile(path).then(function (data) {
|
||||
cache[path] = {
|
||||
mtime: stats.mtime,
|
||||
content: data
|
||||
};
|
||||
|
||||
return convert(data, encoding);
|
||||
});
|
||||
}).catch(function (err) {
|
||||
cache[path] = null;
|
||||
return Promise.reject(err);
|
||||
});
|
||||
};
|
||||
|
||||
readCache$1.exports.sync = function (path, encoding) {
|
||||
path = resolve(path);
|
||||
|
||||
try {
|
||||
var stats = fs.statSync(path);
|
||||
var item = cache[path];
|
||||
|
||||
if (item && item.mtime.getTime() === stats.mtime.getTime()) {
|
||||
return convert(item.content, encoding);
|
||||
}
|
||||
|
||||
var data = fs.readFileSync(path);
|
||||
|
||||
cache[path] = {
|
||||
mtime: stats.mtime,
|
||||
content: data
|
||||
};
|
||||
|
||||
return convert(data, encoding);
|
||||
} catch (err) {
|
||||
cache[path] = null;
|
||||
throw err;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
readCache$1.exports.get = function (path, encoding) {
|
||||
path = resolve(path);
|
||||
if (cache[path]) {
|
||||
return convert(cache[path].content, encoding);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
readCache$1.exports.clear = function () {
|
||||
cache = Object.create(null);
|
||||
};
|
||||
|
||||
var readCacheExports = readCache$1.exports;
|
||||
@ -36991,8 +36991,8 @@ function createCachedImport(imp) {
|
||||
return cached;
|
||||
};
|
||||
}
|
||||
const importPostcssImport = createCachedImport(() => import('./dep-COdkJwUb.js').then(function (n) { return n.i; }));
|
||||
const importPostcssModules = createCachedImport(() => import('./dep-CEGXe0Sr.js').then(function (n) { return n.i; }));
|
||||
const importPostcssImport = createCachedImport(() => import('./dep-BB45zftN.js').then(function (n) { return n.i; }));
|
||||
const importPostcssModules = createCachedImport(() => import('./dep-Dnp7gl8U.js').then(function (n) { return n.i; }));
|
||||
const importPostcss = createCachedImport(() => import('postcss'));
|
||||
const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
|
||||
let alwaysFakeWorkerWorkerControllerCache;
|
||||
@ -51568,7 +51568,7 @@ function sirv (dir, opts={}) {
|
||||
});
|
||||
}
|
||||
|
||||
let lookup = opts.dev ? viaLocal.bind(0, dir, isEtag) : viaCache.bind(0, FILES);
|
||||
let lookup = opts.dev ? viaLocal.bind(0, dir.endsWith(sep$1) ? dir : dir + sep$1, isEtag) : viaCache.bind(0, FILES);
|
||||
|
||||
return function (req, res, next) {
|
||||
let extns = [''];
|
||||
@ -51752,7 +51752,8 @@ function isUriInFilePath(uri, filePath) {
|
||||
function isFileLoadingAllowed(server, filePath) {
|
||||
const { fs } = server.config.server;
|
||||
if (!fs.strict) return true;
|
||||
if (server._fsDenyGlob(filePath)) return false;
|
||||
const filePathWithoutTrailingSlash = filePath.endsWith("/") ? filePath.slice(0, -1) : filePath;
|
||||
if (server._fsDenyGlob(filePathWithoutTrailingSlash)) return false;
|
||||
if (server.moduleGraph.safeModulesPath.has(filePath)) return true;
|
||||
if (fs.allow.some((uri) => isUriInFilePath(uri, filePath))) return true;
|
||||
return false;
|
||||
@ -62470,7 +62471,22 @@ function indexHtmlMiddleware(root, server) {
|
||||
if (isDev && url.startsWith(FS_PREFIX)) {
|
||||
filePath = decodeURIComponent(fsPathFromId(url));
|
||||
} else {
|
||||
filePath = path$n.join(root, decodeURIComponent(url));
|
||||
filePath = normalizePath$3(
|
||||
path$n.resolve(path$n.join(root, decodeURIComponent(url)))
|
||||
);
|
||||
}
|
||||
if (isDev) {
|
||||
const servingAccessResult = checkLoadingAccess(server, filePath);
|
||||
if (servingAccessResult === "denied") {
|
||||
return respondWithAccessDenied(filePath, server, res);
|
||||
}
|
||||
if (servingAccessResult === "fallback") {
|
||||
return next();
|
||||
}
|
||||
} else {
|
||||
if (!isParentDirectory(root, filePath)) {
|
||||
return next();
|
||||
}
|
||||
}
|
||||
if (fsUtils.existsSync(filePath)) {
|
||||
const headers = isDev ? server.config.server.headers : server.config.preview.headers;
|
||||
@ -66303,7 +66319,8 @@ async function preview(inlineConfig = {}) {
|
||||
}
|
||||
postHooks.forEach((fn) => fn && fn());
|
||||
if (config.appType === "spa" || config.appType === "mpa") {
|
||||
app.use(indexHtmlMiddleware(distDir, server));
|
||||
const normalizedDistDir = normalizePath$3(distDir);
|
||||
app.use(indexHtmlMiddleware(normalizedDistDir, server));
|
||||
app.use(notFoundMiddleware());
|
||||
}
|
||||
const hostname = await resolveHostname(options.host);
|
||||
@ -1,4 +1,4 @@
|
||||
import { D as commonjsGlobal, C as getDefaultExportFromCjs } from './dep-C6uTJdX2.js';
|
||||
import { D as commonjsGlobal, C as getDefaultExportFromCjs } from './dep-BK3b2jBa.js';
|
||||
import require$$0__default from 'fs';
|
||||
import require$$0 from 'postcss';
|
||||
import require$$0$1 from 'path';
|
||||
Reference in New Issue
Block a user