Skip to content

Commit

Permalink
Merge pull request #1292 from dpc-sdp/fix/cheerio-default-export
Browse files Browse the repository at this point in the history
[SD-195] Cheerio default export has been removed
  • Loading branch information
dylankelly authored Aug 15, 2024
2 parents 2208716 + 0b83289 commit 9454dbf
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 23 deletions.
4 changes: 3 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ module.exports = {
'^.+\\.ts$': '<rootDir>/node_modules/ts-jest',
'.*\\.vue$': '<rootDir>/node_modules/@vue/vue3-jest'
},
transformIgnorePatterns: ['node_modules/(?!.pnpm)(?!(ripple-*|lodash-es)/)'],
transformIgnorePatterns: [
'node_modules/(?!.pnpm)(?!(ripple-*|lodash-es|cheerio)/)'
],
extensionsToTreatAsEsm: ['.ts'],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
Expand Down
4 changes: 2 additions & 2 deletions packages/nuxt-ripple/server/plugins/prefetch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as cheerio from 'cheerio'
import { load } from 'cheerio'
import type { NitroApp } from 'nitropack'

// fix type stub - See https://github.com/nuxt/nuxt/issues/18556
Expand All @@ -17,7 +17,7 @@ export default defineNitroPlugin((nitroApp) => {
// https://github.com/nuxt/nuxt/issues/18376

html.head = html.head.map((head) => {
const $ = cheerio.load(head)
const $ = load(head)
$('link[rel=prefetch]').each(function () {
$(this).remove()
})
Expand Down
4 changes: 2 additions & 2 deletions packages/ripple-tide-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@nuxt/kit": "3.11.2",
"axios": "^1.3.4",
"change-case": "^4.1.2",
"cheerio": "^1.0.0-rc.10",
"cheerio": "^1.0.0",
"h3": "^1.9.0",
"js-yaml": "^4.1.0",
"jsonapi-parse": "^2.0.1",
Expand All @@ -41,7 +41,7 @@
},
"devDependencies": {
"@nuxt/schema": "3.11.2",
"@types/cheerio": "^0.22.31",
"@types/cheerio": "^0.22.35",
"axios-mock-adapter": "^1.21.3",
"defu": "^6.1.2",
"rimraf": "^4.4.1"
Expand Down
4 changes: 2 additions & 2 deletions packages/ripple-tide-api/src/utils/markup-transpiler/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import cheerio from 'cheerio'
import { load } from 'cheerio'
import defaultPlugins from './default-plugins.js'

// A markup transpiler for converting HTML into Vue template by giving plugins.
Expand All @@ -10,7 +10,7 @@ const markupTranspiler = (
if (!html) {
return ''
}
const $ = cheerio.load(html, options)
const $ = load(html, options)
const $body = $('body')
let markupData = {}

Expand Down
90 changes: 74 additions & 16 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9454dbf

Please sign in to comment.