From 02e66e69b641676cd80d875f8a63ab16f9a55378 Mon Sep 17 00:00:00 2001 From: Princesseuh Date: Fri, 24 Mar 2023 10:40:14 +0100 Subject: [PATCH 1/6] fix(images): Fix images having the wrong path when using `base` --- packages/astro/src/assets/internal.ts | 12 +++++++++++- packages/astro/src/assets/vite-plugin-assets.ts | 8 ++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/astro/src/assets/internal.ts b/packages/astro/src/assets/internal.ts index 954347e1be4e..0c2ef5445d74 100644 --- a/packages/astro/src/assets/internal.ts +++ b/packages/astro/src/assets/internal.ts @@ -1,6 +1,8 @@ import fs from 'node:fs'; +import { basename, join } from 'node:path'; import type { StaticBuildOptions } from '../core/build/types.js'; import { AstroError, AstroErrorData } from '../core/errors/index.js'; +import { prependForwardSlash } from '../core/path.js'; import { isLocalService, type ImageService, type LocalImageService } from './services/service.js'; import type { ImageMetadata, ImageTransform } from './types.js'; @@ -104,7 +106,15 @@ export async function generateImage( clientRoot = buildOpts.settings.config.outDir; } - const fileData = await fs.promises.readFile(new URL('.' + options.src.src, serverRoot)); + const fileData = await fs.promises.readFile( + new URL( + '.' + + prependForwardSlash( + join(buildOpts.settings.config.build.assets, basename(options.src.src)) + ), + serverRoot + ) + ); const resultData = await imageService.transform(fileData, { ...options, src: options.src.src }); const finalFileURL = new URL('.' + filepath, clientRoot); diff --git a/packages/astro/src/assets/vite-plugin-assets.ts b/packages/astro/src/assets/vite-plugin-assets.ts index 638fa91499d7..b42d71487410 100644 --- a/packages/astro/src/assets/vite-plugin-assets.ts +++ b/packages/astro/src/assets/vite-plugin-assets.ts @@ -167,16 +167,12 @@ export default function assets({ } filePath = prependForwardSlash( - joinPaths( - settings.config.base, - settings.config.build.assets, - propsToFilename(options) - ) + joinPaths(settings.config.build.assets, propsToFilename(options)) ); globalThis.astroAsset.staticImages.set(options, filePath); } - return filePath; + return prependForwardSlash(joinPaths(settings.config.base, filePath)); }; }, async buildEnd() { From 554e6b7a3b6f9b7fe29ef0afac04554e68653f5b Mon Sep 17 00:00:00 2001 From: Princesseuh Date: Fri, 24 Mar 2023 10:40:30 +0100 Subject: [PATCH 2/6] test(images): Add test for using images with base --- packages/astro/test/core-image.test.js | 21 +++++++++++ .../fixtures/core-image-base/package.json | 11 ++++++ .../core-image-base/src/assets/penguin1.jpg | Bin 0 -> 12013 bytes .../core-image-base/src/assets/penguin2.jpg | Bin 0 -> 12978 bytes .../core-image-base/src/content/blog/one.md | 10 ++++++ .../core-image-base/src/content/config.ts | 15 ++++++++ .../core-image-base/src/pages/alias.astro | 5 +++ .../src/pages/aliasMarkdown.md | 3 ++ .../src/pages/blog/[...slug].astro | 33 ++++++++++++++++++ .../core-image-base/src/pages/format.astro | 18 ++++++++++ .../core-image-base/src/pages/get-image.astro | 8 +++++ .../core-image-base/src/pages/index.astro | 18 ++++++++++ .../core-image-base/src/pages/post.md | 3 ++ .../core-image-base/src/pages/quality.astro | 22 ++++++++++++ pnpm-lock.yaml | 6 ++++ 15 files changed, 173 insertions(+) create mode 100644 packages/astro/test/fixtures/core-image-base/package.json create mode 100644 packages/astro/test/fixtures/core-image-base/src/assets/penguin1.jpg create mode 100644 packages/astro/test/fixtures/core-image-base/src/assets/penguin2.jpg create mode 100644 packages/astro/test/fixtures/core-image-base/src/content/blog/one.md create mode 100644 packages/astro/test/fixtures/core-image-base/src/content/config.ts create mode 100644 packages/astro/test/fixtures/core-image-base/src/pages/alias.astro create mode 100644 packages/astro/test/fixtures/core-image-base/src/pages/aliasMarkdown.md create mode 100644 packages/astro/test/fixtures/core-image-base/src/pages/blog/[...slug].astro create mode 100644 packages/astro/test/fixtures/core-image-base/src/pages/format.astro create mode 100644 packages/astro/test/fixtures/core-image-base/src/pages/get-image.astro create mode 100644 packages/astro/test/fixtures/core-image-base/src/pages/index.astro create mode 100644 packages/astro/test/fixtures/core-image-base/src/pages/post.md create mode 100644 packages/astro/test/fixtures/core-image-base/src/pages/quality.astro diff --git a/packages/astro/test/core-image.test.js b/packages/astro/test/core-image.test.js index ccbd5b2f83ff..deeb343a8462 100644 --- a/packages/astro/test/core-image.test.js +++ b/packages/astro/test/core-image.test.js @@ -292,6 +292,27 @@ describe('astro:image', () => { }); }); + describe('support base option correctly', () => { + before(async () => { + fixture = await loadFixture({ + root: './fixtures/core-image-base/', + experimental: { + assets: true, + }, + base: '/blog', + }); + await fixture.build(); + }); + + it('has base path prefix', async () => { + const html = await fixture.readFile('/index.html'); + const $ = cheerio.load(html); + const src = $('#local img').attr('src'); + expect(src.length).to.be.greaterThan(0); + expect(src.startsWith('/blog')).to.be.true; + }); + }); + describe('build ssg', () => { before(async () => { fixture = await loadFixture({ diff --git a/packages/astro/test/fixtures/core-image-base/package.json b/packages/astro/test/fixtures/core-image-base/package.json new file mode 100644 index 000000000000..5400b7028966 --- /dev/null +++ b/packages/astro/test/fixtures/core-image-base/package.json @@ -0,0 +1,11 @@ +{ + "name": "@test/core-image-ssg", + "version": "0.0.0", + "private": true, + "dependencies": { + "astro": "workspace:*" + }, + "exports": { + "./service": "./src/service.ts" + } +} diff --git a/packages/astro/test/fixtures/core-image-base/src/assets/penguin1.jpg b/packages/astro/test/fixtures/core-image-base/src/assets/penguin1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6c5dcd37a30a6c9da324b15932349f06a275539b GIT binary patch literal 12013 zcmZ`cYCw9bF*@@vrmgpYXD+ZMHNK=5C{MO{|&$s3h)Vli-k==K~6hPIu<%+9xxLV2R+TR=OV1!ye|X=1)s5qLBs@J^9TsO z0OH}{5fKv6laSEA;$-0v5D*X&68cAl|IPowf0qB*`G4@#3n0M;oB<}$fh+(t5+FJW z@Tng_3jm;@q5o6z|9}oc!vFv=vHmfoi2-OpbaXTfG>m@)9SsWrL?Z#9GlNJ4WVA8J zSS;N`lQ9Kli<-bXedK?I-h2F9rwB_aKEaaHwQBx0{Z9f75P%N+&qMqlfN1Cd5XL_i zAIZO)|64jb#{VApC!HCcQ~)HS&Eif*E@)X4n%pO=)AaKM;|U4C|EDDy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)@EC5l9JA1bd@_T-TR2eytCCmaDG zMoff}xzpC}ffwUvV)7RZ#e-Ud0;pX>+veu(I>s_O&)=c#19~4T-&e5zYgW5=;^y>z zSIGZ6s(a>l?j>W(8{yzGonL8W$LVzjhKVoEedJk8nK#_I?^0!+eMSZ;k&z_M92yy! xv{@UNqkoY8K^7|1E+0O8Ybax<8bJ{g<`c@Q$z~{{sKVznK64 literal 0 HcmV?d00001 diff --git a/packages/astro/test/fixtures/core-image-base/src/assets/penguin2.jpg b/packages/astro/test/fixtures/core-image-base/src/assets/penguin2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..db6c44709142150cb722a0a24469fd95577c69b3 GIT binary patch literal 12978 zcmbWd2T)VN_ck1ggeFBrDWN7xM~akCMWiYqy(1k#T0-wlK`{hE2LnNRSClFsASHlE zklsN8gwQ+EUw*&;%>SMFX1P^xHtg-+S&jC002MLnFj3if`0M6?k-5~j|{P(l#jD(bo{00S(l8Tz< zxqPshPRGgQJu4D;HO9A74NJ zfWV;WH*aHN-@T7ZN=`{lOV7y6%F8b(EGjN3E&KYdrnauWq4E3Aj?S)bY)^0B(D2CU z*!aZc)Zaz?(((#nmAJOMw|{VWbo}q+^gp<+$Mb(+UFZLU?Eis_@fsH?IXM|Q@ISan zNd5l^6^hB;}nas87}HRA34H9VR>YAL_f1M}P0{{s-EBk^O%I z7WMxN+5ZCjzqqCWDgbIAB@@$~drVAB%=hlGu!2}wS((|uAZ`$torR5y6$Ih|aSMUD zxcJzwhhGvRDEv@dT%46hMnOhQUPw&*;nj5`Bs4TM^mO#>jEwBE{5*VOVqy{!64&{o z>+65yKac-;^Zz1Ov)9Y==G7E{mWlmM&d3I*seUm-WY=(aL`xK+>I1cThc z`P$UaiyaDupcfc8>jnVNf~|5*^{m%0M4;jFY3$dXD2*5)gx&m?(3YFWB?mSml8p}h@U>3Xi z$v_K<*g9wtdFi7FKqHMYxUuKt-KmM3|03TA{b$vsv5GMBoL#s0MM) z0mR2rHpEQ;-QG6z!Q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~5b5M~To?GGIew%L5>E~Xs(Fc);<0+lclazR@TkHsR{*^$0IBQW%IXR~p{I?! zPKa3r87f#5i=iS*P{xhDe z@T3nfzXC*tYfVaS>iyHhDooO53*KLGzYc}E0_2X>WDBzV*j@-fU^NOO>F_fQq)!Xn zP)arm*3A&vf=4T!S3bW2tl|nTL)qAB;`r^yqRv9l7mb^zMt|tEvs>2?o literal 0 HcmV?d00001 diff --git a/packages/astro/test/fixtures/core-image-base/src/content/blog/one.md b/packages/astro/test/fixtures/core-image-base/src/content/blog/one.md new file mode 100644 index 000000000000..88a210b75504 --- /dev/null +++ b/packages/astro/test/fixtures/core-image-base/src/content/blog/one.md @@ -0,0 +1,10 @@ +--- +title: One +image: penguin2.jpg +cover: + image: penguin1.jpg +--- + +# A post + +text here diff --git a/packages/astro/test/fixtures/core-image-base/src/content/config.ts b/packages/astro/test/fixtures/core-image-base/src/content/config.ts new file mode 100644 index 000000000000..b38ad070e100 --- /dev/null +++ b/packages/astro/test/fixtures/core-image-base/src/content/config.ts @@ -0,0 +1,15 @@ +import { defineCollection, image, z } from "astro:content"; + +const blogCollection = defineCollection({ + schema: z.object({ + title: z.string(), + image: image(), + cover: z.object({ + image: image() + }) + }), +}); + +export const collections = { + blog: blogCollection +}; diff --git a/packages/astro/test/fixtures/core-image-base/src/pages/alias.astro b/packages/astro/test/fixtures/core-image-base/src/pages/alias.astro new file mode 100644 index 000000000000..10990dbe3e9b --- /dev/null +++ b/packages/astro/test/fixtures/core-image-base/src/pages/alias.astro @@ -0,0 +1,5 @@ +--- +import image from "~/assets/penguin1.jpg"; +--- + +A penguin! diff --git a/packages/astro/test/fixtures/core-image-base/src/pages/aliasMarkdown.md b/packages/astro/test/fixtures/core-image-base/src/pages/aliasMarkdown.md new file mode 100644 index 000000000000..048a79bdd5cf --- /dev/null +++ b/packages/astro/test/fixtures/core-image-base/src/pages/aliasMarkdown.md @@ -0,0 +1,3 @@ +![A penguin](~/assets/penguin1.jpg) + +A penguin diff --git a/packages/astro/test/fixtures/core-image-base/src/pages/blog/[...slug].astro b/packages/astro/test/fixtures/core-image-base/src/pages/blog/[...slug].astro new file mode 100644 index 000000000000..dc25493e854a --- /dev/null +++ b/packages/astro/test/fixtures/core-image-base/src/pages/blog/[...slug].astro @@ -0,0 +1,33 @@ +--- +import { getImage } from 'astro:assets'; +import { getCollection } from 'astro:content'; + +export async function getStaticPaths() { + const blogEntries = await getCollection('blog'); + return blogEntries.map(entry => ({ + params: { slug: entry.slug }, props: { entry }, + })); +} + +const { entry } = Astro.props; +const { Content } = await entry.render(); +const myImage = await getImage(entry.data.image); +--- + + + Testing + + +

Testing

+ +
+ +
+ +
+ +
+ + + + diff --git a/packages/astro/test/fixtures/core-image-base/src/pages/format.astro b/packages/astro/test/fixtures/core-image-base/src/pages/format.astro new file mode 100644 index 000000000000..d2b165d892b5 --- /dev/null +++ b/packages/astro/test/fixtures/core-image-base/src/pages/format.astro @@ -0,0 +1,18 @@ +--- +import { Image } from 'astro:assets'; +import myImage from "../assets/penguin1.jpg"; +--- + + + + + +
+ a penguin +
+ +
+ a penguin +
+ + diff --git a/packages/astro/test/fixtures/core-image-base/src/pages/get-image.astro b/packages/astro/test/fixtures/core-image-base/src/pages/get-image.astro new file mode 100644 index 000000000000..d83b1fd8ee78 --- /dev/null +++ b/packages/astro/test/fixtures/core-image-base/src/pages/get-image.astro @@ -0,0 +1,8 @@ +--- +import { getImage } from "astro:assets"; +import image from "../assets/penguin2.jpg"; + +const myImage = await getImage({ src: image, width: 207, height: 243, alt: 'a penguin' }); +--- + + diff --git a/packages/astro/test/fixtures/core-image-base/src/pages/index.astro b/packages/astro/test/fixtures/core-image-base/src/pages/index.astro new file mode 100644 index 000000000000..d7f9b05519a5 --- /dev/null +++ b/packages/astro/test/fixtures/core-image-base/src/pages/index.astro @@ -0,0 +1,18 @@ +--- +import { Image } from 'astro:assets'; +import myImage from "../assets/penguin1.jpg"; +--- + + + + + +
+ a penguin +
+ +
+ fred +
+ + diff --git a/packages/astro/test/fixtures/core-image-base/src/pages/post.md b/packages/astro/test/fixtures/core-image-base/src/pages/post.md new file mode 100644 index 000000000000..98da01ce41b2 --- /dev/null +++ b/packages/astro/test/fixtures/core-image-base/src/pages/post.md @@ -0,0 +1,3 @@ +![My article cover](../assets/penguin1.jpg) + +Image worked diff --git a/packages/astro/test/fixtures/core-image-base/src/pages/quality.astro b/packages/astro/test/fixtures/core-image-base/src/pages/quality.astro new file mode 100644 index 000000000000..706bb6766934 --- /dev/null +++ b/packages/astro/test/fixtures/core-image-base/src/pages/quality.astro @@ -0,0 +1,22 @@ +--- +import { Image } from 'astro:assets'; +import myImage from "../assets/penguin1.jpg"; +--- + + + + + +
+ a penguin +
+ +
+ a penguin +
+ +
+ a penguin +
+ + diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cca8e5611d96..ea922a0c26dd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1869,6 +1869,12 @@ importers: dependencies: astro: link:../../.. + packages/astro/test/fixtures/core-image-base: + specifiers: + astro: workspace:* + dependencies: + astro: link:../../.. + packages/astro/test/fixtures/core-image-ssg: specifiers: astro: workspace:* From c1e1d7f820e3331126fbddc7f8b3ffbdeb400250 Mon Sep 17 00:00:00 2001 From: Princesseuh Date: Fri, 24 Mar 2023 11:05:36 +0100 Subject: [PATCH 3/6] test: add more tests --- packages/astro/test/core-image.test.js | 34 ++++++++++++++++++- .../core-image-base/src/pages/direct.astro | 5 +++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 packages/astro/test/fixtures/core-image-base/src/pages/direct.astro diff --git a/packages/astro/test/core-image.test.js b/packages/astro/test/core-image.test.js index deeb343a8462..997c9c10d99d 100644 --- a/packages/astro/test/core-image.test.js +++ b/packages/astro/test/core-image.test.js @@ -304,13 +304,45 @@ describe('astro:image', () => { await fixture.build(); }); - it('has base path prefix', async () => { + it('has base path prefix when using the Image component', async () => { const html = await fixture.readFile('/index.html'); const $ = cheerio.load(html); const src = $('#local img').attr('src'); expect(src.length).to.be.greaterThan(0); expect(src.startsWith('/blog')).to.be.true; }); + + it('has base path prefix when using getImage', async () => { + const html = await fixture.readFile('/get-image/index.html'); + const $ = cheerio.load(html); + const src = $('img').attr('src'); + expect(src.length).to.be.greaterThan(0); + expect(src.startsWith('/blog')).to.be.true; + }); + + it('has base path prefix when using image directly', async () => { + const html = await fixture.readFile('/direct/index.html'); + const $ = cheerio.load(html); + const src = $('img').attr('src'); + expect(src.length).to.be.greaterThan(0); + expect(src.startsWith('/blog')).to.be.true; + }); + + it('has base path prefix in Markdown', async () => { + const html = await fixture.readFile('/post/index.html'); + const $ = cheerio.load(html); + const src = $('img').attr('src'); + expect(src.length).to.be.greaterThan(0); + expect(src.startsWith('/blog')).to.be.true; + }); + + it('has base path prefix in Content Collection frontmatter', async () => { + const html = await fixture.readFile('/blog/one/index.html'); + const $ = cheerio.load(html); + const src = $('img').attr('src'); + expect(src.length).to.be.greaterThan(0); + expect(src.startsWith('/blog')).to.be.true; + }); }); describe('build ssg', () => { diff --git a/packages/astro/test/fixtures/core-image-base/src/pages/direct.astro b/packages/astro/test/fixtures/core-image-base/src/pages/direct.astro new file mode 100644 index 000000000000..10990dbe3e9b --- /dev/null +++ b/packages/astro/test/fixtures/core-image-base/src/pages/direct.astro @@ -0,0 +1,5 @@ +--- +import image from "~/assets/penguin1.jpg"; +--- + +A penguin! From 03f2167796e6557664e46206c885ee726860bf61 Mon Sep 17 00:00:00 2001 From: Princesseuh Date: Fri, 24 Mar 2023 11:13:57 +0100 Subject: [PATCH 4/6] chore: changeset --- .changeset/thick-penguins-turn.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/thick-penguins-turn.md diff --git a/.changeset/thick-penguins-turn.md b/.changeset/thick-penguins-turn.md new file mode 100644 index 000000000000..7ee77abfaedc --- /dev/null +++ b/.changeset/thick-penguins-turn.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix images not having the proper path when using `base` From d11b4d8beff3a01ba0f812679b0fc7095228b355 Mon Sep 17 00:00:00 2001 From: Princesseuh Date: Fri, 24 Mar 2023 11:37:28 +0100 Subject: [PATCH 5/6] fix: paths --- .../test/fixtures/core-image-base/src/content/blog/one.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/astro/test/fixtures/core-image-base/src/content/blog/one.md b/packages/astro/test/fixtures/core-image-base/src/content/blog/one.md index 88a210b75504..59a5b77baf03 100644 --- a/packages/astro/test/fixtures/core-image-base/src/content/blog/one.md +++ b/packages/astro/test/fixtures/core-image-base/src/content/blog/one.md @@ -1,8 +1,8 @@ --- title: One -image: penguin2.jpg +image: ~/assets/penguin2.jpg cover: - image: penguin1.jpg + image: ../../assets/penguin1.jpg --- # A post From 32b6a8b84e5425a34edcc2208f0a7df177e11c25 Mon Sep 17 00:00:00 2001 From: Princesseuh Date: Fri, 24 Mar 2023 17:19:16 +0100 Subject: [PATCH 6/6] refactor: feedback --- packages/astro/src/assets/internal.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/astro/src/assets/internal.ts b/packages/astro/src/assets/internal.ts index 0c2ef5445d74..db02b1ea18ec 100644 --- a/packages/astro/src/assets/internal.ts +++ b/packages/astro/src/assets/internal.ts @@ -1,5 +1,5 @@ import fs from 'node:fs'; -import { basename, join } from 'node:path'; +import { basename, join } from 'node:path/posix'; import type { StaticBuildOptions } from '../core/build/types.js'; import { AstroError, AstroErrorData } from '../core/errors/index.js'; import { prependForwardSlash } from '../core/path.js'; @@ -106,16 +106,19 @@ export async function generateImage( clientRoot = buildOpts.settings.config.outDir; } + // The original file's path (the `src` attribute of the ESM imported image passed by the user) + const originalImagePath = options.src.src; + const fileData = await fs.promises.readFile( new URL( '.' + prependForwardSlash( - join(buildOpts.settings.config.build.assets, basename(options.src.src)) + join(buildOpts.settings.config.build.assets, basename(originalImagePath)) ), serverRoot ) ); - const resultData = await imageService.transform(fileData, { ...options, src: options.src.src }); + const resultData = await imageService.transform(fileData, { ...options, src: originalImagePath }); const finalFileURL = new URL('.' + filepath, clientRoot); const finalFolderURL = new URL('./', finalFileURL);