Remove support for Node 16 (#7780)

This commit is contained in:
Erika 2023-07-24 20:47:07 +02:00 committed by Emanuele Stoppa
parent 4d160fa1e2
commit d0679a666f
68 changed files with 129 additions and 95 deletions

View file

@ -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.

View file

@ -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. 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 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 - type: input
id: astro-version id: astro-version
attributes: attributes:

View file

@ -34,7 +34,7 @@ jobs:
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 16 node-version: 18
cache: "pnpm" cache: "pnpm"
- name: Install dependencies - name: Install dependencies

View file

@ -38,7 +38,7 @@ jobs:
strategy: strategy:
matrix: matrix:
OS: [ubuntu-latest, windows-latest] OS: [ubuntu-latest, windows-latest]
NODE_VERSION: [16] NODE_VERSION: [18]
fail-fast: true fail-fast: true
steps: steps:
# Disable crlf so all OS can share the same Turbo cache # Disable crlf so all OS can share the same Turbo cache
@ -85,7 +85,7 @@ jobs:
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 16 node-version: 18
cache: "pnpm" cache: "pnpm"
- name: Install dependencies - name: Install dependencies
@ -108,12 +108,12 @@ jobs:
strategy: strategy:
matrix: matrix:
OS: [ubuntu-latest] OS: [ubuntu-latest]
NODE_VERSION: [16, 18] NODE_VERSION: [18, 20]
include: include:
- os: macos-latest - os: macos-latest
NODE_VERSION: 16 NODE_VERSION: 18
- os: windows-latest - os: windows-latest
NODE_VERSION: 16 NODE_VERSION: 18
fail-fast: false fail-fast: false
env: env:
NODE_VERSION: ${{ matrix.NODE_VERSION }} NODE_VERSION: ${{ matrix.NODE_VERSION }}
@ -155,7 +155,7 @@ jobs:
strategy: strategy:
matrix: matrix:
OS: [ubuntu-latest, windows-latest] OS: [ubuntu-latest, windows-latest]
NODE_VERSION: [16] NODE_VERSION: [18]
fail-fast: false fail-fast: false
env: env:
NODE_VERSION: ${{ matrix.NODE_VERSION }} NODE_VERSION: ${{ matrix.NODE_VERSION }}
@ -192,7 +192,7 @@ jobs:
strategy: strategy:
matrix: matrix:
OS: [ubuntu-latest, windows-latest] OS: [ubuntu-latest, windows-latest]
NODE_VERSION: [16] NODE_VERSION: [18]
env: env:
NODE_VERSION: ${{ matrix.NODE_VERSION }} NODE_VERSION: ${{ matrix.NODE_VERSION }}
steps: steps:

View file

@ -38,7 +38,7 @@ jobs:
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 16 node-version: 18
cache: "pnpm" cache: "pnpm"
- name: Install dependencies - name: Install dependencies

View file

@ -30,7 +30,7 @@ jobs:
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 16 node-version: 18
cache: "pnpm" cache: "pnpm"
- name: Install dependencies - name: Install dependencies

View file

@ -37,7 +37,7 @@ jobs:
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 16 node-version: 18
cache: "pnpm" cache: "pnpm"
- name: Install dependencies - name: Install dependencies

View file

@ -58,7 +58,7 @@ jobs:
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 16 node-version: 18
registry-url: "https://registry.npmjs.org" registry-url: "https://registry.npmjs.org"
cache: "pnpm" cache: "pnpm"

2
.nvmrc
View file

@ -1 +1 @@
16.19.0 18.14.1

View file

@ -10,7 +10,7 @@ We welcome contributions of any size and skill level. As an open source project,
### Prerequisites ### Prerequisites
```shell ```shell
node: "^>=16.12.0" node: "^>=18.14.1"
pnpm: "^8.6.2" pnpm: "^8.6.2"
# otherwise, your build will fail # otherwise, your build will fail
``` ```

View file

@ -3,8 +3,8 @@
"include": ["src"], "include": ["src"],
"compilerOptions": { "compilerOptions": {
"allowJs": true, "allowJs": true,
"module": "ES2020", "module": "ES2022",
"outDir": "./dist", "outDir": "./dist",
"target": "ES2020" "target": "ES2022"
} }
} }

