chore: add Node 24 to CI + fix deprecation warnings (#11168)

This commit is contained in:
Sébastien Lorber 2025-05-09 18:29:07 +02:00 committed by GitHub
parent 8061f2267b
commit 4af8982278
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 12 additions and 6 deletions

View file

@ -33,6 +33,7 @@ jobs:
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: lts/*
cache: yarn
- name: Install dependencies
run: yarn || yarn || yarn

View file

@ -27,6 +27,7 @@ jobs:
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: lts/*
cache: yarn
- name: Install dependencies
run: yarn || yarn || yarn

View file

@ -38,7 +38,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['18.0', '20', '22']
node: ['18.0', '20', '22', '24']
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

View file

@ -27,7 +27,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
node: ['18.0', '20', '22']
node: ['18.0', '20', '22', '24']
steps:
- name: Support longpaths
run: git config --system core.longpaths true
@ -37,6 +37,7 @@ jobs:
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: ${{ matrix.node }}
cache: yarn
- name: Installation
run: yarn || yarn || yarn
- name: Docusaurus Jest Tests

View file

@ -27,7 +27,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['18.0', '20', '22']
node: ['18.0', '20', '22', '24']
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

View file

@ -14,6 +14,7 @@ import {
escapePath,
findAsyncSequential,
getFileLoaderUtils,
parseURLOrPath,
} from '@docusaurus/utils';
import escapeHtml from 'escape-html';
import {imageSizeFromFile} from 'image-size/fromFile';
@ -50,7 +51,7 @@ async function toImageRequireNode(
);
relativeImagePath = `./${relativeImagePath}`;
const parsedUrl = url.parse(node.url);
const parsedUrl = parseURLOrPath(node.url, 'https://example.com');
const hash = parsedUrl.hash ?? '';
const search = parsedUrl.search ?? '';
const requireString = `${context.inlineMarkdownImageFileLoader}${

View file

@ -14,6 +14,7 @@ import {
escapePath,
findAsyncSequential,
getFileLoaderUtils,
parseURLOrPath,
} from '@docusaurus/utils';
import escapeHtml from 'escape-html';
import {assetRequireAttributeValue, transformNode} from '../utils';
@ -51,7 +52,7 @@ async function toAssetRequireNode(
path.relative(path.dirname(context.filePath), assetPath),
)}`;
const parsedUrl = url.parse(node.url);
const parsedUrl = parseURLOrPath(node.url);
const hash = parsedUrl.hash ?? '';
const search = parsedUrl.search ?? '';

View file

@ -166,7 +166,8 @@ export function isValidPathname(str: string): boolean {
export function parseURLOrPath(url: string, base?: string | URL): URL {
try {
// TODO when Node supports it, use URL.parse could be faster?
// TODO Docusaurus v4: use URL.parse()
// Node 24 supports it, use URL.parse could be faster?
// see https://kilianvalkhof.com/2024/javascript/the-problem-with-new-url-and-how-url-parse-fixes-that/
return new URL(url, base ?? 'https://example.com');
} catch (e) {