Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a140052
feat: remove polyfill
florian-lefebvre Sep 23, 2025
f36affe
feat: misc
florian-lefebvre Sep 23, 2025
ddd093f
feat: version
florian-lefebvre Sep 23, 2025
8443daf
chore: changeset
florian-lefebvre Sep 23, 2025
935b8ed
feat: use import.meta.resolve
florian-lefebvre Sep 23, 2025
74a056a
feat: use import.meta.resolve
florian-lefebvre Sep 23, 2025
22a3f5a
Revert "feat: use import.meta.resolve"
florian-lefebvre Sep 23, 2025
1d36ec6
feat: node 24
florian-lefebvre Sep 23, 2025
5905b83
Merge branch 'next' into feat/drop-node-18
florian-lefebvre Sep 23, 2025
49415b4
fix: pin wrangler
florian-lefebvre Sep 23, 2025
547048a
Merge branch 'next' into feat/drop-node-18
florian-lefebvre Sep 24, 2025
4fcff0e
Merge branch 'next' into feat/drop-node-18
florian-lefebvre Sep 24, 2025
e9d328c
Merge branch 'next' into feat/drop-node-18
florian-lefebvre Sep 24, 2025
656bbde
fix: build
florian-lefebvre Sep 24, 2025
12b9fad
Merge branch 'next' into feat/drop-node-18
florian-lefebvre Sep 24, 2025
2b5fb20
Merge branch 'next' into feat/drop-node-18
florian-lefebvre Sep 25, 2025
0746215
fix: path on windows
florian-lefebvre Sep 25, 2025
997ad6b
feat: update cli entrypoint
florian-lefebvre Sep 25, 2025
d422fb4
fix: path
florian-lefebvre Sep 25, 2025
85474ce
fix: path
florian-lefebvre Sep 25, 2025
47e23be
feat: update version to node 22
florian-lefebvre Sep 25, 2025
153b325
chore: format
florian-lefebvre Sep 25, 2025
a1c77b3
Discard changes to examples/basics/tsconfig.json
florian-lefebvre Sep 25, 2025
8799ec6
Discard changes to examples/blog/tsconfig.json
florian-lefebvre Sep 25, 2025
4e1b232
Discard changes to examples/container-with-vitest/tsconfig.json
florian-lefebvre Sep 25, 2025
ea0c05f
Discard changes to examples/framework-alpine/tsconfig.json
florian-lefebvre Sep 25, 2025
55a862e
Discard changes to examples/framework-multiple/tsconfig.json
florian-lefebvre Sep 25, 2025
0bba698
fix: remove 20 from ci
florian-lefebvre Sep 25, 2025
d2d604b
Update puny-poems-create.md
florian-lefebvre Sep 25, 2025
a2c53bb
Update puny-poems-create.md
florian-lefebvre Sep 25, 2025
5fe601f
try fix db test
florian-lefebvre Sep 25, 2025
637dd59
Revert "try fix db test"
florian-lefebvre Sep 25, 2025
1285d95
wip
florian-lefebvre Sep 25, 2025
6400b05
wip
florian-lefebvre Sep 25, 2025
65fadd7
wip
florian-lefebvre Sep 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .changeset/puny-poems-create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
'@astrojs/markdoc': minor
'@astrojs/preact': major
'@astrojs/svelte': major
'@astrojs/react': major
'@astrojs/solid-js': major
'@astrojs/mdx': major
'create-astro': major
'@astrojs/prism': major
'@astrojs/upgrade': minor
'astro': major
---

Increases minimum Node.js version to 22.0.0

Node 18 reached its End of Life in March 2025 and Node 20 is scheduled to reach its End of Life in April 2026.

Astro v6.0 drops Node 18 and Node 20 support entirely so that all Astro users can take advantage of Node's more modern features.

#### What should I do?

Check that both your development environment and your deployment environment are using **Node `22.0.0` or higher**.

1. Check your local version of Node using:

```sh
node -v
```

2. Check your deployment environment's own documentation to verify that they support Node 22.

You can specify Node `22.0.0` for your Astro project either in a dashboard configuration setting or a `.nvmrc` file.

```bash
# .nvmrc
22.0.0
```
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/devcontainers/javascript-node:1-18
FROM mcr.microsoft.com/devcontainers/javascript-node:1-22

# Install playwright
RUN npm install -g @playwright/test
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/examples.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/devcontainers/javascript-node:1-18
FROM mcr.microsoft.com/devcontainers/javascript-node:1-22