View file

@ -39,7 +39,7 @@
"packages/*" "packages/*"
], ],
"engines": { "engines": {
"node": ">=16.12.0", "node": ">=18.14.1",
"pnpm": ">=8.6.2" "pnpm": ">=8.6.2"
}, },
"packageManager": "pnpm@8.6.2", "packageManager": "pnpm@8.6.2",
@ -82,7 +82,7 @@
"@types/node": "^18.16.18", "@types/node": "^18.16.18",
"@typescript-eslint/eslint-plugin": "6.0.0", "@typescript-eslint/eslint-plugin": "6.0.0",
"@typescript-eslint/parser": "6.0.0", "@typescript-eslint/parser": "6.0.0",
"esbuild": "^0.17.19", "esbuild": "^0.18.16",
"eslint": "^8.43.0", "eslint": "^8.43.0",
"eslint-config-prettier": "^8.8.0", "eslint-config-prettier": "^8.8.0",
"eslint-plugin-no-only-tests": "^2.6.0", "eslint-plugin-no-only-tests": "^2.6.0",
@ -93,6 +93,6 @@
"prettier-plugin-astro": "^0.10.0", "prettier-plugin-astro": "^0.10.0",
"tiny-glob": "^0.2.9", "tiny-glob": "^0.2.9",
"turbo": "^1.10.3", "turbo": "^1.10.3",
"typescript": "~5.0.2" "typescript": "~5.1.6"
} }
} }

View file

@ -14,7 +14,7 @@
"homepage": "https://docs.astro.build/en/reference/api-reference/#prism-", "homepage": "https://docs.astro.build/en/reference/api-reference/#prism-",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "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\"", "build:ci": "astro-scripts build \"src/**/*.ts\"",
"dev": "astro-scripts dev \"src/**/*.ts\"" "dev": "astro-scripts dev \"src/**/*.ts\""
}, },
@ -39,6 +39,6 @@
"astro-scripts": "workspace:*" "astro-scripts": "workspace:*"
}, },
"engines": { "engines": {
"node": ">=16.12.0" "node": ">=18.14.1"
} }
} }

View file

@ -3,7 +3,7 @@
"include": ["src"], "include": ["src"],
"compilerOptions": { "compilerOptions": {
"allowJs": true, "allowJs": true,
"target": "ES2021", "target": "ES2022",
"module": "ES2022", "module": "ES2022",
"outDir": "./dist" "outDir": "./dist"
} }

View file

@ -5,7 +5,7 @@
"allowJs": true, "allowJs": true,
"module": "ES2022", "module": "ES2022",
"outDir": "./dist", "outDir": "./dist",
"target": "ES2021", "target": "ES2022",
"strictNullChecks": true "strictNullChecks": true
} }
} }

View file

@ -13,8 +13,8 @@ const CI_INSTRUCTIONS = {
}; };
// Hardcode supported Node.js version so we don't have to read differently in CJS & ESM. // Hardcode supported Node.js version so we don't have to read differently in CJS & ESM.
const engines = '>=16.12.0'; const engines = '>=18.14.1';
const skipSemverCheckIfAbove = 16; const skipSemverCheckIfAbove = 19;
/** `astro *` */ /** `astro *` */
async function main() { async function main() {

View file

@ -141,8 +141,8 @@
"devalue": "^4.3.2", "devalue": "^4.3.2",
"diff": "^5.1.0", "diff": "^5.1.0",
"es-module-lexer": "^1.3.0", "es-module-lexer": "^1.3.0",
"esbuild": "^0.17.19", "esbuild": "^0.18.16",
"estree-walker": "3.0.0", "estree-walker": "^3.0.3",
"execa": "^6.1.0", "execa": "^6.1.0",
"fast-glob": "^3.2.12", "fast-glob": "^3.2.12",
"github-slugger": "^2.0.0", "github-slugger": "^2.0.0",
@ -224,7 +224,7 @@
} }
}, },
"engines": { "engines": {
"node": ">=16.12.0", "node": ">=18.14.1",
"npm": ">=6.14.0" "npm": ">=6.14.0"
} }
} }

