Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
bskimball authored Dec 10, 2024
2 parents 4695cbe + 0d1eab5 commit 5612101
Show file tree
Hide file tree
Showing 65 changed files with 539 additions and 223 deletions.
5 changes: 5 additions & 0 deletions .changeset/blue-spiders-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixes a bug where MDX files with certain characters in the name would cause builds to fail
5 changes: 0 additions & 5 deletions .changeset/bright-gifts-prove.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/famous-teachers-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fix a bug that caused builds to fail if an image had a quote mark in its name
6 changes: 6 additions & 0 deletions .changeset/fast-adults-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@astrojs/markdoc': patch
'astro': patch
---

Fixes a bug where the experimental feature `experimental.svg` was incorrectly used when generating ESM images
5 changes: 5 additions & 0 deletions .changeset/green-coins-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/vue': patch
---

fix vite peer dependency issue for vue integration
5 changes: 0 additions & 5 deletions .changeset/ten-moons-brake.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/twelve-pens-remain.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/unlucky-wasps-refuse.md

This file was deleted.

2 changes: 1 addition & 1 deletion examples/basics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^5.0.3"
"astro": "^5.0.4"
}
}
4 changes: 2 additions & 2 deletions examples/blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/mdx": "^4.0.1",
"@astrojs/mdx": "^4.0.2",
"@astrojs/rss": "^4.0.10",
"@astrojs/sitemap": "^3.2.1",
"astro": "^5.0.3"
"astro": "^5.0.4"
}
}
2 changes: 1 addition & 1 deletion examples/component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
"astro": "^5.0.3"
"astro": "^5.0.4"
},
"peerDependencies": {
"astro": "^4.0.0 || ^5.0.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/container-with-vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/react": "^4.0.0",
"astro": "^5.0.3",
"astro": "^5.0.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"vitest": "^2.1.6"
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-alpine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"@astrojs/alpinejs": "^0.4.0",
"@types/alpinejs": "^3.13.10",
"alpinejs": "^3.14.3",
"astro": "^5.0.3"
"astro": "^5.0.4"
}
}
2 changes: 1 addition & 1 deletion examples/framework-multiple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@astrojs/vue": "^5.0.1",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"astro": "^5.0.3",
"astro": "^5.0.4",
"preact": "^10.24.3",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dependencies": {
"@astrojs/preact": "^4.0.0",
"@preact/signals": "^1.3.0",
"astro": "^5.0.3",
"astro": "^5.0.4",
"preact": "^10.24.3"
}
}
2 changes: 1 addition & 1 deletion examples/framework-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@astrojs/react": "^4.0.0",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"astro": "^5.0.3",
"astro": "^5.0.4",
"react": "^18.3.1",
"react-dom": "^18.3.1"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@astrojs/solid-js": "^5.0.0",
"astro": "^5.0.3",
"astro": "^5.0.4",
"solid-js": "^1.9.3"
}
}
2 changes: 1 addition & 1 deletion examples/framework-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@astrojs/svelte": "^7.0.1",
"astro": "^5.0.3",
"astro": "^5.0.4",
"svelte": "^5.1.16"
}
}
2 changes: 1 addition & 1 deletion examples/framework-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@astrojs/vue": "^5.0.1",
"astro": "^5.0.3",
"astro": "^5.0.4",
"vue": "^3.5.12"
}
}
2 changes: 1 addition & 1 deletion examples/hackernews/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
},
"dependencies": {
"@astrojs/node": "^9.0.0",
"astro": "^5.0.3"
"astro": "^5.0.4"
}
}
2 changes: 1 addition & 1 deletion examples/integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
"astro": "^5.0.3"
"astro": "^5.0.4"
},
"peerDependencies": {
"astro": "^4.0.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/minimal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^5.0.3"
"astro": "^5.0.4"
}
}
2 changes: 1 addition & 1 deletion examples/portfolio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^5.0.3"
"astro": "^5.0.4"
}
}
2 changes: 1 addition & 1 deletion examples/ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/node": "^9.0.0",
"@astrojs/svelte": "^7.0.1",
"astro": "^5.0.3",
"astro": "^5.0.4",
"svelte": "^5.1.16"
}
}
2 changes: 1 addition & 1 deletion examples/starlog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^5.0.3",
"astro": "^5.0.4",
"sass": "^1.80.6",
"sharp": "^0.33.3"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/toolbar-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"./app": "./dist/app.js"
},
"devDependencies": {
"astro": "^5.0.3"
"astro": "^5.0.4"
}
}
4 changes: 2 additions & 2 deletions examples/with-markdoc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/markdoc": "^0.12.1",
"astro": "^5.0.3"
"@astrojs/markdoc": "^0.12.2",
"astro": "^5.0.4"
}
}
4 changes: 2 additions & 2 deletions examples/with-mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/mdx": "^4.0.1",
"@astrojs/mdx": "^4.0.2",
"@astrojs/preact": "^4.0.0",
"astro": "^5.0.3",
"astro": "^5.0.4",
"preact": "^10.24.3"
}
}
2 changes: 1 addition & 1 deletion examples/with-nanostores/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dependencies": {
"@astrojs/preact": "^4.0.0",
"@nanostores/preact": "^0.5.2",
"astro": "^5.0.3",
"astro": "^5.0.4",
"nanostores": "^0.11.3",
"preact": "^10.24.3"
}
Expand Down
4 changes: 2 additions & 2 deletions examples/with-tailwindcss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/mdx": "^4.0.1",
"@astrojs/mdx": "^4.0.2",
"@astrojs/tailwind": "^5.1.3",
"@types/canvas-confetti": "^1.6.4",
"astro": "^5.0.3",
"astro": "^5.0.4",
"autoprefixer": "^10.4.20",
"canvas-confetti": "^1.9.3",
"postcss": "^8.4.49",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"test": "vitest"
},
"dependencies": {
"astro": "^5.0.3",
"astro": "^5.0.4",
"vitest": "^2.1.6"
}
}
13 changes: 13 additions & 0 deletions packages/astro/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# astro

