Skip to content

Commit 8fd88d2

Browse files
committed
Update dependencies
1 parent 09a8456 commit 8fd88d2

10 files changed

Lines changed: 1359 additions & 2275 deletions

File tree

astro.config.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ const execFile = util.promisify(cp.execFile);
133133
const optimizeImagesIntegration: AstroIntegration = {
134134
name: "optimize-images",
135135
hooks: {
136-
async "astro:build:done"({ dir, routes }) {
136+
async "astro:build:done"({ dir, pages }) {
137137
type Resize = "" | "up" | "down";
138138
type Images = { original: string; webp: string[]; resize: Resize }[];
139139
type MatchGroups = {
@@ -143,17 +143,17 @@ const optimizeImagesIntegration: AstroIntegration = {
143143
postSrc: string;
144144
};
145145

146+
const distDir = nodeUrl.fileURLToPath(dir);
147+
const images: Images = [];
148+
146149
const resizeSuffixes = ["a", "b", "c", "d", "e"];
147150
const resizeUpMultipliers = [1, 1.5, 2, 3, 4];
148151
const resizeDownMultipliers = [0.25, 0.375, 0.5, 0.75, 1];
149-
const images: Images = [];
150152

151-
for (const route of routes) {
152-
if (!route.distURL) {
153-
continue;
154-
}
155-
156-
const htmlPath = nodeUrl.fileURLToPath(route.distURL);
153+
const htmlPaths = pages.map(({ pathname }) =>
154+
path.join(distDir, pathname, "index.html")
155+
);
156+
for (const htmlPath of htmlPaths) {
157157
let html = await fs.readFile(htmlPath, "utf-8");
158158
const matches = html.matchAll(
159159
/<img optimize-image resize="(?<resize>[a-z-]*)"(?<preSrc>.+)src="(?<src>[^"]+)"(?<postSrc>.+)>/g
@@ -192,7 +192,6 @@ const optimizeImagesIntegration: AstroIntegration = {
192192
await fs.writeFile(htmlPath, html, "utf-8");
193193
}
194194

195-
const distDir = nodeUrl.fileURLToPath(dir);
196195
const cacheDir = findCacheDirectory({
197196
name: "astro-optimize-images",
198197
create: true
@@ -427,7 +426,6 @@ const generateIdsPlugin: PluginOption = {
427426
export default <AstroUserConfig>{
428427
site: "https://mce.codes",
429428
devToolbar: { enabled: false },
430-
server: { host: true, port: 6001 },
431429
compressHTML: false,
432430
scopedStyleStrategy: "class",
433431
markdown: {

0 commit comments

Comments
 (0)