View file

@ -1,3 +1,4 @@
import type { Node as ESTreeNode } from 'estree-walker';
import type { ModuleInfo, PluginContext } from 'rollup'; import type { ModuleInfo, PluginContext } from 'rollup';
import type { Plugin as VitePlugin } from 'vite'; import type { Plugin as VitePlugin } from 'vite';
import type { PluginMetadata as AstroPluginMetadata } from '../../../vite-plugin-astro/types'; import type { PluginMetadata as AstroPluginMetadata } from '../../../vite-plugin-astro/types';
@ -36,7 +37,7 @@ async function doesParentImportChild(
const imports: Array<ImportDeclaration> = []; const imports: Array<ImportDeclaration> = [];
const exports: Array<ExportNamedDeclaration | ExportDefaultDeclaration> = []; const exports: Array<ExportNamedDeclaration | ExportDefaultDeclaration> = [];
walk(parentInfo.ast, { walk(parentInfo.ast as ESTreeNode, {
enter(node) { enter(node) {
if (node.type === 'ImportDeclaration') { if (node.type === 'ImportDeclaration') {
imports.push(node as ImportDeclaration); imports.push(node as ImportDeclaration);

View file

@ -1,4 +1,5 @@
import { parse } from 'acorn'; import { parse } from 'acorn';
import type { Node as ESTreeNode } from 'estree-walker';
import { walk } from 'estree-walker'; import { walk } from 'estree-walker';
import MagicString from 'magic-string'; import MagicString from 'magic-string';
import type { Plugin } from 'vite'; import type { Plugin } from 'vite';
@ -28,7 +29,7 @@ export default function astro(): Plugin {
sourceType: 'module', sourceType: 'module',
}); });
walk(ast, { walk(ast as ESTreeNode, {
enter(node: any) { enter(node: any) {
// Transform `Astro.glob("./pages/*.astro")` to `Astro.glob(import.meta.glob("./pages/*.astro"), () => "./pages/*.astro")` // Transform `Astro.glob("./pages/*.astro")` to `Astro.glob(import.meta.glob("./pages/*.astro"), () => "./pages/*.astro")`
// Also handle for `Astro2.glob()` // Also handle for `Astro2.glob()`

View file

@ -6,7 +6,7 @@
"declarationDir": "./dist", "declarationDir": "./dist",
"module": "ES2022", "module": "ES2022",
"outDir": "./dist", "outDir": "./dist",
"target": "ES2021", "target": "ES2022",
"jsx": "preserve", "jsx": "preserve",
"types": ["@types/dom-view-transitions", "network-information-types"] "types": ["@types/dom-view-transitions", "network-information-types"]
} }

View file

@ -47,6 +47,6 @@
"strip-json-comments": "^5.0.0" "strip-json-comments": "^5.0.0"
}, },
"engines": { "engines": {
"node": ">=16.12.0" "node": ">=18.14.1"
} }
} }

View file

@ -5,7 +5,7 @@
"allowJs": true, "allowJs": true,
"emitDeclarationOnly": false, "emitDeclarationOnly": false,
"noEmit": true, "noEmit": true,
"target": "ES2021", "target": "ES2022",
"module": "ES2022", "module": "ES2022",
"outDir": "./dist", "outDir": "./dist",
"declarationDir": "./dist/types" "declarationDir": "./dist/types"

View file

@ -5,6 +5,6 @@
"allowJs": true, "allowJs": true,
"module": "ES2022", "module": "ES2022",
"outDir": "./dist", "outDir": "./dist",
"target": "ES2021" "target": "ES2022"
} }
} }

View file

@ -41,7 +41,7 @@
"dependencies": { "dependencies": {
"@astrojs/underscore-redirects": "^0.2.0", "@astrojs/underscore-redirects": "^0.2.0",
"@cloudflare/workers-types": "^4.20230518.0", "@cloudflare/workers-types": "^4.20230518.0",
"esbuild": "^0.17.19", "esbuild": "^0.18.16",
"tiny-glob": "^0.2.9" "tiny-glob": "^0.2.9"
}, },
"peerDependencies": { "peerDependencies": {

View file

@ -5,6 +5,6 @@
"allowJs": true, "allowJs": true,
"module": "ES2022", "module": "ES2022",
"outDir": "./dist", "outDir": "./dist",
"target": "ES2021" "target": "ES2022"
} }
} }

