fix(deps): keep gray-matter loading on js-yaml 5

gray-matter 4.x still binds safeLoad/safeDump at require time, which js-yaml 5 removed. Wrap v5 with those aliases so Eleventy can boot, and leave Eleventy itself on js-yaml 4.
This commit is contained in:
Adam Moussa 2026-09-21 12:21:56 -04:00
parent 76bd14fc24
commit 605d223506
No known key found for this signature in database
4 changed files with 73 additions and 27 deletions

View file

@ -0,0 +1,17 @@
"use strict";
const yaml = require("js-yaml-upstream");
function safeLoad(input, options) {
if (input == null || String(input).trim() === "") {
return undefined;
}
return yaml.load(input, options);
}
module.exports = Object.assign({}, yaml, {
load: yaml.load,
dump: yaml.dump,
safeLoad,
safeDump: yaml.dump,
});

View file

@ -0,0 +1,10 @@
{
"name": "js-yaml",
"version": "5.4.2",
"private": true,
"description": "js-yaml 5 with safeLoad/safeDump aliases for gray-matter 4.x and a CJS default export for Eleventy.",
"main": "index.js",
"dependencies": {
"js-yaml-upstream": "npm:js-yaml@5.4.2"
}
}

68
package-lock.json generated
View file

@ -9,7 +9,15 @@
"version": "1.0.0",
"license": "UNLICENSED",
"dependencies": {
"@11ty/eleventy": "3.1.6"
"@11ty/eleventy": "3.1.6",
"js-yaml": "file:compat/js-yaml-safe-api"
}
},
"compat/js-yaml-safe-api": {
"name": "js-yaml",
"version": "5.4.2",
"dependencies": {
"js-yaml-upstream": "npm:js-yaml@5.4.2"
}
},
"node_modules/@11ty/dependency-tree": {
@ -145,6 +153,28 @@
"url": "https://opencollective.com/11ty"
}
},
"node_modules/@11ty/eleventy/node_modules/js-yaml": {
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz",
"integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/puzrin"
},
{
"type": "github",
"url": "https://github.com/sponsors/nodeca"
}
],
"license": "MIT",
"dependencies": {
"argparse": "^2.0.1"
},
"bin": {
"js-yaml": "bin/js-yaml.js"
}
},
"node_modules/@11ty/lodash-custom": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/@11ty/lodash-custom/-/lodash-custom-4.17.21.tgz",
@ -720,27 +750,10 @@
"node": ">=6.0"
}
},
"node_modules/gray-matter/compat/js-yaml-safe-api": {},
"node_modules/gray-matter/node_modules/js-yaml": {
"version": "5.4.2",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-5.4.2.tgz",
"integrity": "sha512-m+aqu+LwO1O6sIopafj8HUVl5aawITwZQe/yHpMCKjaWBaA/d07B/QdMb3529REftiU+RMMHL3Vlsw3hON7vWg==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/puzrin"
},
{
"type": "github",
"url": "https://github.com/sponsors/nodeca"
}
],
"license": "MIT",
"dependencies": {
"argparse": "^2.0.1"
},
"bin": {
"js-yaml": "bin/js-yaml.mjs"
}
"resolved": "node_modules/gray-matter/compat/js-yaml-safe-api",
"link": true
},
"node_modules/htmlparser2": {
"version": "7.2.0",
@ -909,9 +922,14 @@
}
},
"node_modules/js-yaml": {
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz",
"integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==",
"resolved": "compat/js-yaml-safe-api",
"link": true
},
"node_modules/js-yaml-upstream": {
"name": "js-yaml",
"version": "5.4.2",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-5.4.2.tgz",
"integrity": "sha512-m+aqu+LwO1O6sIopafj8HUVl5aawITwZQe/yHpMCKjaWBaA/d07B/QdMb3529REftiU+RMMHL3Vlsw3hON7vWg==",
"funding": [
{
"type": "github",
@ -927,7 +945,7 @@
"argparse": "^2.0.1"
},
"bin": {
"js-yaml": "bin/js-yaml.js"
"js-yaml": "bin/js-yaml.mjs"
}
},
"node_modules/junk": {

View file

@ -10,11 +10,12 @@
},
"license": "UNLICENSED",
"dependencies": {
"@11ty/eleventy": "3.1.6"
"@11ty/eleventy": "3.1.6",
"js-yaml": "file:compat/js-yaml-safe-api"
},
"overrides": {
"gray-matter": {
"js-yaml": "^5.4.2"
"js-yaml": "$js-yaml"
}
}
}