# Install latest pnpm
RUN npm install -g pnpm
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/---01-bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ body:
Thank you for taking the time to file a bug report! Please fill out this form as completely as possible.
✅ I am using the **latest version of Astro** and all plugins.
✅ I am using a version of Node that Astro supports (`v18.20.8`, `v20.3.0`, `v22.0.0` or higher.)
✅ I am using a version of Node that Astro supports (`v22.0.0` or higher.)
- type: textarea
id: astro-info
attributes:
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
strategy:
matrix:
OS: [ubuntu-latest, macos-14, windows-2025]
NODE_VERSION: [18, 20, 22]
NODE_VERSION: [22, 24]
TEST_SUITE:
- { name: astro, script: 'pnpm run test:astro' }
- { name: integrations, script: 'pnpm run test:integrations' }
Expand All @@ -119,13 +119,9 @@ jobs:
# Windows and use one of the older Node versions.
exclude:
- os: macos-14
NODE_VERSION: 18
- os: macos-14
NODE_VERSION: 20
- os: windows-2025
NODE_VERSION: 18
NODE_VERSION: 22
- os: windows-2025
NODE_VERSION: 20
NODE_VERSION: 22
fail-fast: false
env:
NODE_VERSION: ${{ matrix.NODE_VERSION }}
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.20.8
22.20.0
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ We welcome contributions of any size and skill level. As an open source project,
### Prerequisites

```shell
node: "^>=18.20.8"
pnpm: "^9.12.1"
node: "^>=22.0.0"
pnpm: "^10.17.0"
# otherwise, your build will fail
```

Expand Down
2 changes: 1 addition & 1 deletion benchmark/bench/_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from 'node:path';

const astroPkgPath = createRequire(import.meta.url).resolve('astro/package.json');

export const astroBin = path.resolve(astroPkgPath, '../astro.js');
export const astroBin = path.resolve(astroPkgPath, '../bin/astro.mjs');

/** @typedef {{ avg: number, stdev: number, max: number }} Stat */

Expand Down
3 changes: 0 additions & 3 deletions benchmark/packages/adapter/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import * as fs from 'node:fs';
import type { SSRManifest } from 'astro';
import { App } from 'astro/app';
import { applyPolyfills } from 'astro/app/node';

applyPolyfills();

class MyApp extends App {
#manifest: SSRManifest | undefined;
Expand Down
4 changes: 1 addition & 3 deletions benchmark/packages/timer/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import type { IncomingMessage, ServerResponse } from 'node:http';
import type { SSRManifest } from 'astro';
import { applyPolyfills, NodeApp } from 'astro/app/node';

applyPolyfills();
import { NodeApp } from 'astro/app/node';

export function createExports(manifest: SSRManifest) {
const app = new NodeApp(manifest);
Expand Down
2 changes: 1 addition & 1 deletion biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
"**/packages/db/**/cli/**/*.ts",
"**/benchmark/**/*.js",
"**/packages/astro/src/cli/**/*.ts",
"**/packages/astro/astro.js"
"**/packages/astro/bin/**/*.mjs"
],
"linter": {
"rules": {
Expand Down
2 changes: 1 addition & 1 deletion examples/basics/.codesandbox/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM node:18-bullseye
FROM node:22-bullseye
2 changes: 1 addition & 1 deletion examples/blog/.codesandbox/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM node:18-bullseye
FROM node:22-bullseye
2 changes: 1 addition & 1 deletion examples/container-with-vitest/.codesandbox/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM node:18-bullseye
FROM node:22-bullseye
2 changes: 1 addition & 1 deletion examples/framework-alpine/.codesandbox/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM node:18-bullseye
FROM node:22-bullseye
2 changes: 1 addition & 1 deletion examples/framework-multiple/.codesandbox/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM node:18-bullseye
FROM node:22-bullseye
2 changes: 1 addition & 1 deletion examples/framework-preact/.codesandbox/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM node:18-bullseye
FROM node:22-bullseye
2 changes: 1 addition & 1 deletion examples/framework-react/.codesandbox/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM node:18-bullseye
FROM node:22-bullseye
2 changes: 1 addition & 1 deletion examples/framework-solid/.codesandbox/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM node:18-bullseye
FROM node:22-bullseye
2 changes: 1 addition & 1 deletion examples/framework-svelte/.codesandbox/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM node:18-bullseye
FROM node:22-bullseye
2 changes: 1 addition & 1 deletion examples/framework-vue/.codesandbox/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM node:18-bullseye
FROM node:22-bullseye
2 changes: 1 addition & 1 deletion examples/hackernews/.codesandbox/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM node:18-bullseye
FROM node:22-bullseye
2 changes: 1 addition & 1 deletion examples/minimal/.codesandbox/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM node:18-bullseye
FROM node:22-bullseye
2 changes: 1 addition & 1 deletion examples/portfolio/.codesandbox/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM node:18-bullseye
FROM node:22-bullseye
2 changes: 1 addition & 1 deletion examples/ssr/.codesandbox/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM node:18-bullseye
FROM node:22-bullseye
2 changes: 1 addition & 1 deletion examples/toolbar-app/.codesandbox/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM node:18-bullseye
FROM node:22-bullseye
2 changes: 1 addition & 1 deletion examples/with-markdoc/.codesandbox/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM node:18-bullseye
FROM node:22-bullseye
2 changes: 1 addition & 1 deletion examples/with-mdx/.codesandbox/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM node:18-bullseye
FROM node:22-bullseye
2 changes: 1 addition & 1 deletion examples/with-nanostores/.codesandbox/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM node:18-bullseye
FROM node:22-bullseye
2 changes: 1 addition & 1 deletion examples/with-tailwindcss/.codesandbox/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM node:18-bullseye
FROM node:22-bullseye
2 changes: 1 addition & 1 deletion examples/with-vitest/.codesandbox/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM node:18-bullseye
FROM node:22-bullseye
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"packages/*"
],
"engines": {
"node": "^18.20.8 || ^20.3.0 || >=22.0.0"
"node": ">=22.0.0"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requires node 22 in the monorepo

},
"packageManager": "[email protected]",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/astro-prism/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
"astro-scripts": "workspace:*"
},
"engines": {
"node": "18.20.8 || ^20.3.0 || >=22.0.0"
"node": "^20.19.5 || >=22.0.0"
}
}
15 changes: 7 additions & 8 deletions packages/astro/astro.js → packages/astro/bin/astro.mjs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/usr/bin/env node
'use strict';