View file

@ -5,6 +5,8 @@
"allowJs": true, "allowJs": true,
"module": "ES2022", "module": "ES2022",
"outDir": "./dist", "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"
} }
} }

View file

@ -5,7 +5,7 @@
"allowJs": true, "allowJs": true,
"module": "ES2022", "module": "ES2022",
"outDir": "./dist", "outDir": "./dist",
"target": "ES2021", "target": "ES2022",
"typeRoots": ["node_modules/@types", "node_modules/@netlify"] "typeRoots": ["node_modules/@types", "node_modules/@netlify"]
} }
} }

View file

@ -5,6 +5,6 @@
"allowJs": true, "allowJs": true,
"module": "ES2022", "module": "ES2022",
"outDir": "./dist", "outDir": "./dist",
"target": "ES2021" "target": "ES2022"
} }
} }

View file

@ -66,7 +66,7 @@
"@astrojs/internal-helpers": "^0.1.2", "@astrojs/internal-helpers": "^0.1.2",
"@astrojs/prism": "^2.1.2", "@astrojs/prism": "^2.1.2",
"@markdoc/markdoc": "^0.3.0", "@markdoc/markdoc": "^0.3.0",
"esbuild": "^0.17.19", "esbuild": "^0.18.16",
"github-slugger": "^2.0.0", "github-slugger": "^2.0.0",
"gray-matter": "^4.0.3", "gray-matter": "^4.0.3",
"htmlparser2": "^9.0.0", "htmlparser2": "^9.0.0",
@ -93,6 +93,6 @@
"vite": "^4.4.6" "vite": "^4.4.6"
}, },
"engines": { "engines": {
"node": ">=16.12.0" "node": ">=18.14.1"
} }
} }

View file

