0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

Merge branch 'next' into feat/unflag-astro-env

This commit is contained in:
Florian Lefebvre 2024-08-13 14:27:55 +02:00 committed by GitHub
commit ff30bfb9f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 62 additions and 40 deletions

View file

@ -0,0 +1,5 @@
---
"astro": major
---
The lowest version of Node supported by Astro is now Node v18.17.1 and higher.

View file

@ -4,7 +4,7 @@
"commit": false,
"linked": [],
"access": "public",
"baseBranch": "main",
"baseBranch": "next",
"updateInternalDependencies": "patch",
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true

35
.changeset/pre.json Normal file
View file

@ -0,0 +1,35 @@
{
"mode": "pre",
"tag": "alpha",
"initialVersions": {
"astro": "4.13.1",
"@astrojs/prism": "3.1.0",
"@astrojs/rss": "4.0.7",
"create-astro": "4.8.1",
"@astrojs/db": "0.12.0",
"@astrojs/alpinejs": "0.4.0",
"@astrojs/cloudflare": "0.0.0",
"@astrojs/lit": "4.3.0",
"@astrojs/markdoc": "0.11.3",
"@astrojs/mdx": "3.1.3",
"@astrojs/netlify": "0.0.0",
"@astrojs/node": "8.3.2",
"@astrojs/partytown": "2.1.1",
"@astrojs/preact": "3.5.1",
"@astrojs/react": "3.6.1",
"@astrojs/sitemap": "3.1.6",
"@astrojs/solid-js": "4.4.0",
"@astrojs/svelte": "5.7.0",
"@astrojs/tailwind": "5.1.0",
"@astrojs/vercel": "7.7.2",
"@astrojs/vue": "4.5.0",
"@astrojs/web-vitals": "1.0.0",
"@astrojs/internal-helpers": "0.4.1",
"@astrojs/markdown-remark": "5.2.0",
"@astrojs/studio": "0.1.1",
"@astrojs/telemetry": "3.1.0",
"@astrojs/underscore-redirects": "0.3.4",
"@astrojs/upgrade": "0.3.1"
},
"changesets": []
}

View file

@ -0,0 +1,10 @@
---
'@astrojs/markdown-remark': major
---
Renames the following CSS variables theme color token names to better align with the Shiki v1 defaults:
- `--astro-code-color-text` => `--astro-code-foreground`
- `--astro-code-color-background` => `--astro-code-background`
You can perform a global find and replace in your project to migrate to the new token names.

View file

@ -369,20 +369,22 @@ Full documentation: https://github.com/changesets/changesets/blob/main/docs/prer
### Entering prerelease mode
If you have gotten permission from the core contributors, you can enter into prerelease mode by following the following steps:
If you have gotten permission from the core contributors, you can enter into prerelease mode with the following steps:
- Run: `pnpm exec changeset pre enter next` in the project root
- Update `.changeset/config.json` with `"baseBranch": "next"` (for easier changesets creation)
- Create a new PR from the changes created by this command
- Review, approve, and more the PR to enter prerelease mode.
- Review, approve, and merge the PR to enter prerelease mode.
- If successful, The "[ci] release" PR (if one exists) will now say "[ci] release (next)".
### Exiting prerelease mode
Exiting prerelease mode should happen once an experimental release is ready to go from `npm install astro@next` to `npm install astro`. Only a core contributor run these steps. These steps should be run before
Exiting prerelease mode should happen once an experimental release is ready to go from `npm install astro@next` to `npm install astro`. Only a core contributor can run these steps:
- Run: `pnpm exec changeset pre exit` in the project root
- Update `.changeset/config.json` with `"baseBranch": "main"`
- Create a new PR from the changes created by this command.
- Review, approve, and more the PR to enter prerelease mode.
- Review, approve, and merge the PR to enter prerelease mode.
- If successful, The "[ci] release (next)" PR (if one exists) will now say "[ci] release".
### Releasing `astro@latest` while in prerelease mode

View file

@ -12,7 +12,7 @@ const CI_INSTRUCTIONS = {
};
// Hardcode supported Node.js version so we don't have to read differently in CJS & ESM.
const engines = '>=18.14.1';
const engines = '>=18.17.1';
const skipSemverCheckIfAbove = 19;
/** `astro *` */

View file

@ -88,13 +88,13 @@ describe('<Code>', () => {
.map((i, f) => (f.attribs ? f.attribs.style : 'no style found'))
.toArray(),
[
'background-color:var(--astro-code-color-background);color:var(--astro-code-color-text); overflow-x: auto;',
'background-color:var(--astro-code-background);color:var(--astro-code-foreground); overflow-x: auto;',
'color:var(--astro-code-token-constant)',
'color:var(--astro-code-token-function)',
'color:var(--astro-code-color-text)',
'color:var(--astro-code-foreground)',
'color:var(--astro-code-token-string-expression)',
'color:var(--astro-code-color-text)',
],
'color:var(--astro-code-foreground)',
]
);
});

View file

@ -5,7 +5,6 @@ import {
getHighlighter,
isSpecialLang,
} from 'shiki';
import { visit } from 'unist-util-visit';
import type { ShikiConfig } from './types.js';
export interface ShikiHighlighter {
@ -23,16 +22,6 @@ export interface ShikiHighlighter {
): Promise<string>;
}
// TODO: Remove this special replacement in Astro 5
const ASTRO_COLOR_REPLACEMENTS: Record<string, string> = {
'--astro-code-foreground': '--astro-code-color-text',
'--astro-code-background': '--astro-code-color-background',
};
const COLOR_REPLACEMENT_REGEX = new RegExp(
`${Object.keys(ASTRO_COLOR_REPLACEMENTS).join('|')}`,
'g',
);
let _cssVariablesTheme: ReturnType<typeof createCssVariablesTheme>;
const cssVariablesTheme = () =>
_cssVariablesTheme ??
@ -145,21 +134,6 @@ export async function createShikiHighlighter({
return node.children[0] as typeof node;
}
},
root(node) {
if (Object.values(themes).length) {
return;
}
const themeName = typeof theme === 'string' ? theme : theme.name;
if (themeName === 'css-variables') {
// Replace special color tokens to CSS variables
visit(node as any, 'element', (child) => {
if (child.properties?.style) {
child.properties.style = replaceCssVariables(child.properties.style);
}
});
}
},
},
...transformers,
],
@ -171,7 +145,3 @@ export async function createShikiHighlighter({
function normalizePropAsString(value: Properties[string]): string | null {
return Array.isArray(value) ? value.join(' ') : (value as string | null);
}
function replaceCssVariables(str: string) {
return str.replace(COLOR_REPLACEMENT_REGEX, (match) => ASTRO_COLOR_REPLACEMENTS[match] || match);
}