diff --git a/packages/astro/package.json b/packages/astro/package.json index 40e16eff5532..5d227208d346 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -163,7 +163,6 @@ "http-cache-semantics": "^4.1.1", "js-yaml": "^4.1.0", "kleur": "^4.1.5", - "linkedom": "^0.18.4", "magic-string": "^0.30.11", "micromatch": "^4.0.7", "mrmime": "^2.0.0", @@ -240,4 +239,4 @@ "publishConfig": { "provenance": true } -} +} \ No newline at end of file diff --git a/packages/astro/test/content-layer-markdoc.test.js b/packages/astro/test/content-layer-markdoc.test.js index 0e741603a76b..c5279b9e7522 100644 --- a/packages/astro/test/content-layer-markdoc.test.js +++ b/packages/astro/test/content-layer-markdoc.test.js @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { after, before, describe, it } from 'node:test'; -import { parseHTML } from 'linkedom'; +import * as cheerio from 'cheerio'; import { loadFixture } from './test-utils.js'; describe('Content layer markdoc', () => { @@ -59,29 +59,30 @@ describe('Content layer markdoc', () => { /** @param {string} html */ function renderComponentsChecks(html) { - const { document } = parseHTML(html); - const h2 = document.querySelector('h2'); - assert.equal(h2.textContent, 'Post with components'); + const $ = cheerio.load(html); + const h2 = $('h2'); + assert.equal(h2.text(), 'Post with components'); // Renders custom shortcode component - const marquee = document.querySelector('marquee'); + const marquee = $('marquee'); assert.notEqual(marquee, null); - assert.equal(marquee.hasAttribute('data-custom-marquee'), true); + assert.equal(marquee.attr('data-custom-marquee'), ''); // Renders Astro Code component - const pre = document.querySelector('pre'); + const pre = $('pre'); assert.notEqual(pre, null); - assert.equal(pre.className, 'astro-code github-dark'); + assert.ok(pre.hasClass('github-dark')); + assert.ok(pre.hasClass('astro-code')); } /** @param {string} html */ function renderComponentsInsidePartialsChecks(html) { - const { document } = parseHTML(html); + const $ = cheerio.load(html); // renders Counter.tsx - const button = document.querySelector('#counter'); - assert.equal(button.textContent, '1'); + const button = $('#counter'); + assert.equal(button.text(), '1'); // renders DeeplyNested.astro - const deeplyNested = document.querySelector('#deeply-nested'); - assert.equal(deeplyNested.textContent, 'Deeply nested partial'); + const deeplyNested = $('#deeply-nested'); + assert.equal(deeplyNested.text(), 'Deeply nested partial'); } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e664b2635550..274af7480447 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -675,9 +675,6 @@ importers: kleur: specifier: ^4.1.5 version: 4.1.5 - linkedom: - specifier: ^0.18.4 - version: 0.18.4 magic-string: specifier: ^0.30.11 version: 0.30.11 @@ -9441,7 +9438,6 @@ packages: libsql@0.3.12: resolution: {integrity: sha512-to30hj8O3DjS97wpbKN6ERZ8k66MN1IaOfFLR6oHqd25GMiPJ/ZX0VaZ7w+TsPmxcFS3p71qArj/hiedCyvXCg==} - cpu: [x64, arm64, wasm32] os: [darwin, linux, win32] lilconfig@2.1.0: @@ -11453,9 +11449,6 @@ packages: resolution: {integrity: sha512-M/wqwtOEjgb956/+m5ZrYT/Iq6Hax0OakWbokj8+9PXOnB7b/4AxESHieEtnNEy7ZpjsjYW1/5nK8fATQMmRxw==} peerDependencies: vue: '>=3.2.13' - peerDependenciesMeta: - vue: - optional: true vite@5.3.5: resolution: {integrity: sha512-MdjglKR6AQXQb9JGiS7Rc2wC6uMjcm7Go/NHNO63EwiJXfuk9PgqiP/n5IDJCziMkfw9n4Ubp7lttNwz+8ZVKA==} @@ -18113,7 +18106,6 @@ snapshots: vite-svg-loader@5.1.0(vue@3.4.35(typescript@5.5.4)): dependencies: svgo: 3.2.0 - optionalDependencies: vue: 3.4.35(typescript@5.5.4) vite@5.3.5(@types/node@18.19.31)(sass@1.77.8):