@ -3,14 +3,14 @@ import Markdoc from '@markdoc/markdoc';
import type { AstroConfig, ContentEntryType } from 'astro'; import type { AstroConfig, ContentEntryType } from 'astro';
import matter from 'gray-matter'; import matter from 'gray-matter';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import type * as rollup from 'rollup';
import type { ErrorPayload as ViteErrorPayload } from 'vite'; import type { ErrorPayload as ViteErrorPayload } from 'vite';
import type { ComponentConfig } from './config.js'; import type { ComponentConfig } from './config.js';
import { MarkdocError, isComponentConfig, isValidUrl, prependForwardSlash } from './utils.js'; import { MarkdocError, isComponentConfig, isValidUrl, prependForwardSlash } from './utils.js';
// @ts-expect-error Cannot get the types here without `moduleResolution: 'nodenext'` // @ts-expect-error Cannot get the types here without `moduleResolution: 'nodenext'`
import { emitESMImage } from 'astro/assets/utils'; 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 { htmlTokenTransform } from './html/transform/html-token-transform.js';
import type { MarkdocConfigResult } from './load-config.js'; import type { MarkdocConfigResult } from './load-config.js';
import type { MarkdocIntegrationOptions } from './options.js'; import type { MarkdocIntegrationOptions } from './options.js';
@ -198,8 +198,7 @@ async function emitOptimizedImages(
const src = await emitESMImage( const src = await emitESMImage(
resolved.id, resolved.id,
ctx.pluginContext.meta.watchMode, ctx.pluginContext.meta.watchMode,
ctx.pluginContext.emitFile, ctx.pluginContext.emitFile
{ config: ctx.astroConfig }
); );
node.attributes.__optimizedSrc = src; node.attributes.__optimizedSrc = src;
} else { } else {

View file

@ -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 { runHighlighterWithAstro } from '@astrojs/prism/dist/highlighter';
import { unescapeHTML } from 'astro/runtime/server/index.js';
import { Markdoc, type AstroMarkdocConfig } from '../config.js'; import { Markdoc, type AstroMarkdocConfig } from '../config.js';
export default function prism(): AstroMarkdocConfig { 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 // Use `unescapeHTML` to return `HTMLString` for Astro renderer to inline as HTML
return unescapeHTML( return unescapeHTML(
`<pre class="${classLanguage}"><code class="${classLanguage}">${html}</code></pre>` `<pre class="${classLanguage}"><code class="${classLanguage}">${html}</code></pre>`
); ) as any;
}, },
}, },
}, },

View file

@ -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 Markdoc from '@markdoc/markdoc';
import type { ShikiConfig } from 'astro'; import type { ShikiConfig } from 'astro';
import { unescapeHTML } from 'astro/runtime/server/index.js';
import type * as shikiTypes from 'shiki'; import type * as shikiTypes from 'shiki';
import { getHighlighter } from 'shiki'; import { getHighlighter } from 'shiki';
import type { AstroMarkdocConfig } from '../config.js'; 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 // Use `unescapeHTML` to return `HTMLString` for Astro renderer to inline as HTML
return unescapeHTML(html); return unescapeHTML(html) as any;
}, },
}, },
}, },

View file

@ -6,7 +6,6 @@ import Markdoc, {
type RenderableTreeNode, type RenderableTreeNode,
} from '@markdoc/markdoc'; } from '@markdoc/markdoc';
import type { AstroInstance } from 'astro'; 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 { createComponent, renderComponent } from 'astro/runtime/server/index.js';
import type { AstroMarkdocConfig } from './config.js'; import type { AstroMarkdocConfig } from './config.js';
import { setupHeadingConfig } from './heading-ids.js'; import { setupHeadingConfig } from './heading-ids.js';
@ -204,7 +203,7 @@ export function createContentComponent(
return renderComponent(result, Renderer.name, Renderer, { stringifiedAst, config }, {}); return renderComponent(result, Renderer.name, Renderer, { stringifiedAst, config }, {});
}, },
propagation: 'self', propagation: 'self',
}); } as any);
} }
// statically define a partial MarkdocConfig which registers the required "html-tag" Markdoc tag when the "allowHTML" feature is enabled // statically define a partial MarkdocConfig which registers the required "html-tag" Markdoc tag when the "allowHTML" feature is enabled

View file

@ -3,8 +3,8 @@
"include": ["src"], "include": ["src"],
"compilerOptions": { "compilerOptions": {
"allowJs": true, "allowJs": true,
"module": "ES2020", "module": "ES2022",
"outDir": "./dist", "outDir": "./dist",
"target": "ES2020" "target": "ES2022"
} }
} }

View file

@ -78,6 +78,6 @@
"vite": "^4.4.6" "vite": "^4.4.6"
}, },
"engines": { "engines": {
"node": ">=16.12.0" "node": ">=18.14.1"
} }
} }

View file