// ISOMORPHIC FILE: NO TOP-LEVEL IMPORT/REQUIRE() ALLOWED
// This file has to run as both ESM and CJS on older Node.js versions

const CI_INSTRUCTIONS = {
NETLIFY: 'https://docs.netlify.com/configure-builds/manage-dependencies/#node-js-and-javascript',
GITHUB_ACTIONS:
'https://docs.github.com/en/actions/guides/building-and-testing-nodejs#specifying-the-nodejs-version',
VERCEL: 'https://vercel.com/docs/runtimes#official-runtimes/node-js/node-js-version',
};

// TODO: remove once Stackblitz supports Node 22
const IS_STACKBLITZ = !!process.versions.webcontainer;

// Hardcode supported Node.js version so we don't have to read differently in CJS & ESM.
const engines = '>=18.20.8';
const skipSemverCheckIfAbove = 19;
const engines = IS_STACKBLITZ ? '>=20.19.5' : '>=22.0.0';
const skipSemverCheckIfAbove = IS_STACKBLITZ ? 21 : 23;

/** `astro *` */
async function main() {
Expand All @@ -39,7 +39,7 @@ async function main() {
if (correctedCwd !== cwd) process.chdir(correctedCwd);
}

return import('./dist/cli/index.js')
return import('../dist/cli/index.js')
.then(({ cli }) => cli(process.argv))
.catch((error) => {
console.error(error);
Expand All @@ -52,8 +52,7 @@ async function errorNodeUnsupported() {
Node.js v${process.versions.node} is not supported by Astro!
Please upgrade Node.js to a supported version: "${engines}"\n`);

// eslint-disable-next-line @typescript-eslint/no-require-imports
const ci = typeof require !== 'undefined' ? require('ci-info') : await import('ci-info');
const ci = await import('ci-info');

// Special instructions for CI environments, which may have special steps needed.
// This is a common issue that we can help users with proactively.
Expand Down
7 changes: 3 additions & 4 deletions packages/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@
"./virtual-modules/*": "./dist/virtual-modules/*"
},
"bin": {
"astro": "astro.js"
"astro": "./bin/astro.mjs"
},
"files": [
"components/*.{astro,css,ts}",
"tsconfigs",
"dist",
"types",
"astro.js",
"bin",
"env.d.ts",
"client.d.ts",
"jsx-runtime.d.ts",
Expand Down Expand Up @@ -136,7 +136,6 @@
"github-slugger": "^2.0.0",
"html-escaper": "3.0.3",
"http-cache-semantics": "^4.2.0",
"import-meta-resolve": "^4.2.0",
"js-yaml": "^4.1.0",
"kleur": "^4.1.5",
"magic-string": "^0.30.18",
Expand Down Expand Up @@ -211,7 +210,7 @@
"vitest": "^3.2.4"
},
"engines": {
"node": "18.20.8 || ^20.3.0 || >=22.0.0",
"node": "^20.19.5 || >=22.0.0",
"npm": ">=9.6.5",
"pnpm": ">=7.1.0"
},
Expand Down
18 changes: 4 additions & 14 deletions packages/astro/src/assets/build/remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,27 +82,17 @@ export async function revalidateRemoteImage(
};
}

function webToCachePolicyRequest({ url, method, headers: _headers }: Request): CachePolicy.Request {
let headers: CachePolicy.Headers = {};
// Be defensive here due to a cookie header bug in [email protected] + undici
try {
headers = Object.fromEntries(_headers.entries());
} catch {}
function webToCachePolicyRequest({ url, method, headers }: Request): CachePolicy.Request {
return {
method,
url,
headers,
headers: Object.fromEntries(headers.entries()),
};
}

function webToCachePolicyResponse({ status, headers: _headers }: Response): CachePolicy.Response {
let headers: CachePolicy.Headers = {};
// Be defensive here due to a cookie header bug in [email protected] + undici
try {
headers = Object.fromEntries(_headers.entries());
} catch {}
function webToCachePolicyResponse({ status, headers }: Response): CachePolicy.Response {
return {
status,
headers,
headers: Object.fromEntries(headers.entries()),
};
}
2 changes: 0 additions & 2 deletions packages/astro/src/cli/add/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import type { Logger } from '../../core/logger/core.js';
import * as msg from '../../core/messages.js';
import { printHelp } from '../../core/messages.js';
import { appendForwardSlash } from '../../core/path.js';
import { apply as applyPolyfill } from '../../core/polyfill.js';
import { ensureProcessNodeEnv, parseNpmName } from '../../core/util.js';
import { eventCliSession, telemetry } from '../../events/index.js';
import { exec } from '../exec.js';
Expand Down Expand Up @@ -91,7 +90,6 @@ const OFFICIAL_ADAPTER_TO_IMPORT_MAP: Record<string, string> = {

export async function add(names: string[], { flags }: AddOptions) {
ensureProcessNodeEnv('production');
applyPolyfill();
const inlineConfig = flagsToAstroInlineConfig(flags);
const { userConfig } = await resolveConfig(inlineConfig, 'add');
telemetry.record(eventCliSession('add', userConfig));
Expand Down
2 changes: 0 additions & 2 deletions packages/astro/src/cli/db/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { Arguments } from 'yargs-parser';
import { resolveConfig } from '../../core/config/config.js';
import { apply as applyPolyfill } from '../../core/polyfill.js';
import type { AstroConfig } from '../../types/public/config.js';
import { createLoggerFromFlags, flagsToAstroInlineConfig } from '../flags.js';
import { getPackage } from '../install-package.js';
Expand All @@ -10,7 +9,6 @@ type DBPackage = {
};

export async function db({ flags }: { flags: Arguments }) {
applyPolyfill();
const logger = createLoggerFromFlags(flags);
const getPackageOpts = {
skipAsk: !!flags.yes || !!flags.y,
Expand Down
2 changes: 0 additions & 2 deletions packages/astro/src/cli/info/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import * as colors from 'kleur/colors';
import prompts from 'prompts';
import { resolveConfig } from '../../core/config/index.js';
import { ASTRO_VERSION } from '../../core/constants.js';
import { apply as applyPolyfill } from '../../core/polyfill.js';
import type { AstroConfig, AstroUserConfig } from '../../types/public/config.js';
import { type Flags, flagsToAstroInlineConfig } from '../flags.js';

Expand Down Expand Up @@ -80,7 +79,6 @@ export async function getInfoOutput({
}

export async function printInfo({ flags }: InfoOptions) {
applyPolyfill();
const { userConfig } = await resolveConfig(flagsToAstroInlineConfig(flags), 'info');
const output = await getInfoOutput({ userConfig, print: true });
await copyToClipboard(output, flags.copy);
Expand Down
2 changes: 0 additions & 2 deletions packages/astro/src/cli/preferences/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { resolveConfig } from '../../core/config/config.js';
import { createSettings } from '../../core/config/settings.js';
import { collectErrorMetadata } from '../../core/errors/dev/utils.js';
import * as msg from '../../core/messages.js';
import { apply as applyPolyfill } from '../../core/polyfill.js';
import { DEFAULT_PREFERENCES } from '../../preferences/defaults.js';
import { coerce, isValidKey, type PreferenceKey } from '../../preferences/index.js';
import type { AstroSettings } from '../../types/astro.js';
Expand Down Expand Up @@ -41,7 +40,6 @@ export async function preferences(
value: string | undefined,
{ flags }: PreferencesOptions,
): Promise<number> {
applyPolyfill();
if (!isValidSubcommand(subcommand) || flags?.help || flags?.h) {
msg.printHelp({
commandName: 'astro preferences',
Expand Down
1 change: 0 additions & 1 deletion packages/astro/src/container/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import './polyfill.js';
import { posix } from 'node:path';
import { getDefaultClientDirectives } from '../core/client-directive/index.js';
import { ASTRO_CONFIG_DEFAULTS } from '../core/config/schemas/index.js';
Expand Down
3 changes: 0 additions & 3 deletions packages/astro/src/container/polyfill.ts

This file was deleted.

Loading