Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: cheeriojs/cheerio
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.0-rc.12
Choose a base ref
...
head repository: cheeriojs/cheerio
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.0.0
Choose a head ref
Loading
Showing with 24,786 additions and 12,790 deletions.
  1. +29 −10 .eslintrc.json
  2. +6 −0 .github/dependabot.yml
  3. +6 −5 .github/workflows/benchmark.yml
  4. +11 −11 .github/workflows/ci.yml
  5. +3 −3 .github/workflows/codeql.yml
  6. +4 −4 .github/workflows/dependabot-automerge.yml
  7. +3 −4 .github/workflows/lint.yml
  8. +62 −16 .github/workflows/site.yml
  9. +9 −6 .github/workflows/sponsors.yml
  10. +7 −3 .gitignore
  11. +1 −1 .husky/pre-commit
  12. +6 −4 CONTRIBUTING.md
  13. +0 −631 History.md
  14. +94 −204 Readme.md
  15. +11 −0 SECURITY.md
  16. +0 −5 benchmark/.eslintrc.json
  17. +187 −246 benchmark/benchmark.ts
  18. +0 −98 benchmark/suite.ts
  19. +5,367 −9,857 package-lock.json
  20. +140 −96 package.json
  21. +371 −0 scripts/fetch-sponsors.mts
  22. +0 −280 scripts/fetch-sponsors.ts
  23. +30 −11 src/__fixtures__/fixtures.ts
  24. +39 −129 src/__tests__/deprecated.spec.ts
  25. +10 −9 src/__tests__/xml.spec.ts
  26. +115 −87 src/api/attributes.spec.ts
  27. +203 −138 src/api/attributes.ts
  28. +17 −16 src/api/css.spec.ts
  29. +21 −17 src/api/css.ts
  30. +121 −0 src/api/extract.spec.ts
  31. +92 −0 src/api/extract.ts
  32. +5 −5 src/api/forms.spec.ts
  33. +16 −13 src/api/forms.ts
  34. +82 −77 src/api/manipulation.spec.ts
  35. +141 −89 src/api/manipulation.ts
  36. +102 −76 src/api/traversing.spec.ts
  37. +142 −77 src/api/traversing.ts
  38. +74 −132 src/cheerio.spec.ts
  39. +36 −18 src/cheerio.ts
  40. +10 −0 src/index-browser.mts
  41. +176 −6 src/index.spec.ts
  42. +233 −93 src/index.ts
  43. +39 −0 src/load-parse.ts
  44. +6 −6 src/load.spec.ts
  45. +85 −53 src/load.ts
  46. +58 −34 src/options.ts
  47. +39 −35 src/parse.spec.ts
  48. +6 −6 src/parse.ts
  49. +14 −12 src/parsers/parse5-adapter.ts
  50. +20 −23 src/slim.ts
  51. +58 −52 src/static.spec.ts
  52. +50 −26 src/static.ts
  53. +3 −5 src/types.ts
  54. +32 −0 src/utils.spec.ts
  55. +5 −40 src/utils.ts
  56. +0 −5 tsconfig.eslint.json
  57. +5 −16 tsconfig.json
  58. +4 −0 tsconfig.typedoc.json
  59. +15 −0 vitest.config.ts
  60. +22 −0 website/.eslintrc.json
  61. +28 −0 website/README.md
  62. +3 −0 website/babel.config.js
  63. +44 −0 website/blog/2023-02-13-new-website.md
  64. +148 −0 website/blog/2024-08-07-version-1.md
  65. +7 −0 website/blog/authors.yml
  66. +13 −0 website/crowdin.yml
  67. +7 −0 website/docs/advanced/_category_.json
  68. +156 −0 website/docs/advanced/configuring-cheerio.md
  69. +61 −0 website/docs/advanced/extending-cheerio.md
  70. +187 −0 website/docs/advanced/extract.md
  71. +7 −0 website/docs/basics/_category_.json
  72. +161 −0 website/docs/basics/loading.md
  73. +261 −0 website/docs/basics/manipulation.md
  74. +119 −0 website/docs/basics/selecting.md
  75. +423 −0 website/docs/basics/traversing.md
  76. +122 −0 website/docs/intro.md
  77. +261 −0 website/docusaurus.config.js
  78. +13,583 −0 website/package-lock.json
  79. +55 −0 website/package.json
  80. +175 −0 website/sponsors.json
  81. +67 −0 website/src/components/HomepageFeatures.tsx
  82. +21 −0 website/src/components/HomepageSponsors.module.css
  83. +50 −0 website/src/components/HomepageSponsors.tsx
  84. +175 −0 website/src/components/HomepageTweets.tsx
  85. +55 −0 website/src/css/custom.css
  86. +17 −0 website/src/pages/attribution.mdx
  87. +46 −0 website/src/pages/index.tsx
  88. +11 −0 website/src/theme/ReactLiveScope/index.tsx
  89. BIN website/static/fonts/inter.woff
  90. BIN website/static/fonts/rubik.woff
  91. +15 −0 website/static/img/1F496.svg
  92. +11 −0 website/static/img/1F57A.svg
  93. +8 −0 website/static/img/26A1.svg
  94. BIN website/static/img/favicon.ico
  95. +27 −0 website/static/img/orange-c-animated.svg
  96. +9 −0 website/static/img/orange-c.svg
  97. +10 −0 website/tsconfig.json