@ -1,5 +1,5 @@
import type { MarkdownVFile } from '@astrojs/markdown-remark'; 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 type { MdxJsxFlowElement, MdxjsEsm } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit'; import { visit } from 'unist-util-visit';
import { jsToTreeNode } from './utils.js'; import { jsToTreeNode } from './utils.js';

View file

@ -5,6 +5,6 @@
"allowJs": true, "allowJs": true,
"module": "ES2022", "module": "ES2022",
"outDir": "./dist", "outDir": "./dist",
"target": "ES2021" "target": "ES2022"
} }
} }

View file

@ -41,7 +41,7 @@
"@astrojs/underscore-redirects": "^0.2.0", "@astrojs/underscore-redirects": "^0.2.0",
"@astrojs/webapi": "^2.2.0", "@astrojs/webapi": "^2.2.0",
"@netlify/functions": "^1.6.0", "@netlify/functions": "^1.6.0",
"esbuild": "^0.15.18" "esbuild": "^0.18.16"
}, },
"peerDependencies": { "peerDependencies": {
"astro": "workspace:^2.10.3" "astro": "workspace:^2.10.3"

View file

@ -5,7 +5,7 @@
"allowJs": true, "allowJs": true,
"module": "ES2022", "module": "ES2022",
"outDir": "./dist", "outDir": "./dist",
"target": "ES2021", "target": "ES2022",
"typeRoots": ["node_modules/@types", "node_modules/@netlify"], "typeRoots": ["node_modules/@types", "node_modules/@netlify"],
"allowImportingTsExtensions": true "allowImportingTsExtensions": true
} }

View file

@ -5,6 +5,6 @@
"allowJs": true, "allowJs": true,
"module": "ES2022", "module": "ES2022",
"outDir": "./dist", "outDir": "./dist",
"target": "ES2021" "target": "ES2022"
} }
} }

View file

@ -5,6 +5,6 @@
"allowJs": true, "allowJs": true,
"module": "ES2022", "module": "ES2022",
"outDir": "./dist", "outDir": "./dist",
"target": "ES2021" "target": "ES2022"
} }
} }

View file

@ -50,6 +50,6 @@
"preact": "^10.6.5" "preact": "^10.6.5"
}, },
"engines": { "engines": {
"node": ">=16.12.0" "node": ">=18.14.1"
} }
} }

View file

@ -5,6 +5,6 @@
"allowJs": true, "allowJs": true,
"module": "ES2022", "module": "ES2022",
"outDir": "./dist", "outDir": "./dist",
"target": "ES2021" "target": "ES2022"
} }
} }

View file

@ -5,6 +5,6 @@
"allowJs": true, "allowJs": true,
"module": "ES2022", "module": "ES2022",
"outDir": "./dist", "outDir": "./dist",
"target": "ES2021" "target": "ES2022"
} }
} }

View file

@ -62,6 +62,6 @@
"react-dom": "^17.0.2 || ^18.0.0" "react-dom": "^17.0.2 || ^18.0.0"
}, },
"engines": { "engines": {
"node": ">=16.12.0" "node": ">=18.14.1"
} }
} }

View file

@ -5,6 +5,6 @@
"allowJs": true, "allowJs": true,
"module": "ES2022", "module": "ES2022",
"outDir": "./dist", "outDir": "./dist",
"target": "ES2021" "target": "ES2022"
} }
} }

View file

@ -5,6 +5,6 @@
"allowJs": true, "allowJs": true,
"module": "ES2022", "module": "ES2022",
"outDir": "./dist", "outDir": "./dist",
"target": "ES2021" "target": "ES2022"
} }
} }

View file

@ -47,6 +47,6 @@
"solid-js": "^1.4.3" "solid-js": "^1.4.3"
}, },
"engines": { "engines": {
"node": ">=16.12.0" "node": ">=18.14.1"
} }
} }

View file

