From d0679a666f37da0fca396d42b9b32bbb25d29312 Mon Sep 17 00:00:00 2001 From: Erika <3019731+Princesseuh@users.noreply.github.com> Date: Mon, 24 Jul 2023 20:47:07 +0200 Subject: [PATCH] Remove support for Node 16 (#7780) --- .changeset/afraid-dots-whisper.md | 32 +++++++++++++++++++ .github/ISSUE_TEMPLATE/---01-bug-report.yml | 2 +- .github/workflows/check.yml | 2 +- .github/workflows/ci.yml | 14 ++++---- .github/workflows/main.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/scripts.yml | 2 +- .github/workflows/snapshot-release.yml | 2 +- .nvmrc | 2 +- CONTRIBUTING.md | 2 +- benchmark/packages/timer/tsconfig.json | 4 +-- package.json | 6 ++-- packages/astro-prism/package.json | 4 +-- packages/astro-prism/tsconfig.json | 2 +- packages/astro-rss/tsconfig.json | 2 +- packages/astro/astro.js | 4 +-- packages/astro/package.json | 6 ++-- .../src/core/build/plugins/plugin-analyzer.ts | 3 +- .../vite-plugin-astro-postprocess/index.ts | 3 +- packages/astro/tsconfig.json | 2 +- packages/create-astro/package.json | 2 +- packages/create-astro/tsconfig.json | 2 +- packages/integrations/alpinejs/tsconfig.json | 2 +- packages/integrations/cloudflare/package.json | 2 +- .../integrations/cloudflare/tsconfig.json | 2 +- packages/integrations/deno/tsconfig.json | 4 ++- packages/integrations/image/tsconfig.json | 2 +- packages/integrations/lit/tsconfig.json | 2 +- packages/integrations/markdoc/package.json | 4 +-- .../markdoc/src/content-entry-type.ts | 7 ++-- .../markdoc/src/extensions/prism.ts | 7 ++-- .../markdoc/src/extensions/shiki.ts | 7 ++-- packages/integrations/markdoc/src/runtime.ts | 3 +- packages/integrations/markdoc/tsconfig.json | 4 +-- packages/integrations/mdx/package.json | 2 +- .../mdx/src/remark-images-to-component.ts | 2 +- packages/integrations/mdx/tsconfig.json | 2 +- packages/integrations/netlify/package.json | 2 +- packages/integrations/netlify/tsconfig.json | 2 +- packages/integrations/node/tsconfig.json | 2 +- packages/integrations/partytown/tsconfig.json | 2 +- packages/integrations/preact/package.json | 2 +- packages/integrations/preact/tsconfig.json | 2 +- packages/integrations/prefetch/tsconfig.json | 2 +- packages/integrations/react/package.json | 2 +- packages/integrations/react/tsconfig.json | 2 +- packages/integrations/sitemap/tsconfig.json | 2 +- packages/integrations/solid/package.json | 2 +- packages/integrations/solid/tsconfig.json | 2 +- packages/integrations/svelte/package.json | 2 +- packages/integrations/svelte/tsconfig.json | 2 +- packages/integrations/tailwind/tsconfig.json | 2 +- .../integrations/turbolinks/tsconfig.json | 2 +- packages/integrations/vercel/package.json | 2 +- .../vercel/src/image/dev-service.ts | 5 +-- packages/integrations/vercel/tsconfig.json | 2 +- packages/integrations/vue/package.json | 2 +- packages/integrations/vue/tsconfig.json | 2 +- packages/internal-helpers/tsconfig.json | 2 +- packages/telemetry/package.json | 7 ++-- packages/telemetry/src/config.ts | 1 + packages/telemetry/tsconfig.json | 2 +- packages/underscore-redirects/tsconfig.json | 2 +- packages/webapi/package.json | 2 +- packages/webapi/tsconfig.json | 2 +- scripts/cmd/build.js | 2 +- scripts/package.json | 2 +- tsconfig.base.json | 3 +- 68 files changed, 129 insertions(+), 95 deletions(-) create mode 100644 .changeset/afraid-dots-whisper.md diff --git a/.changeset/afraid-dots-whisper.md b/.changeset/afraid-dots-whisper.md new file mode 100644 index 000000000000..81da436ad6d6 --- /dev/null +++ b/.changeset/afraid-dots-whisper.md @@ -0,0 +1,32 @@ +--- +'@astrojs/cloudflare': major +'@astrojs/partytown': major +'@astrojs/tailwind': major +'@astrojs/netlify': major +'@astrojs/sitemap': major +'@astrojs/preact': major +'@astrojs/svelte': major +'@astrojs/vercel': major +'@astrojs/react': major +'@astrojs/solid-js': major +'@astrojs/deno': major +'@astrojs/node': major +'@astrojs/lit': major +'@astrojs/vue': major +'create-astro': major +'@astrojs/prism': major +'@astrojs/rss': major +'@astrojs/telemetry': major +'@astrojs/webapi': major +'astro': major +'@astrojs/turbolinks': minor +'@astrojs/alpinejs': minor +'@astrojs/prefetch': minor +'@astrojs/markdoc': minor +'@astrojs/underscore-redirects': minor +'@astrojs/image': minor +'@astrojs/mdx': minor +'@astrojs/internal-helpers': minor +--- + +Remove support for Node 16. The lowest supported version by Astro and all integrations is now v18.14.1. As a reminder, Node 16 will be deprecated on the 11th September 2023. diff --git a/.github/ISSUE_TEMPLATE/---01-bug-report.yml b/.github/ISSUE_TEMPLATE/---01-bug-report.yml index a9786522b28f..15bc784f4354 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 supports ESM (`v14.18.0+`, or `v16.12.0+`) + ✅ I am using a version of Node that Astro supports (`>=18.14.1`) - type: input id: astro-version attributes: diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 9150b5f1e2ab..268c577ce525 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -34,7 +34,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 cache: "pnpm" - name: Install dependencies diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 329835b8035e..01c573e10382 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,7 @@ jobs: strategy: matrix: OS: [ubuntu-latest, windows-latest] - NODE_VERSION: [16] + NODE_VERSION: [18] fail-fast: true steps: # Disable crlf so all OS can share the same Turbo cache @@ -85,7 +85,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 cache: "pnpm" - name: Install dependencies @@ -108,12 +108,12 @@ jobs: strategy: matrix: OS: [ubuntu-latest] - NODE_VERSION: [16, 18] + NODE_VERSION: [18, 20] include: - os: macos-latest - NODE_VERSION: 16 + NODE_VERSION: 18 - os: windows-latest - NODE_VERSION: 16 + NODE_VERSION: 18 fail-fast: false env: NODE_VERSION: ${{ matrix.NODE_VERSION }} @@ -155,7 +155,7 @@ jobs: strategy: matrix: OS: [ubuntu-latest, windows-latest] - NODE_VERSION: [16] + NODE_VERSION: [18] fail-fast: false env: NODE_VERSION: ${{ matrix.NODE_VERSION }} @@ -192,7 +192,7 @@ jobs: strategy: matrix: OS: [ubuntu-latest, windows-latest] - NODE_VERSION: [16] + NODE_VERSION: [18] env: NODE_VERSION: ${{ matrix.NODE_VERSION }} steps: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e58b6897505f..961f4d9977be 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,7 +38,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 cache: "pnpm" - name: Install dependencies diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b0d30a0203e4..f952f6c6b0f8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,7 +30,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 cache: "pnpm" - name: Install dependencies diff --git a/.github/workflows/scripts.yml b/.github/workflows/scripts.yml index 056bf4e0acce..a22ec467bcbd 100644 --- a/.github/workflows/scripts.yml +++ b/.github/workflows/scripts.yml @@ -37,7 +37,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 cache: "pnpm" - name: Install dependencies diff --git a/.github/workflows/snapshot-release.yml b/.github/workflows/snapshot-release.yml index 5504978c61ee..29f8c7f11936 100644 --- a/.github/workflows/snapshot-release.yml +++ b/.github/workflows/snapshot-release.yml @@ -58,7 +58,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 registry-url: "https://registry.npmjs.org" cache: "pnpm" diff --git a/.nvmrc b/.nvmrc index e65243f2ea37..617bcf916bf1 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16.19.0 +18.14.1 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 25baacecb52e..c433a6833ca2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,7 +10,7 @@ We welcome contributions of any size and skill level. As an open source project, ### Prerequisites ```shell -node: "^>=16.12.0" +node: "^>=18.14.1" pnpm: "^8.6.2" # otherwise, your build will fail ``` diff --git a/benchmark/packages/timer/tsconfig.json b/benchmark/packages/timer/tsconfig.json index 44baf375c882..af1b43564edc 100644 --- a/benchmark/packages/timer/tsconfig.json +++ b/benchmark/packages/timer/tsconfig.json @@ -3,8 +3,8 @@ "include": ["src"], "compilerOptions": { "allowJs": true, - "module": "ES2020", + "module": "ES2022", "outDir": "./dist", - "target": "ES2020" + "target": "ES2022" } } diff --git a/package.json b/package.json index 5ee1460e419a..0f590c509d4f 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "packages/*" ], "engines": { - "node": ">=16.12.0", + "node": ">=18.14.1", "pnpm": ">=8.6.2" }, "packageManager": "pnpm@8.6.2", @@ -82,7 +82,7 @@ "@types/node": "^18.16.18", "@typescript-eslint/eslint-plugin": "6.0.0", "@typescript-eslint/parser": "6.0.0", - "esbuild": "^0.17.19", + "esbuild": "^0.18.16", "eslint": "^8.43.0", "eslint-config-prettier": "^8.8.0", "eslint-plugin-no-only-tests": "^2.6.0", @@ -93,6 +93,6 @@ "prettier-plugin-astro": "^0.10.0", "tiny-glob": "^0.2.9", "turbo": "^1.10.3", - "typescript": "~5.0.2" + "typescript": "~5.1.6" } } diff --git a/packages/astro-prism/package.json b/packages/astro-prism/package.json index 4ad55bf7f710..278d52482118 100644 --- a/packages/astro-prism/package.json +++ b/packages/astro-prism/package.json @@ -14,7 +14,7 @@ "homepage": "https://docs.astro.build/en/reference/api-reference/#prism-", "main": "dist/index.js", "scripts": { - "build": "astro-scripts build \"src/**/*.ts\" && tsc", + "build": "astro-scripts build \"src/**/*.ts\" && tsc -p ./tsconfig.json", "build:ci": "astro-scripts build \"src/**/*.ts\"", "dev": "astro-scripts dev \"src/**/*.ts\"" }, @@ -39,6 +39,6 @@ "astro-scripts": "workspace:*" }, "engines": { - "node": ">=16.12.0" + "node": ">=18.14.1" } } diff --git a/packages/astro-prism/tsconfig.json b/packages/astro-prism/tsconfig.json index 569016e9d844..fd652e629fc1 100644 --- a/packages/astro-prism/tsconfig.json +++ b/packages/astro-prism/tsconfig.json @@ -3,7 +3,7 @@ "include": ["src"], "compilerOptions": { "allowJs": true, - "target": "ES2021", + "target": "ES2022", "module": "ES2022", "outDir": "./dist" } diff --git a/packages/astro-rss/tsconfig.json b/packages/astro-rss/tsconfig.json index f9da2a5bd15d..d8efd2fecb25 100644 --- a/packages/astro-rss/tsconfig.json +++ b/packages/astro-rss/tsconfig.json @@ -5,7 +5,7 @@ "allowJs": true, "module": "ES2022", "outDir": "./dist", - "target": "ES2021", + "target": "ES2022", "strictNullChecks": true } } diff --git a/packages/astro/astro.js b/packages/astro/astro.js index 37ea869bcae7..631a7b9c8eea 100755 --- a/packages/astro/astro.js +++ b/packages/astro/astro.js @@ -13,8 +13,8 @@ const CI_INSTRUCTIONS = { }; // Hardcode supported Node.js version so we don't have to read differently in CJS & ESM. -const engines = '>=16.12.0'; -const skipSemverCheckIfAbove = 16; +const engines = '>=18.14.1'; +const skipSemverCheckIfAbove = 19; /** `astro *` */ async function main() { diff --git a/packages/astro/package.json b/packages/astro/package.json index bf888e3ae063..469579caa6f2 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -141,8 +141,8 @@ "devalue": "^4.3.2", "diff": "^5.1.0", "es-module-lexer": "^1.3.0", - "esbuild": "^0.17.19", - "estree-walker": "3.0.0", + "esbuild": "^0.18.16", + "estree-walker": "^3.0.3", "execa": "^6.1.0", "fast-glob": "^3.2.12", "github-slugger": "^2.0.0", @@ -224,7 +224,7 @@ } }, "engines": { - "node": ">=16.12.0", + "node": ">=18.14.1", "npm": ">=6.14.0" } } diff --git a/packages/astro/src/core/build/plugins/plugin-analyzer.ts b/packages/astro/src/core/build/plugins/plugin-analyzer.ts index c05328005fe7..b62de1a2b90a 100644 --- a/packages/astro/src/core/build/plugins/plugin-analyzer.ts +++ b/packages/astro/src/core/build/plugins/plugin-analyzer.ts @@ -1,3 +1,4 @@ +import type { Node as ESTreeNode } from 'estree-walker'; import type { ModuleInfo, PluginContext } from 'rollup'; import type { Plugin as VitePlugin } from 'vite'; import type { PluginMetadata as AstroPluginMetadata } from '../../../vite-plugin-astro/types'; @@ -36,7 +37,7 @@ async function doesParentImportChild( const imports: Array = []; const exports: Array = []; - walk(parentInfo.ast, { + walk(parentInfo.ast as ESTreeNode, { enter(node) { if (node.type === 'ImportDeclaration') { imports.push(node as ImportDeclaration); diff --git a/packages/astro/src/vite-plugin-astro-postprocess/index.ts b/packages/astro/src/vite-plugin-astro-postprocess/index.ts index 9a2e185af6c8..39acd000c570 100644 --- a/packages/astro/src/vite-plugin-astro-postprocess/index.ts +++ b/packages/astro/src/vite-plugin-astro-postprocess/index.ts @@ -1,4 +1,5 @@ import { parse } from 'acorn'; +import type { Node as ESTreeNode } from 'estree-walker'; import { walk } from 'estree-walker'; import MagicString from 'magic-string'; import type { Plugin } from 'vite'; @@ -28,7 +29,7 @@ export default function astro(): Plugin { sourceType: 'module', }); - walk(ast, { + walk(ast as ESTreeNode, { enter(node: any) { // Transform `Astro.glob("./pages/*.astro")` to `Astro.glob(import.meta.glob("./pages/*.astro"), () => "./pages/*.astro")` // Also handle for `Astro2.glob()` diff --git a/packages/astro/tsconfig.json b/packages/astro/tsconfig.json index 839239eafa22..63854a31decc 100644 --- a/packages/astro/tsconfig.json +++ b/packages/astro/tsconfig.json @@ -6,7 +6,7 @@ "declarationDir": "./dist", "module": "ES2022", "outDir": "./dist", - "target": "ES2021", + "target": "ES2022", "jsx": "preserve", "types": ["@types/dom-view-transitions", "network-information-types"] } diff --git a/packages/create-astro/package.json b/packages/create-astro/package.json index 3d4aa6d7fd5e..38eaaed7a1fa 100644 --- a/packages/create-astro/package.json +++ b/packages/create-astro/package.json @@ -47,6 +47,6 @@ "strip-json-comments": "^5.0.0" }, "engines": { - "node": ">=16.12.0" + "node": ">=18.14.1" } } diff --git a/packages/create-astro/tsconfig.json b/packages/create-astro/tsconfig.json index 720167fad4a1..1ab34c5a2010 100644 --- a/packages/create-astro/tsconfig.json +++ b/packages/create-astro/tsconfig.json @@ -5,7 +5,7 @@ "allowJs": true, "emitDeclarationOnly": false, "noEmit": true, - "target": "ES2021", + "target": "ES2022", "module": "ES2022", "outDir": "./dist", "declarationDir": "./dist/types" diff --git a/packages/integrations/alpinejs/tsconfig.json b/packages/integrations/alpinejs/tsconfig.json index 64d4ef454384..af1b43564edc 100644 --- a/packages/integrations/alpinejs/tsconfig.json +++ b/packages/integrations/alpinejs/tsconfig.json @@ -5,6 +5,6 @@ "allowJs": true, "module": "ES2022", "outDir": "./dist", - "target": "ES2021" + "target": "ES2022" } } diff --git a/packages/integrations/cloudflare/package.json b/packages/integrations/cloudflare/package.json index b44062aec140..5f935cfa2fb6 100644 --- a/packages/integrations/cloudflare/package.json +++ b/packages/integrations/cloudflare/package.json @@ -41,7 +41,7 @@ "dependencies": { "@astrojs/underscore-redirects": "^0.2.0", "@cloudflare/workers-types": "^4.20230518.0", - "esbuild": "^0.17.19", + "esbuild": "^0.18.16", "tiny-glob": "^0.2.9" }, "peerDependencies": { diff --git a/packages/integrations/cloudflare/tsconfig.json b/packages/integrations/cloudflare/tsconfig.json index 64d4ef454384..af1b43564edc 100644 --- a/packages/integrations/cloudflare/tsconfig.json +++ b/packages/integrations/cloudflare/tsconfig.json @@ -5,6 +5,6 @@ "allowJs": true, "module": "ES2022", "outDir": "./dist", - "target": "ES2021" + "target": "ES2022" } } diff --git a/packages/integrations/deno/tsconfig.json b/packages/integrations/deno/tsconfig.json index 64d4ef454384..f3c96447a6a1 100644 --- a/packages/integrations/deno/tsconfig.json +++ b/packages/integrations/deno/tsconfig.json @@ -5,6 +5,8 @@ "allowJs": true, "module": "ES2022", "outDir": "./dist", - "target": "ES2021" + "target": "ES2022", + // TODO: Due to the shim for Deno imports in `server.ts`, we can't use moduleResolution: 'bundler' or the types get very weird. + "moduleResolution": "Node" } } diff --git a/packages/integrations/image/tsconfig.json b/packages/integrations/image/tsconfig.json index 56b6b4e2d75e..0a210b9fcf21 100644 --- a/packages/integrations/image/tsconfig.json +++ b/packages/integrations/image/tsconfig.json @@ -5,7 +5,7 @@ "allowJs": true, "module": "ES2022", "outDir": "./dist", - "target": "ES2021", + "target": "ES2022", "typeRoots": ["node_modules/@types", "node_modules/@netlify"] } } diff --git a/packages/integrations/lit/tsconfig.json b/packages/integrations/lit/tsconfig.json index 64d4ef454384..af1b43564edc 100644 --- a/packages/integrations/lit/tsconfig.json +++ b/packages/integrations/lit/tsconfig.json @@ -5,6 +5,6 @@ "allowJs": true, "module": "ES2022", "outDir": "./dist", - "target": "ES2021" + "target": "ES2022" } } diff --git a/packages/integrations/markdoc/package.json b/packages/integrations/markdoc/package.json index 88797654366a..a39aa1874f7c 100644 --- a/packages/integrations/markdoc/package.json +++ b/packages/integrations/markdoc/package.json @@ -66,7 +66,7 @@ "@astrojs/internal-helpers": "^0.1.2", "@astrojs/prism": "^2.1.2", "@markdoc/markdoc": "^0.3.0", - "esbuild": "^0.17.19", + "esbuild": "^0.18.16", "github-slugger": "^2.0.0", "gray-matter": "^4.0.3", "htmlparser2": "^9.0.0", @@ -93,6 +93,6 @@ "vite": "^4.4.6" }, "engines": { - "node": ">=16.12.0" + "node": ">=18.14.1" } } diff --git a/packages/integrations/markdoc/src/content-entry-type.ts b/packages/integrations/markdoc/src/content-entry-type.ts index 52493fa7116c..b697e5d4093d 100644 --- a/packages/integrations/markdoc/src/content-entry-type.ts +++ b/packages/integrations/markdoc/src/content-entry-type.ts @@ -3,14 +3,14 @@ import Markdoc from '@markdoc/markdoc'; import type { AstroConfig, ContentEntryType } from 'astro'; import matter from 'gray-matter'; import fs from 'node:fs'; +import path from 'node:path'; import { fileURLToPath } from 'node:url'; +import type * as rollup from 'rollup'; import type { ErrorPayload as ViteErrorPayload } from 'vite'; import type { ComponentConfig } from './config.js'; import { MarkdocError, isComponentConfig, isValidUrl, prependForwardSlash } from './utils.js'; // @ts-expect-error Cannot get the types here without `moduleResolution: 'nodenext'` import { emitESMImage } from 'astro/assets/utils'; -import path from 'node:path'; -import type * as rollup from 'rollup'; import { htmlTokenTransform } from './html/transform/html-token-transform.js'; import type { MarkdocConfigResult } from './load-config.js'; import type { MarkdocIntegrationOptions } from './options.js'; @@ -198,8 +198,7 @@ async function emitOptimizedImages( const src = await emitESMImage( resolved.id, ctx.pluginContext.meta.watchMode, - ctx.pluginContext.emitFile, - { config: ctx.astroConfig } + ctx.pluginContext.emitFile ); node.attributes.__optimizedSrc = src; } else { diff --git a/packages/integrations/markdoc/src/extensions/prism.ts b/packages/integrations/markdoc/src/extensions/prism.ts index e28112c9a2c1..5cfd628caaaf 100644 --- a/packages/integrations/markdoc/src/extensions/prism.ts +++ b/packages/integrations/markdoc/src/extensions/prism.ts @@ -1,8 +1,5 @@ -// leave space, so organize imports doesn't mess up comments -// @ts-expect-error Cannot find module 'astro/runtime/server/index.js' or its corresponding type declarations. -import { unescapeHTML } from 'astro/runtime/server/index.js'; - import { runHighlighterWithAstro } from '@astrojs/prism/dist/highlighter'; +import { unescapeHTML } from 'astro/runtime/server/index.js'; import { Markdoc, type AstroMarkdocConfig } from '../config.js'; export default function prism(): AstroMarkdocConfig { @@ -16,7 +13,7 @@ export default function prism(): AstroMarkdocConfig { // Use `unescapeHTML` to return `HTMLString` for Astro renderer to inline as HTML return unescapeHTML( `
${html}
` - ); + ) as any; }, }, }, diff --git a/packages/integrations/markdoc/src/extensions/shiki.ts b/packages/integrations/markdoc/src/extensions/shiki.ts index 1229a09fb719..a553a6bae84f 100644 --- a/packages/integrations/markdoc/src/extensions/shiki.ts +++ b/packages/integrations/markdoc/src/extensions/shiki.ts @@ -1,9 +1,6 @@ -// leave space, so organize imports doesn't mess up comments -// @ts-expect-error Cannot find module 'astro/runtime/server/index.js' or its corresponding type declarations. -import { unescapeHTML } from 'astro/runtime/server/index.js'; - import Markdoc from '@markdoc/markdoc'; import type { ShikiConfig } from 'astro'; +import { unescapeHTML } from 'astro/runtime/server/index.js'; import type * as shikiTypes from 'shiki'; import { getHighlighter } from 'shiki'; import type { AstroMarkdocConfig } from '../config.js'; @@ -123,7 +120,7 @@ export default async function shiki({ } // Use `unescapeHTML` to return `HTMLString` for Astro renderer to inline as HTML - return unescapeHTML(html); + return unescapeHTML(html) as any; }, }, }, diff --git a/packages/integrations/markdoc/src/runtime.ts b/packages/integrations/markdoc/src/runtime.ts index 1792d6caf68c..60057f53ad61 100644 --- a/packages/integrations/markdoc/src/runtime.ts +++ b/packages/integrations/markdoc/src/runtime.ts @@ -6,7 +6,6 @@ import Markdoc, { type RenderableTreeNode, } from '@markdoc/markdoc'; import type { AstroInstance } from 'astro'; -// @ts-expect-error Cannot find module 'astro/runtime/server/index.js' or its corresponding type declarations. import { createComponent, renderComponent } from 'astro/runtime/server/index.js'; import type { AstroMarkdocConfig } from './config.js'; import { setupHeadingConfig } from './heading-ids.js'; @@ -204,7 +203,7 @@ export function createContentComponent( return renderComponent(result, Renderer.name, Renderer, { stringifiedAst, config }, {}); }, propagation: 'self', - }); + } as any); } // statically define a partial MarkdocConfig which registers the required "html-tag" Markdoc tag when the "allowHTML" feature is enabled diff --git a/packages/integrations/markdoc/tsconfig.json b/packages/integrations/markdoc/tsconfig.json index 44baf375c882..af1b43564edc 100644 --- a/packages/integrations/markdoc/tsconfig.json +++ b/packages/integrations/markdoc/tsconfig.json @@ -3,8 +3,8 @@ "include": ["src"], "compilerOptions": { "allowJs": true, - "module": "ES2020", + "module": "ES2022", "outDir": "./dist", - "target": "ES2020" + "target": "ES2022" } } diff --git a/packages/integrations/mdx/package.json b/packages/integrations/mdx/package.json index 7e38cb1b6ebb..a10249d535ef 100644 --- a/packages/integrations/mdx/package.json +++ b/packages/integrations/mdx/package.json @@ -78,6 +78,6 @@ "vite": "^4.4.6" }, "engines": { - "node": ">=16.12.0" + "node": ">=18.14.1" } } diff --git a/packages/integrations/mdx/src/remark-images-to-component.ts b/packages/integrations/mdx/src/remark-images-to-component.ts index 8a3166f49e64..bb9657f42624 100644 --- a/packages/integrations/mdx/src/remark-images-to-component.ts +++ b/packages/integrations/mdx/src/remark-images-to-component.ts @@ -1,5 +1,5 @@ import type { MarkdownVFile } from '@astrojs/markdown-remark'; -import { type Image, type Parent } from 'mdast'; +import type { Image, Parent } from 'mdast'; import type { MdxJsxFlowElement, MdxjsEsm } from 'mdast-util-mdx'; import { visit } from 'unist-util-visit'; import { jsToTreeNode } from './utils.js'; diff --git a/packages/integrations/mdx/tsconfig.json b/packages/integrations/mdx/tsconfig.json index 64d4ef454384..af1b43564edc 100644 --- a/packages/integrations/mdx/tsconfig.json +++ b/packages/integrations/mdx/tsconfig.json @@ -5,6 +5,6 @@ "allowJs": true, "module": "ES2022", "outDir": "./dist", - "target": "ES2021" + "target": "ES2022" } } diff --git a/packages/integrations/netlify/package.json b/packages/integrations/netlify/package.json index 7c0ef47ce58d..99c69519e924 100644 --- a/packages/integrations/netlify/package.json +++ b/packages/integrations/netlify/package.json @@ -41,7 +41,7 @@ "@astrojs/underscore-redirects": "^0.2.0", "@astrojs/webapi": "^2.2.0", "@netlify/functions": "^1.6.0", - "esbuild": "^0.15.18" + "esbuild": "^0.18.16" }, "peerDependencies": { "astro": "workspace:^2.10.3" diff --git a/packages/integrations/netlify/tsconfig.json b/packages/integrations/netlify/tsconfig.json index 4442d4c3670a..66b0102c718d 100644 --- a/packages/integrations/netlify/tsconfig.json +++ b/packages/integrations/netlify/tsconfig.json @@ -5,7 +5,7 @@ "allowJs": true, "module": "ES2022", "outDir": "./dist", - "target": "ES2021", + "target": "ES2022", "typeRoots": ["node_modules/@types", "node_modules/@netlify"], "allowImportingTsExtensions": true } diff --git a/packages/integrations/node/tsconfig.json b/packages/integrations/node/tsconfig.json index 64d4ef454384..af1b43564edc 100644 --- a/packages/integrations/node/tsconfig.json +++ b/packages/integrations/node/tsconfig.json @@ -5,6 +5,6 @@ "allowJs": true, "module": "ES2022", "outDir": "./dist", - "target": "ES2021" + "target": "ES2022" } } diff --git a/packages/integrations/partytown/tsconfig.json b/packages/integrations/partytown/tsconfig.json index 64d4ef454384..af1b43564edc 100644 --- a/packages/integrations/partytown/tsconfig.json +++ b/packages/integrations/partytown/tsconfig.json @@ -5,6 +5,6 @@ "allowJs": true, "module": "ES2022", "outDir": "./dist", - "target": "ES2021" + "target": "ES2022" } } diff --git a/packages/integrations/preact/package.json b/packages/integrations/preact/package.json index 9efc7d2c53f3..391fdb547829 100644 --- a/packages/integrations/preact/package.json +++ b/packages/integrations/preact/package.json @@ -50,6 +50,6 @@ "preact": "^10.6.5" }, "engines": { - "node": ">=16.12.0" + "node": ">=18.14.1" } } diff --git a/packages/integrations/preact/tsconfig.json b/packages/integrations/preact/tsconfig.json index 64d4ef454384..af1b43564edc 100644 --- a/packages/integrations/preact/tsconfig.json +++ b/packages/integrations/preact/tsconfig.json @@ -5,6 +5,6 @@ "allowJs": true, "module": "ES2022", "outDir": "./dist", - "target": "ES2021" + "target": "ES2022" } } diff --git a/packages/integrations/prefetch/tsconfig.json b/packages/integrations/prefetch/tsconfig.json index 194a092ff4e2..6457dfe8c831 100644 --- a/packages/integrations/prefetch/tsconfig.json +++ b/packages/integrations/prefetch/tsconfig.json @@ -5,6 +5,6 @@ "allowJs": true, "module": "ES2022", "outDir": "./dist", - "target": "ES2021" + "target": "ES2022" } } diff --git a/packages/integrations/react/package.json b/packages/integrations/react/package.json index fa68cd5f0bfd..dbcdadca9579 100644 --- a/packages/integrations/react/package.json +++ b/packages/integrations/react/package.json @@ -62,6 +62,6 @@ "react-dom": "^17.0.2 || ^18.0.0" }, "engines": { - "node": ">=16.12.0" + "node": ">=18.14.1" } } diff --git a/packages/integrations/react/tsconfig.json b/packages/integrations/react/tsconfig.json index 64d4ef454384..af1b43564edc 100644 --- a/packages/integrations/react/tsconfig.json +++ b/packages/integrations/react/tsconfig.json @@ -5,6 +5,6 @@ "allowJs": true, "module": "ES2022", "outDir": "./dist", - "target": "ES2021" + "target": "ES2022" } } diff --git a/packages/integrations/sitemap/tsconfig.json b/packages/integrations/sitemap/tsconfig.json index 64d4ef454384..af1b43564edc 100644 --- a/packages/integrations/sitemap/tsconfig.json +++ b/packages/integrations/sitemap/tsconfig.json @@ -5,6 +5,6 @@ "allowJs": true, "module": "ES2022", "outDir": "./dist", - "target": "ES2021" + "target": "ES2022" } } diff --git a/packages/integrations/solid/package.json b/packages/integrations/solid/package.json index 407b0cc73b79..6f1db89e740e 100644 --- a/packages/integrations/solid/package.json +++ b/packages/integrations/solid/package.json @@ -47,6 +47,6 @@ "solid-js": "^1.4.3" }, "engines": { - "node": ">=16.12.0" + "node": ">=18.14.1" } } diff --git a/packages/integrations/solid/tsconfig.json b/packages/integrations/solid/tsconfig.json index 64d4ef454384..af1b43564edc 100644 --- a/packages/integrations/solid/tsconfig.json +++ b/packages/integrations/solid/tsconfig.json @@ -5,6 +5,6 @@ "allowJs": true, "module": "ES2022", "outDir": "./dist", - "target": "ES2021" + "target": "ES2022" } } diff --git a/packages/integrations/svelte/package.json b/packages/integrations/svelte/package.json index 295e1005415b..cb26aab3b348 100644 --- a/packages/integrations/svelte/package.json +++ b/packages/integrations/svelte/package.json @@ -52,6 +52,6 @@ "svelte": "^3.55.0 || ^4.0.0" }, "engines": { - "node": ">=16.12.0" + "node": ">=18.14.1" } } diff --git a/packages/integrations/svelte/tsconfig.json b/packages/integrations/svelte/tsconfig.json index 64d4ef454384..af1b43564edc 100644 --- a/packages/integrations/svelte/tsconfig.json +++ b/packages/integrations/svelte/tsconfig.json @@ -5,6 +5,6 @@ "allowJs": true, "module": "ES2022", "outDir": "./dist", - "target": "ES2021" + "target": "ES2022" } } diff --git a/packages/integrations/tailwind/tsconfig.json b/packages/integrations/tailwind/tsconfig.json index 64d4ef454384..af1b43564edc 100644 --- a/packages/integrations/tailwind/tsconfig.json +++ b/packages/integrations/tailwind/tsconfig.json @@ -5,6 +5,6 @@ "allowJs": true, "module": "ES2022", "outDir": "./dist", - "target": "ES2021" + "target": "ES2022" } } diff --git a/packages/integrations/turbolinks/tsconfig.json b/packages/integrations/turbolinks/tsconfig.json index 64d4ef454384..af1b43564edc 100644 --- a/packages/integrations/turbolinks/tsconfig.json +++ b/packages/integrations/turbolinks/tsconfig.json @@ -5,6 +5,6 @@ "allowJs": true, "module": "ES2022", "outDir": "./dist", - "target": "ES2021" + "target": "ES2022" } } diff --git a/packages/integrations/vercel/package.json b/packages/integrations/vercel/package.json index e18f4452cbc5..696243eef58b 100644 --- a/packages/integrations/vercel/package.json +++ b/packages/integrations/vercel/package.json @@ -55,7 +55,7 @@ "@astrojs/webapi": "^2.2.0", "@vercel/analytics": "^0.1.11", "@vercel/nft": "^0.22.6", - "esbuild": "^0.17.19", + "esbuild": "^0.18.16", "fast-glob": "^3.2.12", "set-cookie-parser": "^2.6.0", "web-vitals": "^3.3.2" diff --git a/packages/integrations/vercel/src/image/dev-service.ts b/packages/integrations/vercel/src/image/dev-service.ts index 04df9932a504..d812efb93fce 100644 --- a/packages/integrations/vercel/src/image/dev-service.ts +++ b/packages/integrations/vercel/src/image/dev-service.ts @@ -1,5 +1,4 @@ import type { LocalImageService } from 'astro'; -// @ts-expect-error import squooshService from 'astro/assets/services/squoosh'; import { sharedValidateOptions } from './shared'; @@ -14,7 +13,9 @@ const service: LocalImageService = { props.width = inputtedWidth; } - return squooshService.getHTMLAttributes(props, serviceOptions); + return squooshService.getHTMLAttributes + ? squooshService.getHTMLAttributes(props, serviceOptions) + : {}; }, getURL(options) { const fileSrc = typeof options.src === 'string' ? options.src : options.src.src; diff --git a/packages/integrations/vercel/tsconfig.json b/packages/integrations/vercel/tsconfig.json index 64d4ef454384..af1b43564edc 100644 --- a/packages/integrations/vercel/tsconfig.json +++ b/packages/integrations/vercel/tsconfig.json @@ -5,6 +5,6 @@ "allowJs": true, "module": "ES2022", "outDir": "./dist", - "target": "ES2021" + "target": "ES2022" } } diff --git a/packages/integrations/vue/package.json b/packages/integrations/vue/package.json index 420541b6ed17..8ca09dc7261e 100644 --- a/packages/integrations/vue/package.json +++ b/packages/integrations/vue/package.json @@ -60,6 +60,6 @@ "vue": "^3.2.30" }, "engines": { - "node": ">=16.12.0" + "node": ">=18.14.1" } } diff --git a/packages/integrations/vue/tsconfig.json b/packages/integrations/vue/tsconfig.json index 64d4ef454384..af1b43564edc 100644 --- a/packages/integrations/vue/tsconfig.json +++ b/packages/integrations/vue/tsconfig.json @@ -5,6 +5,6 @@ "allowJs": true, "module": "ES2022", "outDir": "./dist", - "target": "ES2021" + "target": "ES2022" } } diff --git a/packages/internal-helpers/tsconfig.json b/packages/internal-helpers/tsconfig.json index 569016e9d844..fd652e629fc1 100644 --- a/packages/internal-helpers/tsconfig.json +++ b/packages/internal-helpers/tsconfig.json @@ -3,7 +3,7 @@ "include": ["src"], "compilerOptions": { "allowJs": true, - "target": "ES2021", + "target": "ES2022", "module": "ES2022", "outDir": "./dist" } diff --git a/packages/telemetry/package.json b/packages/telemetry/package.json index be9e88b139c5..a81906743b13 100644 --- a/packages/telemetry/package.json +++ b/packages/telemetry/package.json @@ -13,7 +13,10 @@ "bugs": "https://github.com/withastro/astro/issues", "homepage": "https://astro.build", "exports": { - ".": "./dist/index.js", + ".": { + "types": "./dist/types/index.d.ts", + "default": "./dist/index.js" + }, "./package.json": "./package.json" }, "scripts": { @@ -45,6 +48,6 @@ "mocha": "^9.2.2" }, "engines": { - "node": ">=16.12.0" + "node": ">=18.14.1" } } diff --git a/packages/telemetry/src/config.ts b/packages/telemetry/src/config.ts index d03f9102b182..f0d855597b92 100644 --- a/packages/telemetry/src/config.ts +++ b/packages/telemetry/src/config.ts @@ -1,4 +1,5 @@ import dget from 'dlv'; +// @ts-expect-error `dset` is mispackaged: https://publint.dev/dset@3.1.2 import { dset } from 'dset'; import fs from 'node:fs'; import os from 'node:os'; diff --git a/packages/telemetry/tsconfig.json b/packages/telemetry/tsconfig.json index b35c3d2449ed..451badc02b5d 100644 --- a/packages/telemetry/tsconfig.json +++ b/packages/telemetry/tsconfig.json @@ -3,7 +3,7 @@ "include": ["src"], "compilerOptions": { "allowJs": true, - "target": "ES2021", + "target": "ES2022", "module": "ES2022", "outDir": "./dist", "declarationDir": "./dist/types" diff --git a/packages/underscore-redirects/tsconfig.json b/packages/underscore-redirects/tsconfig.json index 569016e9d844..fd652e629fc1 100644 --- a/packages/underscore-redirects/tsconfig.json +++ b/packages/underscore-redirects/tsconfig.json @@ -3,7 +3,7 @@ "include": ["src"], "compilerOptions": { "allowJs": true, - "target": "ES2021", + "target": "ES2022", "module": "ES2022", "outDir": "./dist" } diff --git a/packages/webapi/package.json b/packages/webapi/package.json index d214b4c97e0f..e65796fd8ccf 100644 --- a/packages/webapi/package.json +++ b/packages/webapi/package.json @@ -67,7 +67,7 @@ "mocha": "^9.2.2", "rollup": "^2.79.1", "tslib": "^2.5.3", - "typescript": "~5.0.2", + "typescript": "~5.1.6", "urlpattern-polyfill": "^1.0.0-rc5" }, "scripts": { diff --git a/packages/webapi/tsconfig.json b/packages/webapi/tsconfig.json index 2d7e33d823ba..2348c6bfb0d9 100644 --- a/packages/webapi/tsconfig.json +++ b/packages/webapi/tsconfig.json @@ -2,7 +2,7 @@ "include": ["src/*"], "exclude": ["node_modules"], "compilerOptions": { - "target": "ES2021", + "target": "ES2022", "module": "ES2022", "moduleResolution": "node", "esModuleInterop": true, diff --git a/scripts/cmd/build.js b/scripts/cmd/build.js index 6d1189b71c8a..b516e6b5105f 100644 --- a/scripts/cmd/build.js +++ b/scripts/cmd/build.js @@ -12,7 +12,7 @@ const defaultConfig = { minify: false, format: 'esm', platform: 'node', - target: 'node16', + target: 'node18', sourcemap: false, sourcesContent: false, }; diff --git a/scripts/package.json b/scripts/package.json index 1bb5177506f9..8a962b5c7fbd 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -10,7 +10,7 @@ "dependencies": { "@astrojs/webapi": "workspace:*", "arg": "^5.0.2", - "esbuild": "^0.17.19", + "esbuild": "^0.18.16", "globby": "^12.2.0", "kleur": "^4.1.4", "p-limit": "^4.0.0", diff --git a/tsconfig.base.json b/tsconfig.base.json index 0eb3c65c123f..337005ad49fa 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -3,7 +3,8 @@ "declaration": true, "emitDeclarationOnly": true, "strict": true, - "moduleResolution": "node", + // All packages are built with ESBuild, so we can use `moduleResolution: 'bundler'` + "moduleResolution": "Bundler", "esModuleInterop": true, "skipLibCheck": true, "verbatimModuleSyntax": true