39 changes: 29 additions & 10 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -3,7 +3,8 @@
"extends": [
"eslint:recommended",
"plugin:jsdoc/recommended",
"plugin:node/recommended",
"plugin:n/recommended",
"plugin:unicorn/recommended",
"prettier"
],
"env": { "node": true },
@@ -46,23 +47,33 @@
"no-void": 2,

"jsdoc/require-jsdoc": 0,
"jsdoc/check-param-names": 0,
"jsdoc/check-tag-names": 2,
"jsdoc/newline-after-description": 2,
"jsdoc/tag-lines": [2, "any", { "startLines": 1 }],
"jsdoc/require-description-complete-sentence": 2,
"jsdoc/require-hyphen-before-param-description": 2,
"jsdoc/require-param-description": 2,
"jsdoc/require-param-name": 2,
"jsdoc/require-param-type": 0,
"jsdoc/require-returns-type": 0,
"jsdoc/require-param": 0,
"jsdoc/no-types": 2,
"jsdoc/valid-types": 2,
"jsdoc/tag-lines": 0,

"node/no-unsupported-features/es-syntax": 0,
"node/file-extension-in-import": ["error", "always"],
"node/no-missing-import": 0
"n/file-extension-in-import": [2, "always"],
"n/no-missing-import": 0,

