From e68655127bb09402e1d12507e1b2db8fa3c64ff8 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 2 Jan 2025 16:01:50 +0100 Subject: [PATCH] Update dev-dependencies --- .gitignore | 1 + lib/index.js | 8 ++++---- package.json | 10 +++++----- test-types.d.ts | 9 +++++++++ test-types.js | 2 ++ test.jsx | 13 ++++++++----- tsconfig.json | 2 +- 7 files changed, 30 insertions(+), 15 deletions(-) create mode 100644 test-types.d.ts create mode 100644 test-types.js diff --git a/.gitignore b/.gitignore index f19ff24..ce84e07 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ node_modules/ .DS_Store react-markdown.min.js yarn.lock +!/test-types.d.ts diff --git a/lib/index.js b/lib/index.js index d3d201f..529639c 100644 --- a/lib/index.js +++ b/lib/index.js @@ -318,11 +318,11 @@ export function defaultUrlTransform(value) { if ( // If there is no protocol, it’s relative. - colon < 0 || + colon === -1 || // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol. - (slash > -1 && colon > slash) || - (questionMark > -1 && colon > questionMark) || - (numberSign > -1 && colon > numberSign) || + (slash !== -1 && colon > slash) || + (questionMark !== -1 && colon > questionMark) || + (numberSign !== -1 && colon > numberSign) || // It is a protocol, it should be allowed. safeProtocol.test(value.slice(0, colon)) ) { diff --git a/package.json b/package.json index c051f5e..b107383 100644 --- a/package.json +++ b/package.json @@ -94,14 +94,14 @@ }, "devDependencies": { "@types/node": "^22.0.0", - "@types/react": "^18.0.0", - "@types/react-dom": "^18.0.0", + "@types/react": "^19.0.0", + "@types/react-dom": "^19.0.0", "c8": "^10.0.0", "esbuild": "^0.24.0", "eslint-plugin-react": "^7.0.0", "prettier": "^3.0.0", - "react": "^18.0.0", - "react-dom": "^18.0.0", + "react": "^19.0.0", + "react-dom": "^19.0.0", "rehype-raw": "^7.0.0", "remark-cli": "^12.0.0", "remark-gfm": "^4.0.0", @@ -109,7 +109,7 @@ "remark-toc": "^9.0.0", "type-coverage": "^2.0.0", "typescript": "^5.0.0", - "xo": "^0.59.0" + "xo": "^0.60.0" }, "scripts": { "build": "tsc --build --clean && tsc --build && type-coverage", diff --git a/test-types.d.ts b/test-types.d.ts new file mode 100644 index 0000000..4dd67e3 --- /dev/null +++ b/test-types.d.ts @@ -0,0 +1,9 @@ +import type {JSX as Jsx} from 'react/jsx-runtime' + +declare global { + namespace JSX { + type ElementClass = Jsx.ElementClass + type Element = Jsx.Element + type IntrinsicElements = Jsx.IntrinsicElements + } +} diff --git a/test-types.js b/test-types.js new file mode 100644 index 0000000..f3ea4d4 --- /dev/null +++ b/test-types.js @@ -0,0 +1,2 @@ +// See `test-types.d.ts`. +export {} diff --git a/test.jsx b/test.jsx index 8223918..f127de1 100644 --- a/test.jsx +++ b/test.jsx @@ -167,21 +167,24 @@ test('react-markdown', async function (t) { await t.test('should support an image', function () { assert.equal( renderToStaticMarkup(), - '

a

' + // Note: React weirdly adds `rel="preload"`. + '

a

' ) }) await t.test('should support an image w/ a title', function () { assert.equal( renderToStaticMarkup(), - '

a

' + // Note: React weirdly adds `rel="preload"`. + '

a

' ) }) await t.test('should support an image reference / definition', function () { assert.equal( renderToStaticMarkup(), - '

a

' + // Note: React weirdly adds `rel="preload"`. + '

a

' ) }) @@ -410,7 +413,7 @@ test('react-markdown', async function (t) { }} /> ), - '

a

' + '

a

' ) }) @@ -564,7 +567,7 @@ test('react-markdown', async function (t) { console.error = warn - assert.match(String(message), /Warning: React.jsx: type is invalid/) + assert.match(String(message), /type is invalid/) /** * @param {unknown} d diff --git a/tsconfig.json b/tsconfig.json index d13dc27..5317638 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,5 +13,5 @@ "target": "es2022" }, "exclude": ["coverage/", "node_modules/"], - "include": ["**/*.js", "**/*.jsx", "lib/complex-types.d.ts"] + "include": ["**/*.js", "**/*.jsx", "test-types.d.ts"] }