Skip to content

fix: migrate YAML parsing from js-yaml to yaml - #5809

Open
stevenjoezhang wants to merge 1 commit into
masterfrom
fix/issue-5801-migrate-yaml
Open

fix: migrate YAML parsing from js-yaml to yaml#5809
stevenjoezhang wants to merge 1 commit into
masterfrom
fix/issue-5801-migrate-yaml

Conversation

@stevenjoezhang

Copy link
Copy Markdown
Member

What does it do?

Fixes #5801.

This migrates Hexo's direct YAML parsing and stringification from js-yaml to yaml, and removes the direct dependencies on js-yaml, js-yaml-js-types, and @types/js-yaml.

js-yaml-js-types extends the schema with !!js/function, allowing YAML input to construct executable functions. The new shared parser rejects unresolved tags such as !!js/function, while preserving the existing behavior for:

  • YAML timestamps parsed as Date
  • YAML merge keys (<<)
  • !!js/regexp
  • Duplicate keys in JSON multi-config files

YAML parsing and stringification in the renderer, multi-config handling, config command, and scaffold front matter have been migrated. Related tests now use yaml as well.

js-yaml remains a transitive dependency of hexo-front-matter@4.2.1. Upgrading to hexo-front-matter@5 is kept separate because it is tied to the timezone migration. The vulnerable js-yaml-js-types dependency is removed entirely.

Local validation:

  • npm run build
  • npm run eslint
  • YAML renderer tests: 6 passing
  • Full test suite: 1281 passing, 5 pending; the 7 failures under Node.js 26 are also present on the base branch and are unrelated to this change

Screenshots

N/A — internal parser and dependency changes only.

Pull request tasks

  • Add test cases for the changes.
  • Passed the CI test.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown

How to test

git clone -b fix/issue-5801-migrate-yaml https://github.com/hexojs/hexo.git
cd hexo
npm install
npm test

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails
npm/esprima 4.0.1 🟢 3.9
Details
CheckScoreReason
Code-Review🟢 3Found 11/29 approved changesets -- score normalized to 3
Maintained⚠️ 00 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Packaging⚠️ -1packaging workflow not detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
License🟢 10license file detected
Binary-Artifacts🟢 10no binaries found in the repo
Signed-Releases⚠️ -1no releases found
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
Pinned-Dependencies⚠️ 2dependency not pinned by hash detected -- score normalized to 2
Security-Policy🟢 10security policy file detected
Fuzzing⚠️ 0project is not fuzzed
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
npm/yaml 2.9.0 🟢 8
Details
CheckScoreReason
Code-Review🟢 7Found 3/4 approved changesets -- score normalized to 7
Security-Policy🟢 10security policy file detected
Maintained🟢 1030 commit(s) and 5 issue activity found in the last 90 days -- score normalized to 10
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Packaging⚠️ -1packaging workflow not detected
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Binary-Artifacts🟢 10no binaries found in the repo
Token-Permissions🟢 9detected GitHub workflow tokens with excessive permissions
Pinned-Dependencies⚠️ 2dependency not pinned by hash detected -- score normalized to 2
License🟢 10license file detected
Fuzzing🟢 10project is fuzzed
Branch-Protection🟢 3branch protection is not maximal on development and all release branches
Signed-Releases⚠️ -1no releases found
SAST🟢 10SAST tool is run on all commits

Scanned Files

  • package-lock.json
  • package.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

source/_data YAML can define executable JS via default !!js/function (js-yaml-js-types.all)

1 participant