"unicorn/no-null": 0,
"unicorn/prevent-abbreviations": 0,
"unicorn/prefer-code-point": 0,
"unicorn/no-for-loop": 0,
"unicorn/no-array-callback-reference": 0,
"unicorn/prefer-spread": 0,
"unicorn/no-useless-undefined": 0,
"unicorn/no-array-reduce": 0,
"unicorn/prefer-array-find": 0,
"unicorn/prefer-module": 0,
"unicorn/prefer-at": 0,
"unicorn/prefer-string-replace-all": 0,
"unicorn/prefer-switch": [2, { "emptyDefaultCase": "do-nothing-comment" }]
},
"settings": {
"jsdoc": {
@@ -75,18 +86,23 @@
"overrides": [
{
"files": "*.ts",
"plugins": ["expect-type"],
"extends": [
"plugin:expect-type/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"parserOptions": {
"sourceType": "module",
"project": "./tsconfig.eslint.json"
"project": "./tsconfig.json"
},
"rules": {
"dot-notation": 0,
"curly": [2, "multi-line"],
"n/no-unsupported-features/es-syntax": 0,

"jsdoc/require-returns-check": 0, // Broken with overloaded fns

"@typescript-eslint/prefer-for-of": 0,
"@typescript-eslint/member-ordering": 0,
@@ -102,14 +118,17 @@
"@typescript-eslint/prefer-includes": 2,
"@typescript-eslint/switch-exhaustiveness-check": 2,
"@typescript-eslint/prefer-nullish-coalescing": 2,
"@typescript-eslint/no-non-null-assertion": 1,
"@typescript-eslint/consistent-type-imports": 2,

"@typescript-eslint/no-explicit-any": 1 // TODO
}
},
{
"files": "*.spec.ts",
"extends": "plugin:jest/recommended",
"extends": "plugin:vitest/legacy-recommended",
"rules": {
"n/no-unpublished-import": 0,
"@typescript-eslint/no-explicit-any": 0
}
}
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -6,6 +6,12 @@ updates:
interval: daily
open-pull-requests-limit: 10
versioning-strategy: increase
- package-ecosystem: npm
directory: '/website'
schedule:
interval: daily
open-pull-requests-limit: 4
versioning-strategy: increase
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
11 changes: 6 additions & 5 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -8,24 +8,25 @@ on:

env:
FORCE_COLOR: 2
NODE: 16

permissions:
contents: read

jobs:
benchmark:
runs-on: ubuntu-latest
if: "!contains(github.event.commits[0].message, '[bench skip]') && !contains(github.event.commits[0].message, '[skip bench]')"
if:
"!contains(github.event.commits[0].message, '[bench skip]') &&
!contains(github.event.commits[0].message, '[skip bench]')"

steps:
- name: Clone repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3.3.0
uses: actions/setup-node@v4.0.3
with:
node-version: '${{ env.NODE }}'
node-version: lts/*
cache: 'npm'

- name: Install npm dependencies
22 changes: 11 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ on:

env:
FORCE_COLOR: 2
NODE_COV: 16 # The Node.js version to run coveralls on
NODE_COV: lts/* # The Node.js version to run coveralls on

permissions:
contents: read
@@ -25,34 +25,34 @@ jobs:
fail-fast: false
matrix:
node:
- 12
- 14
- 16
- 18
- 20
- 22
- lts/*

steps:
- name: Clone repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3.3.0
uses: actions/setup-node@v4.0.3
with:
node-version: '${{ matrix.node }}'
cache: 'npm'

- name: Install npm dependencies
run: npm ci

- name: Run Jest
run: npm run test:jest
- name: Run tests
run: npm run test:vi
if: matrix.node != env.NODE_COV

- name: Run Jest with coverage
run: npm run test:jest:cov
- name: Run tests with coverage
run: npm run test:vi -- --coverage
if: matrix.node == env.NODE_COV

- name: Run Coveralls
uses: coverallsapp/github-action@1.1.3
uses: coverallsapp/github-action@v2.3.0
if: matrix.node == env.NODE_COV
continue-on-error: true
with:
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -24,12 +24,12 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: 'javascript'

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
8 changes: 4 additions & 4 deletions .github/workflows/dependabot-automerge.yml
Original file line number Diff line number Diff line change
@@ -13,14 +13,14 @@ jobs:
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1.3.1
uses: dependabot/fetch-metadata@v2.2.0
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
- name: Enable auto-merge for Dependabot PRs
# Automatically merge semver-patch and semver-minor PRs
if: "${{ steps.metadata.outputs.update-type ==
'version-update:semver-minor' ||
steps.metadata.outputs.update-type ==
if:
"${{ steps.metadata.outputs.update-type ==
'version-update:semver-minor' || steps.metadata.outputs.update-type ==
'version-update:semver-patch' }}"
run: gh pr merge --auto --squash "$PR_URL"
env:
7 changes: 3 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@ on:

env:
FORCE_COLOR: 2
NODE: 16

permissions:
contents: read
@@ -19,12 +18,12 @@ jobs:

steps:
- name: Clone repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3.3.0
uses: actions/setup-node@v4.0.3
with:
node-version: '${{ env.NODE }}'
node-version: lts/*
cache: 'npm'

- name: Install npm dependencies
78 changes: 62 additions & 16 deletions .github/workflows/site.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,75 @@
name: Deploy to GitHub Pages
name: Deploy website to GitHub Pages

# Based on https://raw.githubusercontent.com/actions/starter-workflows

on:
# Runs on pushes targeting the main branch
push:
branches:
- main
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
FORCE_COLOR: 2
NODE: 16

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: 'pages'
cancel-in-progress: true

jobs:
deploy:
name: Deploy to GitHub Pages
# Build job
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3.3.0
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4.0.3
with:
node-version: '${{ env.NODE }}'
# Use current Node LTS version
node-version: lts/*
cache: 'npm'
- run: npm ci
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Install website dependencies
working-directory: website
run: npm ci
- name: Sync Crowdin
working-directory: website
run: npm run crowdin:sync
continue-on-error: true
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
- name: Build docs
run: npm run build:docs
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
working-directory: website
run: npm run build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs
cname: cheerio.js.org
path: ./website/build

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
if: ${{github.repository == 'cheeriojs/cheerio'}}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
15 changes: 9 additions & 6 deletions .github/workflows/sponsors.yml
Original file line number Diff line number Diff line change
@@ -4,10 +4,11 @@ on:
schedule:
# Run once a day, at 4pm
- cron: '0 16 * * *'
# Allow manual trigger
workflow_dispatch:

env:
FORCE_COLOR: 2
NODE: 16

permissions:
contents: read
@@ -21,12 +22,12 @@ jobs:

steps:
- name: Clone repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3.3.0
uses: actions/setup-node@v4.0.3
with:
node-version: '${{ env.NODE }}'
node-version: lts/*
cache: 'npm'

- name: Install npm dependencies
@@ -35,10 +36,12 @@ jobs:
- name: Update the README
run: npm run update-sponsors
env:
CHEERIO_SPONSORS_GITHUB_TOKEN: ${{ secrets.CHEERIO_SPONSORS_GITHUB_TOKEN }}
CHEERIO_SPONSORS_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IMGIX_TOKEN: ${{ secrets.IMGIX_TOKEN }}

- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
uses: peter-evans/create-pull-request@v6
continue-on-error: true
with:
commit-message: 'docs(readme): Update Sponsors'
title: Update Sponsors
Loading