## 5.0.4

### Patch Changes

- [#12653](https://github.com/withastro/astro/pull/12653) [`e21c7e6`](https://github.com/withastro/astro/commit/e21c7e67fde1155cf593fd2b40010c5e2c2cd3f2) Thanks [@sarah11918](https://github.com/sarah11918)! - Updates a reference in an error message

- [#12585](https://github.com/withastro/astro/pull/12585) [`a9373c0`](https://github.com/withastro/astro/commit/a9373c0c9a3c2e1773fc11bb14e156698b0d9d38) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where `process.env` would be frozen despite changes made to environment variables in development

- [#12695](https://github.com/withastro/astro/pull/12695) [`a203d5d`](https://github.com/withastro/astro/commit/a203d5dd582166674c45e807a5dc9113e26e24f0) Thanks [@ascorbic](https://github.com/ascorbic)! - Throws a more helpful error when images are missing

- Updated dependencies [[`f13417b`](https://github.com/withastro/astro/commit/f13417bfbf73130c224752379e2da33084f89554), [`87231b1`](https://github.com/withastro/astro/commit/87231b1168da66bb593f681206c42fa555dfcabc), [`a71e9b9`](https://github.com/withastro/astro/commit/a71e9b93b317edc0ded49d4d50f1b7841c8cd428)]:
- @astrojs/[email protected]

## 5.0.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "astro",
"version": "5.0.3",
"version": "5.0.4",
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
"type": "module",
"author": "withastro",
Expand Down
4 changes: 3 additions & 1 deletion packages/astro/src/assets/utils/node/emitAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export async function emitESMImage(
_watchMode: boolean,
// FIX: in Astro 6, this function should not be passed in dev mode at all.
// Or rethink the API so that a function that throws isn't passed through.
experimentalSvgEnabled: boolean,
fileEmitter?: FileEmitter,
): Promise<ImageMetadataWithContents | undefined> {
if (!id) {
Expand Down Expand Up @@ -44,7 +45,8 @@ export async function emitESMImage(
});

// Attach file data for SVGs
if (fileMetadata.format === 'svg') {
// TODO: this is a workaround to prevent a memory leak, and it must be fixed before we remove the experimental flag, see
if (fileMetadata.format === 'svg' && experimentalSvgEnabled === true) {
emittedImage.contents = fileData;
}

Expand Down
7 changes: 6 additions & 1 deletion packages/astro/src/assets/vite-plugin-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,12 @@ export default function assets({ settings }: { settings: AstroSettings }): vite.
}

const emitFile = shouldEmitFile ? this.emitFile : undefined;
const imageMetadata = await emitESMImage(id, this.meta.watchMode, emitFile);
const imageMetadata = await emitESMImage(
id,
this.meta.watchMode,
!!settings.config.experimental.svg,
emitFile,
);

if (!imageMetadata) {
throw new AstroError({
Expand Down
1 change: 0 additions & 1 deletion packages/astro/src/container/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ function createManifest(
i18n: manifest?.i18n,
checkOrigin: false,
middleware: manifest?.middleware ?? middlewareInstance,
envGetSecretEnabled: false,
key: createKey(),
};
}
Expand Down
1 change: 1 addition & 0 deletions packages/astro/src/content/content-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ export class ContentLayer {
},
collectionWithResolvedSchema,
false,
!!this.#settings.config.experimental.svg,
);

return parsedData;
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/content/mutable-data-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class MutableDataStore extends ImmutableDataStore {
const exports: Array<string> = [];
this.#assetImports.forEach((id) => {
const symbol = importIdToSymbolName(id);
imports.push(`import ${symbol} from '${id}';`);
imports.push(`import ${symbol} from ${JSON.stringify(id)};`);
exports.push(`[${JSON.stringify(id)}, ${symbol}]`);
});
const code = /* js */ `
Expand Down Expand Up @@ -137,7 +137,7 @@ export default new Map([${exports.join(', ')}]);
// We then export them all, mapped by the import id, so we can find them again in the build.
const lines: Array<string> = [];
for (const [fileName, specifier] of this.#moduleImports) {
lines.push(`['${fileName}', () => import('${specifier}')]`);
lines.push(`[${JSON.stringify(fileName)}, () => import(${JSON.stringify(specifier)})]`);
}
const code = `
export default new Map([\n${lines.join(',\n')}]);
Expand Down
2 changes: 2 additions & 0 deletions packages/astro/src/content/runtime-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ export function createImage(
pluginContext: PluginContext,
shouldEmitFile: boolean,
entryFilePath: string,
experimentalSvgEnabled: boolean,
) {
return () => {
return z.string().transform(async (imagePath, ctx) => {
const resolvedFilePath = (await pluginContext.resolve(imagePath, entryFilePath))?.id;
const metadata = (await emitESMImage(
resolvedFilePath,
pluginContext.meta.watchMode,
experimentalSvgEnabled,
shouldEmitFile ? pluginContext.emitFile : undefined,
)) as OmitBrand<ImageMetadata>;

Expand Down
Loading

0 comments on commit 5612101

Please sign in to comment.