@ -5,6 +5,6 @@
"allowJs": true, "allowJs": true,
"module": "ES2022", "module": "ES2022",
"outDir": "./dist", "outDir": "./dist",
"target": "ES2021" "target": "ES2022"
} }
} }

View file

@ -52,6 +52,6 @@
"svelte": "^3.55.0 || ^4.0.0" "svelte": "^3.55.0 || ^4.0.0"
}, },
"engines": { "engines": {
"node": ">=16.12.0" "node": ">=18.14.1"
} }
} }

View file

@ -5,6 +5,6 @@
"allowJs": true, "allowJs": true,
"module": "ES2022", "module": "ES2022",
"outDir": "./dist", "outDir": "./dist",
"target": "ES2021" "target": "ES2022"
} }
} }

View file

@ -5,6 +5,6 @@
"allowJs": true, "allowJs": true,
"module": "ES2022", "module": "ES2022",
"outDir": "./dist", "outDir": "./dist",
"target": "ES2021" "target": "ES2022"
} }
} }

View file

@ -5,6 +5,6 @@
"allowJs": true, "allowJs": true,
"module": "ES2022", "module": "ES2022",
"outDir": "./dist", "outDir": "./dist",
"target": "ES2021" "target": "ES2022"
} }
} }

View file

@ -55,7 +55,7 @@
"@astrojs/webapi": "^2.2.0", "@astrojs/webapi": "^2.2.0",
"@vercel/analytics": "^0.1.11", "@vercel/analytics": "^0.1.11",
"@vercel/nft": "^0.22.6", "@vercel/nft": "^0.22.6",
"esbuild": "^0.17.19", "esbuild": "^0.18.16",
"fast-glob": "^3.2.12", "fast-glob": "^3.2.12",
"set-cookie-parser": "^2.6.0", "set-cookie-parser": "^2.6.0",
"web-vitals": "^3.3.2" "web-vitals": "^3.3.2"

View file

@ -1,5 +1,4 @@
import type { LocalImageService } from 'astro'; import type { LocalImageService } from 'astro';
// @ts-expect-error
import squooshService from 'astro/assets/services/squoosh'; import squooshService from 'astro/assets/services/squoosh';
import { sharedValidateOptions } from './shared'; import { sharedValidateOptions } from './shared';
@ -14,7 +13,9 @@ const service: LocalImageService = {
props.width = inputtedWidth; props.width = inputtedWidth;
} }
return squooshService.getHTMLAttributes(props, serviceOptions); return squooshService.getHTMLAttributes
? squooshService.getHTMLAttributes(props, serviceOptions)
: {};
}, },
getURL(options) { getURL(options) {
const fileSrc = typeof options.src === 'string' ? options.src : options.src.src; const fileSrc = typeof options.src === 'string' ? options.src : options.src.src;

View file

@ -5,6 +5,6 @@
"allowJs": true, "allowJs": true,
"module": "ES2022", "module": "ES2022",
"outDir": "./dist", "outDir": "./dist",
"target": "ES2021" "target": "ES2022"
} }
} }

View file

@ -60,6 +60,6 @@
"vue": "^3.2.30" "vue": "^3.2.30"
}, },
"engines": { "engines": {
"node": ">=16.12.0" "node": ">=18.14.1"
} }
} }

View file

@ -5,6 +5,6 @@
"allowJs": true, "allowJs": true,
"module": "ES2022", "module": "ES2022",
"outDir": "./dist", "outDir": "./dist",
"target": "ES2021" "target": "ES2022"
} }
} }

View file

@ -3,7 +3,7 @@
"include": ["src"], "include": ["src"],
"compilerOptions": { "compilerOptions": {
"allowJs": true, "allowJs": true,
"target": "ES2021", "target": "ES2022",
"module": "ES2022", "module": "ES2022",
"outDir": "./dist" "outDir": "./dist"
} }

View file

