diff --git a/.changeset/puny-poems-create.md b/.changeset/puny-poems-create.md new file mode 100644 index 000000000000..35ecc1ba9a43 --- /dev/null +++ b/.changeset/puny-poems-create.md @@ -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 + ``` diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 49a76b9a5b3c..39c78e92de45 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -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 diff --git a/.devcontainer/examples.Dockerfile b/.devcontainer/examples.Dockerfile index 6ab758c823fd..ee0f03789427 100644 --- a/.devcontainer/examples.Dockerfile +++ b/.devcontainer/examples.Dockerfile @@ -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 diff --git a/.github/ISSUE_TEMPLATE/---01-bug-report.yml b/.github/ISSUE_TEMPLATE/---01-bug-report.yml index eb1ee8ae2ba6..3935797e89e8 100644 --- a/.github/ISSUE_TEMPLATE/---01-bug-report.yml +++ b/.github/ISSUE_TEMPLATE/---01-bug-report.yml @@ -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: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2dd4b54b2238..4469a8fb6623 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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' } @@ -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 }} diff --git a/.nvmrc b/.nvmrc index 08b7109d009b..442c7587a99a 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -18.20.8 +22.20.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5703b4248d68..f05652ee04ab 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 ``` diff --git a/benchmark/bench/_util.js b/benchmark/bench/_util.js index d9dfe5b19076..2f8e60ec2127 100644 --- a/benchmark/bench/_util.js +++ b/benchmark/bench/_util.js @@ -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 */ diff --git a/benchmark/packages/adapter/src/server.ts b/benchmark/packages/adapter/src/server.ts index 37c5ead102f2..e53401d1e541 100644 --- a/benchmark/packages/adapter/src/server.ts +++ b/benchmark/packages/adapter/src/server.ts @@ -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; diff --git a/benchmark/packages/timer/src/server.ts b/benchmark/packages/timer/src/server.ts index 39f18e9986f3..d9f5802cf29a 100644 --- a/benchmark/packages/timer/src/server.ts +++ b/benchmark/packages/timer/src/server.ts @@ -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); diff --git a/biome.jsonc b/biome.jsonc index 796ea9f12129..fecc7e32c2d8 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -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": { diff --git a/examples/basics/.codesandbox/Dockerfile b/examples/basics/.codesandbox/Dockerfile index c3b5c81a121d..46f1ca14f894 100644 --- a/examples/basics/.codesandbox/Dockerfile +++ b/examples/basics/.codesandbox/Dockerfile @@ -1 +1 @@ -FROM node:18-bullseye +FROM node:22-bullseye diff --git a/examples/blog/.codesandbox/Dockerfile b/examples/blog/.codesandbox/Dockerfile index c3b5c81a121d..46f1ca14f894 100644 --- a/examples/blog/.codesandbox/Dockerfile +++ b/examples/blog/.codesandbox/Dockerfile @@ -1 +1 @@ -FROM node:18-bullseye +FROM node:22-bullseye diff --git a/examples/container-with-vitest/.codesandbox/Dockerfile b/examples/container-with-vitest/.codesandbox/Dockerfile index c3b5c81a121d..46f1ca14f894 100644 --- a/examples/container-with-vitest/.codesandbox/Dockerfile +++ b/examples/container-with-vitest/.codesandbox/Dockerfile @@ -1 +1 @@ -FROM node:18-bullseye +FROM node:22-bullseye diff --git a/examples/framework-alpine/.codesandbox/Dockerfile b/examples/framework-alpine/.codesandbox/Dockerfile index c3b5c81a121d..46f1ca14f894 100644 --- a/examples/framework-alpine/.codesandbox/Dockerfile +++ b/examples/framework-alpine/.codesandbox/Dockerfile @@ -1 +1 @@ -FROM node:18-bullseye +FROM node:22-bullseye diff --git a/examples/framework-multiple/.codesandbox/Dockerfile b/examples/framework-multiple/.codesandbox/Dockerfile index c3b5c81a121d..46f1ca14f894 100644 --- a/examples/framework-multiple/.codesandbox/Dockerfile +++ b/examples/framework-multiple/.codesandbox/Dockerfile @@ -1 +1 @@ -FROM node:18-bullseye +FROM node:22-bullseye diff --git a/examples/framework-preact/.codesandbox/Dockerfile b/examples/framework-preact/.codesandbox/Dockerfile index c3b5c81a121d..46f1ca14f894 100644 --- a/examples/framework-preact/.codesandbox/Dockerfile +++ b/examples/framework-preact/.codesandbox/Dockerfile @@ -1 +1 @@ -FROM node:18-bullseye +FROM node:22-bullseye diff --git a/examples/framework-react/.codesandbox/Dockerfile b/examples/framework-react/.codesandbox/Dockerfile index c3b5c81a121d..46f1ca14f894 100644 --- a/examples/framework-react/.codesandbox/Dockerfile +++ b/examples/framework-react/.codesandbox/Dockerfile @@ -1 +1 @@ -FROM node:18-bullseye +FROM node:22-bullseye diff --git a/examples/framework-solid/.codesandbox/Dockerfile b/examples/framework-solid/.codesandbox/Dockerfile index c3b5c81a121d..46f1ca14f894 100644 --- a/examples/framework-solid/.codesandbox/Dockerfile +++ b/examples/framework-solid/.codesandbox/Dockerfile @@ -1 +1 @@ -FROM node:18-bullseye +FROM node:22-bullseye diff --git a/examples/framework-svelte/.codesandbox/Dockerfile b/examples/framework-svelte/.codesandbox/Dockerfile index c3b5c81a121d..46f1ca14f894 100644 --- a/examples/framework-svelte/.codesandbox/Dockerfile +++ b/examples/framework-svelte/.codesandbox/Dockerfile @@ -1 +1 @@ -FROM node:18-bullseye +FROM node:22-bullseye diff --git a/examples/framework-vue/.codesandbox/Dockerfile b/examples/framework-vue/.codesandbox/Dockerfile index c3b5c81a121d..46f1ca14f894 100644 --- a/examples/framework-vue/.codesandbox/Dockerfile +++ b/examples/framework-vue/.codesandbox/Dockerfile @@ -1 +1 @@ -FROM node:18-bullseye +FROM node:22-bullseye diff --git a/examples/hackernews/.codesandbox/Dockerfile b/examples/hackernews/.codesandbox/Dockerfile index c3b5c81a121d..46f1ca14f894 100644 --- a/examples/hackernews/.codesandbox/Dockerfile +++ b/examples/hackernews/.codesandbox/Dockerfile @@ -1 +1 @@ -FROM node:18-bullseye +FROM node:22-bullseye diff --git a/examples/minimal/.codesandbox/Dockerfile b/examples/minimal/.codesandbox/Dockerfile index c3b5c81a121d..46f1ca14f894 100644 --- a/examples/minimal/.codesandbox/Dockerfile +++ b/examples/minimal/.codesandbox/Dockerfile @@ -1 +1 @@ -FROM node:18-bullseye +FROM node:22-bullseye diff --git a/examples/portfolio/.codesandbox/Dockerfile b/examples/portfolio/.codesandbox/Dockerfile index c3b5c81a121d..46f1ca14f894 100644 --- a/examples/portfolio/.codesandbox/Dockerfile +++ b/examples/portfolio/.codesandbox/Dockerfile @@ -1 +1 @@ -FROM node:18-bullseye +FROM node:22-bullseye diff --git a/examples/ssr/.codesandbox/Dockerfile b/examples/ssr/.codesandbox/Dockerfile index c3b5c81a121d..46f1ca14f894 100644 --- a/examples/ssr/.codesandbox/Dockerfile +++ b/examples/ssr/.codesandbox/Dockerfile @@ -1 +1 @@ -FROM node:18-bullseye +FROM node:22-bullseye diff --git a/examples/toolbar-app/.codesandbox/Dockerfile b/examples/toolbar-app/.codesandbox/Dockerfile index c3b5c81a121d..46f1ca14f894 100644 --- a/examples/toolbar-app/.codesandbox/Dockerfile +++ b/examples/toolbar-app/.codesandbox/Dockerfile @@ -1 +1 @@ -FROM node:18-bullseye +FROM node:22-bullseye diff --git a/examples/with-markdoc/.codesandbox/Dockerfile b/examples/with-markdoc/.codesandbox/Dockerfile index c3b5c81a121d..46f1ca14f894 100644 --- a/examples/with-markdoc/.codesandbox/Dockerfile +++ b/examples/with-markdoc/.codesandbox/Dockerfile @@ -1 +1 @@ -FROM node:18-bullseye +FROM node:22-bullseye diff --git a/examples/with-mdx/.codesandbox/Dockerfile b/examples/with-mdx/.codesandbox/Dockerfile index c3b5c81a121d..46f1ca14f894 100644 --- a/examples/with-mdx/.codesandbox/Dockerfile +++ b/examples/with-mdx/.codesandbox/Dockerfile @@ -1 +1 @@ -FROM node:18-bullseye +FROM node:22-bullseye diff --git a/examples/with-nanostores/.codesandbox/Dockerfile b/examples/with-nanostores/.codesandbox/Dockerfile index c3b5c81a121d..46f1ca14f894 100644 --- a/examples/with-nanostores/.codesandbox/Dockerfile +++ b/examples/with-nanostores/.codesandbox/Dockerfile @@ -1 +1 @@ -FROM node:18-bullseye +FROM node:22-bullseye diff --git a/examples/with-tailwindcss/.codesandbox/Dockerfile b/examples/with-tailwindcss/.codesandbox/Dockerfile index c3b5c81a121d..46f1ca14f894 100644 --- a/examples/with-tailwindcss/.codesandbox/Dockerfile +++ b/examples/with-tailwindcss/.codesandbox/Dockerfile @@ -1 +1 @@ -FROM node:18-bullseye +FROM node:22-bullseye diff --git a/examples/with-vitest/.codesandbox/Dockerfile b/examples/with-vitest/.codesandbox/Dockerfile index c3b5c81a121d..46f1ca14f894 100644 --- a/examples/with-vitest/.codesandbox/Dockerfile +++ b/examples/with-vitest/.codesandbox/Dockerfile @@ -1 +1 @@ -FROM node:18-bullseye +FROM node:22-bullseye diff --git a/package.json b/package.json index 6337568adf56..43f3455cb0ff 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "packages/*" ], "engines": { - "node": "^18.20.8 || ^20.3.0 || >=22.0.0" + "node": ">=22.0.0" }, "packageManager": "pnpm@10.17.0", "dependencies": { diff --git a/packages/astro-prism/package.json b/packages/astro-prism/package.json index 37ca54bfb986..411ea0a0914a 100644 --- a/packages/astro-prism/package.json +++ b/packages/astro-prism/package.json @@ -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" } } diff --git a/packages/astro/astro.js b/packages/astro/bin/astro.mjs similarity index 84% rename from packages/astro/astro.js rename to packages/astro/bin/astro.mjs index 79108396b388..5c8797cf4844 100755 --- a/packages/astro/astro.js +++ b/packages/astro/bin/astro.mjs @@ -1,9 +1,6 @@ #!/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: @@ -11,9 +8,12 @@ const CI_INSTRUCTIONS = { 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() { @@ -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); @@ -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. diff --git a/packages/astro/package.json b/packages/astro/package.json index 24e26d5f9e11..5f5178253867 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -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", @@ -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", @@ -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" }, diff --git a/packages/astro/src/assets/build/remote.ts b/packages/astro/src/assets/build/remote.ts index 55ee9a205013..3c6f6fae3c01 100644 --- a/packages/astro/src/assets/build/remote.ts +++ b/packages/astro/src/assets/build/remote.ts @@ -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 node@18.14.1 + 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 node@18.14.1 + undici - try { - headers = Object.fromEntries(_headers.entries()); - } catch {} +function webToCachePolicyResponse({ status, headers }: Response): CachePolicy.Response { return { status, - headers, + headers: Object.fromEntries(headers.entries()), }; } diff --git a/packages/astro/src/cli/add/index.ts b/packages/astro/src/cli/add/index.ts index fbdbfef18b7a..a53bd23382fb 100644 --- a/packages/astro/src/cli/add/index.ts +++ b/packages/astro/src/cli/add/index.ts @@ -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'; @@ -91,7 +90,6 @@ const OFFICIAL_ADAPTER_TO_IMPORT_MAP: Record = { 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)); diff --git a/packages/astro/src/cli/db/index.ts b/packages/astro/src/cli/db/index.ts index 0dda4f30b708..8dce31cbc223 100644 --- a/packages/astro/src/cli/db/index.ts +++ b/packages/astro/src/cli/db/index.ts @@ -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'; @@ -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, diff --git a/packages/astro/src/cli/info/index.ts b/packages/astro/src/cli/info/index.ts index 50476df4221f..85c781c789b3 100644 --- a/packages/astro/src/cli/info/index.ts +++ b/packages/astro/src/cli/info/index.ts @@ -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'; @@ -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); diff --git a/packages/astro/src/cli/preferences/index.ts b/packages/astro/src/cli/preferences/index.ts index 8a22802a3f6c..fc828e499376 100644 --- a/packages/astro/src/cli/preferences/index.ts +++ b/packages/astro/src/cli/preferences/index.ts @@ -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'; @@ -41,7 +40,6 @@ export async function preferences( value: string | undefined, { flags }: PreferencesOptions, ): Promise { - applyPolyfill(); if (!isValidSubcommand(subcommand) || flags?.help || flags?.h) { msg.printHelp({ commandName: 'astro preferences', diff --git a/packages/astro/src/container/index.ts b/packages/astro/src/container/index.ts index 1894ed530fc7..353fca4c4fa6 100644 --- a/packages/astro/src/container/index.ts +++ b/packages/astro/src/container/index.ts @@ -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'; diff --git a/packages/astro/src/container/polyfill.ts b/packages/astro/src/container/polyfill.ts deleted file mode 100644 index baf53359686c..000000000000 --- a/packages/astro/src/container/polyfill.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { applyPolyfills } from '../core/app/node.js'; - -applyPolyfills(); diff --git a/packages/astro/src/core/app/node.ts b/packages/astro/src/core/app/node.ts index 4939356a9883..78e0a95f4089 100644 --- a/packages/astro/src/core/app/node.ts +++ b/packages/astro/src/core/app/node.ts @@ -10,8 +10,6 @@ import type { RenderOptions } from './index.js'; import { App } from './index.js'; import type { NodeAppHeadersJson, SerializedSSRManifest, SSRManifest } from './types.js'; -export { apply as applyPolyfills } from '../polyfill.js'; - /** * Allow the request body to be explicitly overridden. For example, this * is used by the Express JSON middleware. diff --git a/packages/astro/src/core/build/index.ts b/packages/astro/src/core/build/index.ts index 30030dcc94be..2096723706e5 100644 --- a/packages/astro/src/core/build/index.ts +++ b/packages/astro/src/core/build/index.ts @@ -22,7 +22,6 @@ import { createKey, getEnvironmentKey, hasEnvironmentKey } from '../encryption.j import { AstroError, AstroErrorData } from '../errors/index.js'; import type { Logger } from '../logger/core.js'; import { levels, timerMessage } from '../logger/core.js'; -import { apply as applyPolyfill } from '../polyfill.js'; import { createRoutesList } from '../routing/index.js'; import { getServerIslandRouteData } from '../server-islands/endpoint.js'; import { clearContentLayerCache } from '../sync/index.js'; @@ -63,7 +62,6 @@ export default async function build( options: BuildOptions = {}, ): Promise { ensureProcessNodeEnv(options.devOutput ? 'development' : 'production'); - applyPolyfill(); const logger = createNodeLogger(inlineConfig); const { userConfig, astroConfig } = await resolveConfig(inlineConfig, 'build'); telemetry.record(eventCliSession('build', userConfig)); diff --git a/packages/astro/src/core/build/plugins/plugin-manifest.ts b/packages/astro/src/core/build/plugins/plugin-manifest.ts index 86d5aefd1702..8d2b146a7d65 100644 --- a/packages/astro/src/core/build/plugins/plugin-manifest.ts +++ b/packages/astro/src/core/build/plugins/plugin-manifest.ts @@ -1,5 +1,4 @@ import { fileURLToPath } from 'node:url'; -import { resolve as importMetaResolve } from 'import-meta-resolve'; import type { OutputChunk } from 'rollup'; import { glob } from 'tinyglobby'; import { type BuiltinDriverName, builtinDrivers } from 'unstorage'; @@ -50,10 +49,10 @@ function resolveSessionDriver(driver: string | undefined): string | null { } try { if (driver === 'fs') { - return importMetaResolve(builtinDrivers.fsLite, import.meta.url); + return import.meta.resolve(builtinDrivers.fsLite, import.meta.url); } if (driver in builtinDrivers) { - return importMetaResolve(builtinDrivers[driver as BuiltinDriverName], import.meta.url); + return import.meta.resolve(builtinDrivers[driver as BuiltinDriverName], import.meta.url); } } catch { return null; diff --git a/packages/astro/src/core/dev/container.ts b/packages/astro/src/core/dev/container.ts index 771992f0e892..03166a0c866e 100644 --- a/packages/astro/src/core/dev/container.ts +++ b/packages/astro/src/core/dev/container.ts @@ -13,7 +13,6 @@ import type { AstroInlineConfig } from '../../types/public/config.js'; import { createDevelopmentManifest } from '../../vite-plugin-astro-server/plugin.js'; import { createVite } from '../create-vite.js'; import type { Logger } from '../logger/core.js'; -import { apply as applyPolyfill } from '../polyfill.js'; import { createRoutesList } from '../routing/index.js'; import { syncInternal } from '../sync/index.js'; import { warnMissingAdapter } from './adapter-validation.js'; @@ -45,7 +44,6 @@ export async function createContainer({ fs = nodeFs, }: CreateContainerParams): Promise { // Initialize - applyPolyfill(); settings = await runHookConfigSetup({ settings, command: 'dev', diff --git a/packages/astro/src/core/polyfill.ts b/packages/astro/src/core/polyfill.ts deleted file mode 100644 index 7b0280fb7f86..000000000000 --- a/packages/astro/src/core/polyfill.ts +++ /dev/null @@ -1,22 +0,0 @@ -import buffer from 'node:buffer'; -import crypto from 'node:crypto'; - -/** - * Astro aims to compatible with web standards as much as possible. - * This function adds two objects that are globally-available on most javascript runtimes but not on node 18. - */ -export function apply() { - // Remove when Node 18 is dropped for Node 20 - if (!globalThis.crypto) { - Object.defineProperty(globalThis, 'crypto', { - value: crypto.webcrypto, - }); - } - - // Remove when Node 18 is dropped for Node 20 - if (!globalThis.File) { - Object.defineProperty(globalThis, 'File', { - value: buffer.File, - }); - } -} diff --git a/packages/astro/src/core/preview/index.ts b/packages/astro/src/core/preview/index.ts index 7a11a755ef06..9b9482ae8ba0 100644 --- a/packages/astro/src/core/preview/index.ts +++ b/packages/astro/src/core/preview/index.ts @@ -10,7 +10,6 @@ import type { PreviewModule, PreviewServer } from '../../types/public/preview.js import { resolveConfig } from '../config/config.js'; import { createNodeLogger } from '../config/logging.js'; import { createSettings } from '../config/settings.js'; -import { apply as applyPolyfills } from '../polyfill.js'; import { createRoutesList } from '../routing/index.js'; import { ensureProcessNodeEnv } from '../util.js'; import createStaticPreviewServer from './static-preview-server.js'; @@ -23,7 +22,6 @@ import { getResolvedHostForHttpServer } from './util.js'; * @experimental The JavaScript API is experimental */ export default async function preview(inlineConfig: AstroInlineConfig): Promise { - applyPolyfills(); ensureProcessNodeEnv('production'); const logger = createNodeLogger(inlineConfig); const { userConfig, astroConfig } = await resolveConfig(inlineConfig ?? {}, 'preview'); diff --git a/packages/astro/test/test-adapter.js b/packages/astro/test/test-adapter.js index 6189b3623971..e872ef35213c 100644 --- a/packages/astro/test/test-adapter.js +++ b/packages/astro/test/test-adapter.js @@ -86,11 +86,7 @@ export default function ({ locals, addCookieHeader, prerenderedErrorPageFetch, - ${ - provideAddress - ? `clientAddress: clientAddress ?? '0.0.0.0',` - : '' - } + ${provideAddress ? `clientAddress: clientAddress ?? '0.0.0.0',` : ''} }); } } diff --git a/packages/astro/test/test-utils.js b/packages/astro/test/test-utils.js index 1178c4ceb602..30332c98ff0b 100644 --- a/packages/astro/test/test-utils.js +++ b/packages/astro/test/test-utils.js @@ -312,7 +312,7 @@ function parseAddressToHost(address) { return address; } -const cliPath = fileURLToPath(new URL('../astro.js', import.meta.url)); +const cliPath = fileURLToPath(new URL('../bin/astro.mjs', import.meta.url)); /** Returns a process running the Astro CLI. */ export function cli(/** @type {string[]} */ ...args) { diff --git a/packages/astro/test/units/cookies/delete.test.js b/packages/astro/test/units/cookies/delete.test.js index 539c796b00ea..0c16c9ed0255 100644 --- a/packages/astro/test/units/cookies/delete.test.js +++ b/packages/astro/test/units/cookies/delete.test.js @@ -1,9 +1,6 @@ import * as assert from 'node:assert/strict'; import { describe, it } from 'node:test'; import { AstroCookies } from '../../../dist/core/cookies/index.js'; -import { apply as applyPolyfill } from '../../../dist/core/polyfill.js'; - -applyPolyfill(); describe('astro/src/core/cookies', () => { describe('Astro.cookies.delete', () => { diff --git a/packages/astro/test/units/cookies/error.test.js b/packages/astro/test/units/cookies/error.test.js index 027474424a2e..6a5a3186f88e 100644 --- a/packages/astro/test/units/cookies/error.test.js +++ b/packages/astro/test/units/cookies/error.test.js @@ -1,9 +1,6 @@ import * as assert from 'node:assert/strict'; import { describe, it } from 'node:test'; import { AstroCookies } from '../../../dist/core/cookies/index.js'; -import { apply as applyPolyfill } from '../../../dist/core/polyfill.js'; - -applyPolyfill(); describe('astro/src/core/cookies', () => { describe('errors', () => { diff --git a/packages/astro/test/units/cookies/get.test.js b/packages/astro/test/units/cookies/get.test.js index b6ffaf62d5ff..751a6cea72ba 100644 --- a/packages/astro/test/units/cookies/get.test.js +++ b/packages/astro/test/units/cookies/get.test.js @@ -1,9 +1,6 @@ import * as assert from 'node:assert/strict'; import { describe, it } from 'node:test'; import { AstroCookies } from '../../../dist/core/cookies/index.js'; -import { apply as applyPolyfill } from '../../../dist/core/polyfill.js'; - -applyPolyfill(); export const encode = (data) => { const dataSerialized = typeof data === 'string' ? data : JSON.stringify(data); diff --git a/packages/astro/test/units/cookies/has.test.js b/packages/astro/test/units/cookies/has.test.js index 351893d1e044..36df2a1c46a2 100644 --- a/packages/astro/test/units/cookies/has.test.js +++ b/packages/astro/test/units/cookies/has.test.js @@ -1,9 +1,6 @@ import * as assert from 'node:assert/strict'; import { describe, it } from 'node:test'; import { AstroCookies } from '../../../dist/core/cookies/index.js'; -import { apply as applyPolyfill } from '../../../dist/core/polyfill.js'; - -applyPolyfill(); describe('astro/src/core/cookies', () => { describe('Astro.cookies.has', () => { diff --git a/packages/astro/test/units/cookies/set.test.js b/packages/astro/test/units/cookies/set.test.js index 120ff92bf64a..d5863ef3a638 100644 --- a/packages/astro/test/units/cookies/set.test.js +++ b/packages/astro/test/units/cookies/set.test.js @@ -1,9 +1,6 @@ import * as assert from 'node:assert/strict'; import { describe, it } from 'node:test'; import { AstroCookies } from '../../../dist/core/cookies/index.js'; -import { apply as applyPolyfill } from '../../../dist/core/polyfill.js'; - -applyPolyfill(); describe('astro/src/core/cookies', () => { describe('Astro.cookies.set', () => { diff --git a/packages/create-astro/create-astro.mjs b/packages/create-astro/create-astro.mjs index 5e25e5e94a3d..6a7359eb4f0c 100755 --- a/packages/create-astro/create-astro.mjs +++ b/packages/create-astro/create-astro.mjs @@ -4,7 +4,9 @@ const currentVersion = process.versions.node; const requiredMajorVersion = parseInt(currentVersion.split('.')[0], 10); -const minimumMajorVersion = 18; +// TODO: remove once Stackblitz supports Node 22 +const IS_STACKBLITZ = !!process.versions.webcontainer; +const minimumMajorVersion = IS_STACKBLITZ ? 20 : 22; if (requiredMajorVersion < minimumMajorVersion) { console.error(`Node.js v${currentVersion} is out of date and unsupported!`); diff --git a/packages/create-astro/package.json b/packages/create-astro/package.json index 246e7edf51a3..b06bac0f8ec4 100644 --- a/packages/create-astro/package.json +++ b/packages/create-astro/package.json @@ -39,7 +39,7 @@ "astro-scripts": "workspace:*" }, "engines": { - "node": "18.20.8 || ^20.3.0 || >=22.0.0" + "node": "^20.19.5 || >=22.0.0" }, "publishConfig": { "provenance": true diff --git a/packages/db/test/fixtures/libsql-remote/temp/.gitignore b/packages/db/test/fixtures/libsql-remote/temp/.gitignore new file mode 100644 index 000000000000..3997beadf829 --- /dev/null +++ b/packages/db/test/fixtures/libsql-remote/temp/.gitignore @@ -0,0 +1 @@ +*.db \ No newline at end of file diff --git a/packages/db/test/fixtures/libsql-remote/temp/.gitkeep b/packages/db/test/fixtures/libsql-remote/temp/.gitkeep new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/db/test/libsql-remote.test.js b/packages/db/test/libsql-remote.test.js index 089db50f0f4e..d65d4b052902 100644 --- a/packages/db/test/libsql-remote.test.js +++ b/packages/db/test/libsql-remote.test.js @@ -21,7 +21,7 @@ describe('astro:db local database', () => { before(async () => { clearEnvironment(); - const absoluteFileUrl = new URL('./fixtures/libsql-remote/dist/absolute.db', import.meta.url); + const absoluteFileUrl = new URL('./fixtures/libsql-remote/temp/absolute.db', import.meta.url); // Remove the file if it exists to avoid conflict between test runs await rm(absoluteFileUrl, { force: true }); @@ -48,7 +48,7 @@ describe('astro:db local database', () => { before(async () => { clearEnvironment(); - const absoluteFileUrl = new URL('./fixtures/libsql-remote/dist/relative.db', import.meta.url); + const absoluteFileUrl = new URL('./fixtures/libsql-remote/temp/relative.db', import.meta.url); const prodDbPath = relative(process.cwd(), fileURLToPath(absoluteFileUrl)); // Remove the file if it exists to avoid conflict between test runs diff --git a/packages/integrations/cloudflare/test/_test-utils.js b/packages/integrations/cloudflare/test/_test-utils.js index 381c66a8b8b0..1981d495384f 100644 --- a/packages/integrations/cloudflare/test/_test-utils.js +++ b/packages/integrations/cloudflare/test/_test-utils.js @@ -6,7 +6,7 @@ import { loadFixture as baseLoadFixture } from '../../../astro/test/test-utils.j * @typedef {{ stop: Promise, port: number }} WranglerCLI */ -const astroPath = fileURLToPath(new URL('../node_modules/astro/astro.js', import.meta.url)); +const astroPath = fileURLToPath(new URL('../node_modules/astro/bin/astro.mjs', import.meta.url)); /** Returns a process running the Astro CLI. */ export function astroCli(cwd, /** @type {string[]} */ ...args) { const spawned = execa(astroPath, [...args], { diff --git a/packages/integrations/markdoc/package.json b/packages/integrations/markdoc/package.json index 70e5e5f20979..dd33fe348c26 100644 --- a/packages/integrations/markdoc/package.json +++ b/packages/integrations/markdoc/package.json @@ -82,7 +82,7 @@ "vite": "^6.3.6" }, "engines": { - "node": "18.20.8 || ^20.3.0 || >=22.0.0" + "node": "^20.19.5 || >=22.0.0" }, "publishConfig": { "provenance": true diff --git a/packages/integrations/mdx/package.json b/packages/integrations/mdx/package.json index c2816713157a..bed6e0004f60 100644 --- a/packages/integrations/mdx/package.json +++ b/packages/integrations/mdx/package.json @@ -72,7 +72,7 @@ "vite": "^6.3.6" }, "engines": { - "node": "18.20.8 || ^20.3.0 || >=22.0.0" + "node": "^20.19.5 || >=22.0.0" }, "publishConfig": { "provenance": true diff --git a/packages/integrations/netlify/src/polyfill.ts b/packages/integrations/netlify/src/polyfill.ts deleted file mode 100644 index dc00f45d7fd9..000000000000 --- a/packages/integrations/netlify/src/polyfill.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { applyPolyfills } from 'astro/app/node'; - -applyPolyfills(); diff --git a/packages/integrations/netlify/src/ssr-function.ts b/packages/integrations/netlify/src/ssr-function.ts index bc7d712f5ad1..2a21ced61b63 100644 --- a/packages/integrations/netlify/src/ssr-function.ts +++ b/packages/integrations/netlify/src/ssr-function.ts @@ -1,6 +1,3 @@ -// Keep at the top -import './polyfill.js'; - import type { Context } from '@netlify/functions'; import type { SSRManifest } from 'astro'; import { App } from 'astro/app'; @@ -46,7 +43,7 @@ export const createExports = (manifest: SSRManifest, { middlewareSecret }: Args) const response = await app.render(request, { routeData, locals, - clientAddress: context.ip + clientAddress: context.ip, }); if (app.setCookieHeaders) { diff --git a/packages/integrations/node/src/log-listening-on.ts b/packages/integrations/node/src/log-listening-on.ts index 805f568ab5a6..e93f3692972e 100644 --- a/packages/integrations/node/src/log-listening-on.ts +++ b/packages/integrations/node/src/log-listening-on.ts @@ -57,14 +57,7 @@ function getNetworkAddress( }; Object.values(os.networkInterfaces()) .flatMap((nInterface) => nInterface ?? []) - .filter( - (detail) => - detail && - detail.address && - (detail.family === 'IPv4' || - // @ts-expect-error Node 18.0 - 18.3 returns number - detail.family === 4), - ) + .filter((detail) => detail && detail.address && detail.family === 'IPv4') .forEach((detail) => { let host = detail.address.replace( '127.0.0.1', diff --git a/packages/integrations/node/src/polyfill.ts b/packages/integrations/node/src/polyfill.ts deleted file mode 100644 index dc00f45d7fd9..000000000000 --- a/packages/integrations/node/src/polyfill.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { applyPolyfills } from 'astro/app/node'; - -applyPolyfills(); diff --git a/packages/integrations/node/src/server.ts b/packages/integrations/node/src/server.ts index 5706e2cb5e74..68eb5cb66ef6 100644 --- a/packages/integrations/node/src/server.ts +++ b/packages/integrations/node/src/server.ts @@ -1,6 +1,3 @@ -// Keep at the top -import './polyfill.js'; - import { existsSync, readFileSync } from 'node:fs'; import type { NodeAppHeadersJson, SSRManifest } from 'astro'; import { NodeApp } from 'astro/app/node'; diff --git a/packages/integrations/preact/package.json b/packages/integrations/preact/package.json index 4aeeeda068d0..fb555e3a3bdf 100644 --- a/packages/integrations/preact/package.json +++ b/packages/integrations/preact/package.json @@ -49,7 +49,7 @@ "preact": "^10.6.5" }, "engines": { - "node": "18.20.8 || ^20.3.0 || >=22.0.0" + "node": "^20.19.5 || >=22.0.0" }, "publishConfig": { "provenance": true diff --git a/packages/integrations/react/package.json b/packages/integrations/react/package.json index ccdbf0b60470..4d01cf0c34cc 100644 --- a/packages/integrations/react/package.json +++ b/packages/integrations/react/package.json @@ -59,7 +59,7 @@ "react-dom": "^17.0.2 || ^18.0.0 || ^19.0.0" }, "engines": { - "node": "18.20.8 || ^20.3.0 || >=22.0.0" + "node": "^20.19.5 || >=22.0.0" }, "publishConfig": { "provenance": true diff --git a/packages/integrations/solid/package.json b/packages/integrations/solid/package.json index f77db74f810e..c2dc568243f8 100644 --- a/packages/integrations/solid/package.json +++ b/packages/integrations/solid/package.json @@ -52,7 +52,7 @@ } }, "engines": { - "node": "18.20.8 || ^20.3.0 || >=22.0.0" + "node": "^20.19.5 || >=22.0.0" }, "publishConfig": { "provenance": true diff --git a/packages/integrations/svelte/package.json b/packages/integrations/svelte/package.json index fbb8c7d9eb72..b99b12cb993c 100644 --- a/packages/integrations/svelte/package.json +++ b/packages/integrations/svelte/package.json @@ -52,7 +52,7 @@ "typescript": "^5.3.3" }, "engines": { - "node": "18.20.8 || ^20.3.0 || >=22.0.0" + "node": "^20.19.5 || >=22.0.0" }, "publishConfig": { "provenance": true diff --git a/packages/integrations/vercel/src/serverless/entrypoint.ts b/packages/integrations/vercel/src/serverless/entrypoint.ts index a99911f23ab2..087aa40bcb1b 100644 --- a/packages/integrations/vercel/src/serverless/entrypoint.ts +++ b/packages/integrations/vercel/src/serverless/entrypoint.ts @@ -1,5 +1,3 @@ -// Keep at the top -import './polyfill.js'; import type { IncomingMessage, ServerResponse } from 'node:http'; import type { SSRManifest } from 'astro'; import { NodeApp } from 'astro/app/node'; diff --git a/packages/integrations/vercel/src/serverless/polyfill.ts b/packages/integrations/vercel/src/serverless/polyfill.ts deleted file mode 100644 index dc00f45d7fd9..000000000000 --- a/packages/integrations/vercel/src/serverless/polyfill.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { applyPolyfills } from 'astro/app/node'; - -applyPolyfills(); diff --git a/packages/markdown/remark/package.json b/packages/markdown/remark/package.json index 6bde2c991452..63abae114a0f 100644 --- a/packages/markdown/remark/package.json +++ b/packages/markdown/remark/package.json @@ -37,7 +37,6 @@ "github-slugger": "^2.0.0", "hast-util-from-html": "^2.0.3", "hast-util-to-text": "^4.0.2", - "import-meta-resolve": "^4.2.0", "js-yaml": "^4.1.0", "mdast-util-definitions": "^6.0.0", "rehype-raw": "^7.0.0", diff --git a/packages/markdown/remark/src/import-plugin-default.ts b/packages/markdown/remark/src/import-plugin-default.ts index 2b898aa9376d..94dd71433aaa 100644 --- a/packages/markdown/remark/src/import-plugin-default.ts +++ b/packages/markdown/remark/src/import-plugin-default.ts @@ -1,10 +1,12 @@ +// This file should be imported as `#import-plugin` + +import { createRequire } from 'node:module'; import path from 'node:path'; import { pathToFileURL } from 'node:url'; -// This file should be imported as `#import-plugin` -import { resolve as importMetaResolve } from 'import-meta-resolve'; import type * as unified from 'unified'; let cwdUrlStr: string | undefined; +const require = createRequire(import.meta.url); // In non-browser environments, we can try to resolve from the filesystem too export async function importPlugin(p: string): Promise { @@ -16,7 +18,7 @@ export async function importPlugin(p: string): Promise { // Try import from user project cwdUrlStr ??= pathToFileURL(path.join(process.cwd(), 'package.json')).toString(); - const resolved = importMetaResolve(p, cwdUrlStr); + const resolved = pathToFileURL(require.resolve(p, { paths: [cwdUrlStr] })).toString(); const importResult = await import(/* @vite-ignore */ resolved); return importResult.default; } diff --git a/packages/upgrade/package.json b/packages/upgrade/package.json index a42727f0c895..6b0a5153850a 100644 --- a/packages/upgrade/package.json +++ b/packages/upgrade/package.json @@ -40,6 +40,6 @@ "astro-scripts": "workspace:*" }, "engines": { - "node": "18.20.8 || ^20.3.0 || >=22.0.0" + "node": "^20.19.5 || >=22.0.0" } } diff --git a/packages/upgrade/upgrade.mjs b/packages/upgrade/upgrade.mjs index 5e25e5e94a3d..6a7359eb4f0c 100755 --- a/packages/upgrade/upgrade.mjs +++ b/packages/upgrade/upgrade.mjs @@ -4,7 +4,9 @@ const currentVersion = process.versions.node; const requiredMajorVersion = parseInt(currentVersion.split('.')[0], 10); -const minimumMajorVersion = 18; +// TODO: remove once Stackblitz supports Node 22 +const IS_STACKBLITZ = !!process.versions.webcontainer; +const minimumMajorVersion = IS_STACKBLITZ ? 20 : 22; if (requiredMajorVersion < minimumMajorVersion) { console.error(`Node.js v${currentVersion} is out of date and unsupported!`); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b370a4ef9ae8..26be391e0b57 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,7 +5,6 @@ settings: excludeLinksFromLockfile: false overrides: - undici: ^6.21.3 wrangler: 4.14.1 importers: @@ -560,9 +559,6 @@ importers: http-cache-semantics: specifier: ^4.2.0 version: 4.2.0 - import-meta-resolve: - specifier: ^4.2.0 - version: 4.2.0 js-yaml: specifier: ^4.1.0 version: 4.1.0 @@ -6295,9 +6291,6 @@ importers: hast-util-to-text: specifier: ^4.0.2 version: 4.0.2 - import-meta-resolve: - specifier: ^4.2.0 - version: 4.2.0 js-yaml: specifier: ^4.1.0 version: 4.1.0 @@ -7879,6 +7872,10 @@ packages: '@fastify/accept-negotiator@2.0.1': resolution: {integrity: sha512-/c/TW2bO/v9JeEgoD/g1G5GxGeCF1Hafdf79WPmUlgYiBXummY0oX3VVq4yFkKKVBKDNlaDUYoab7g38RpPqCQ==} + '@fastify/busboy@2.1.1': + resolution: {integrity: sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==} + engines: {node: '>=14'} + '@fastify/busboy@3.2.0': resolution: {integrity: sha512-m9FVDXU3GT2ITSe0UaMA5rU3QkfC/UXtCU8y0gSN/GugTqtVldOBWIB5V6V3sbmenVZUIpU6f+mPEO2+m5iTaA==} @@ -11134,9 +11131,6 @@ packages: resolution: {integrity: sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==} engines: {node: '>=6'} - import-meta-resolve@4.2.0: - resolution: {integrity: sha512-Iqv2fzaTQN28s/FwZAoFq0ZSs/7hMAHJVX+w8PZl3cY19Pxk6jFFalxQoIfW2826i/fDLXv8IiEZRIT0lDuWcg==} - imurmurhash@0.1.4: resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} engines: {node: '>=0.8.19'} @@ -13520,10 +13514,18 @@ packages: undici-types@6.21.0: resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==} + undici@5.29.0: + resolution: {integrity: sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==} + engines: {node: '>=14.0'} + undici@6.21.3: resolution: {integrity: sha512-gBLkYIlEnSp8pFbT64yFgGE6UIB9tAkhukC23PmMDCe5Nd+cRqKxSjw5y54MK2AZMgZfJWMaNE4nYUHgi1XEOw==} engines: {node: '>=18.17'} + undici@7.16.0: + resolution: {integrity: sha512-QEg3HPMll0o3t2ourKwOeUAZ159Kn9mx5pnzHRQO8+Wixmh88YdZRiIwat0iNzNNXn0yoEtXJqFpyW7eM8BV7g==} + engines: {node: '>=20.18.1'} + unenv@2.0.0-rc.15: resolution: {integrity: sha512-J/rEIZU8w6FOfLNz/hNKsnY+fFHWnu9MH4yRbSZF3xbbGHovcetXPs7sD+9p8L6CeNC//I9bhRYAOsBt2u7/OA==} @@ -15538,6 +15540,8 @@ snapshots: '@fastify/accept-negotiator@2.0.1': {} + '@fastify/busboy@2.1.1': {} + '@fastify/busboy@3.2.0': {} '@fontsource/monofett@5.2.6': {} @@ -17685,7 +17689,7 @@ snapshots: parse5: 7.3.0 parse5-htmlparser2-tree-adapter: 7.1.0 parse5-parser-stream: 7.1.2 - undici: 6.21.3 + undici: 7.16.0 whatwg-mimetype: 4.0.0 chokidar@4.0.3: @@ -19112,8 +19116,6 @@ snapshots: parent-module: 1.0.1 resolve-from: 4.0.0 - import-meta-resolve@4.2.0: {} - imurmurhash@0.1.4: {} indent-string@5.0.0: {} @@ -20144,7 +20146,7 @@ snapshots: exit-hook: 2.2.1 glob-to-regexp: 0.4.1 stoppable: 1.1.0 - undici: 6.21.3 + undici: 5.29.0 workerd: 1.20250428.0 ws: 8.18.0 youch: 3.3.4 @@ -21994,8 +21996,14 @@ snapshots: undici-types@6.21.0: {} + undici@5.29.0: + dependencies: + '@fastify/busboy': 2.1.1 + undici@6.21.3: {} + undici@7.16.0: {} + unenv@2.0.0-rc.15: dependencies: defu: 6.1.4 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 42557f8621aa..c3c82fd1ae14 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -11,8 +11,6 @@ packages: - '!**/.vercel/**' # TODO: remove in Astro 6 overrides: - # Cheerio uses ^7, which requires node 20 - 'undici': '^6.21.3' # A later wrangler minor dropeed support for node 18 'wrangler': '4.14.1' # Wait until three days after release to install new versions of packages diff --git a/scripts/cmd/build.js b/scripts/cmd/build.js index 3eb982e105f0..ca0a8fee6446 100644 --- a/scripts/cmd/build.js +++ b/scripts/cmd/build.js @@ -9,7 +9,8 @@ const defaultConfig = { minify: false, format: 'esm', platform: 'node', - target: 'node18', + // TODO: update once Stackblitz supports Node 22 + target: 'node20', sourcemap: false, sourcesContent: false, }; diff --git a/scripts/smoke/check.js b/scripts/smoke/check.js index 9f00384681ed..1f199aac21a1 100644 --- a/scripts/smoke/check.js +++ b/scripts/smoke/check.js @@ -33,7 +33,7 @@ function checkExamples() { const originalConfig = prepareExample(example.name); let data = ''; - const child = spawn('node', ['../../packages/astro/astro.js', 'check'], { + const child = spawn('node', ['../../packages/astro/bin/astro.mjs', 'check'], { cwd: path.join('./examples', example.name), env: { ...process.env, FORCE_COLOR: 'true' }, });