@ -13,7 +13,10 @@
"bugs": "https://github.com/withastro/astro/issues", "bugs": "https://github.com/withastro/astro/issues",
"homepage": "https://astro.build", "homepage": "https://astro.build",
"exports": { "exports": {
".": "./dist/index.js", ".": {
"types": "./dist/types/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"scripts": { "scripts": {
@ -45,6 +48,6 @@
"mocha": "^9.2.2" "mocha": "^9.2.2"
}, },
"engines": { "engines": {
"node": ">=16.12.0" "node": ">=18.14.1"
} }
} }

View file

@ -1,4 +1,5 @@
import dget from 'dlv'; import dget from 'dlv';
// @ts-expect-error `dset` is mispackaged: https://publint.dev/dset@3.1.2
import { dset } from 'dset'; import { dset } from 'dset';
import fs from 'node:fs'; import fs from 'node:fs';
import os from 'node:os'; import os from 'node:os';

View file

@ -3,7 +3,7 @@
"include": ["src"], "include": ["src"],
"compilerOptions": { "compilerOptions": {
"allowJs": true, "allowJs": true,
"target": "ES2021", "target": "ES2022",
"module": "ES2022", "module": "ES2022",
"outDir": "./dist", "outDir": "./dist",
"declarationDir": "./dist/types" "declarationDir": "./dist/types"

View file

@ -3,7 +3,7 @@
"include": ["src"], "include": ["src"],
"compilerOptions": { "compilerOptions": {
"allowJs": true, "allowJs": true,
"target": "ES2021", "target": "ES2022",
"module": "ES2022", "module": "ES2022",
"outDir": "./dist" "outDir": "./dist"
} }

View file

@ -67,7 +67,7 @@
"mocha": "^9.2.2", "mocha": "^9.2.2",
"rollup": "^2.79.1", "rollup": "^2.79.1",
"tslib": "^2.5.3", "tslib": "^2.5.3",
"typescript": "~5.0.2", "typescript": "~5.1.6",
"urlpattern-polyfill": "^1.0.0-rc5" "urlpattern-polyfill": "^1.0.0-rc5"
}, },
"scripts": { "scripts": {

View file

@ -2,7 +2,7 @@
"include": ["src/*"], "include": ["src/*"],
"exclude": ["node_modules"], "exclude": ["node_modules"],
"compilerOptions": { "compilerOptions": {
"target": "ES2021", "target": "ES2022",
"module": "ES2022", "module": "ES2022",
"moduleResolution": "node", "moduleResolution": "node",
"esModuleInterop": true, "esModuleInterop": true,

View file

@ -12,7 +12,7 @@ const defaultConfig = {
minify: false, minify: false,
format: 'esm', format: 'esm',
platform: 'node', platform: 'node',
target: 'node16', target: 'node18',
sourcemap: false, sourcemap: false,
sourcesContent: false, sourcesContent: false,
}; };

View file

@ -10,7 +10,7 @@
"dependencies": { "dependencies": {
"@astrojs/webapi": "workspace:*", "@astrojs/webapi": "workspace:*",
"arg": "^5.0.2", "arg": "^5.0.2",
"esbuild": "^0.17.19", "esbuild": "^0.18.16",
"globby": "^12.2.0", "globby": "^12.2.0",
"kleur": "^4.1.4", "kleur": "^4.1.4",
"p-limit": "^4.0.0", "p-limit": "^4.0.0",

View file

@ -3,7 +3,8 @@
"declaration": true, "declaration": true,
"emitDeclarationOnly": true, "emitDeclarationOnly": true,
"strict": true, "strict": true,
"moduleResolution": "node", // All packages are built with ESBuild, so we can use `moduleResolution: 'bundler'`
"moduleResolution": "Bundler",
"esModuleInterop": true, "esModuleInterop": true,
"skipLibCheck": true, "skipLibCheck": true,
"verbatimModuleSyntax": true "verbatimModuleSyntax": true