From ce19eeed582032f1920dd924c4829de11830fbde Mon Sep 17 00:00:00 2001 From: Zearin Date: Sat, 13 Apr 2024 10:41:05 -0400 Subject: [PATCH] deps: Update `js-yaml` to `^4.1.0` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The latest version of `js-yaml` uses the “safe” function variants by default now. The [migration guide for v3 to v4 is here](https://github.com/nodeca/js-yaml/blob/master/migrate_v3_to_v4.md), if you want to check for any edge cases. --- bower.json | 4 ++-- examples/sections.js | 2 +- lib/engines.js | 4 ++-- package.json | 2 +- test/parse-custom.js | 2 +- test/parse-yaml.js | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bower.json b/bower.json index e72652a..6c03acc 100644 --- a/bower.json +++ b/bower.json @@ -33,7 +33,7 @@ ], "dependencies": { "define-property": "^2.0.2", - "js-yaml": "^3.11.0", + "js-yaml": "^4.1.0", "kind-of": "^6.0.2", "section-matter": "^1.0.0", "strip-bom-string": "^1.0.0" @@ -113,4 +113,4 @@ "no-console": 0 } } -} \ No newline at end of file +} diff --git a/examples/sections.js b/examples/sections.js index bc6a6f3..5b621ed 100644 --- a/examples/sections.js +++ b/examples/sections.js @@ -9,7 +9,7 @@ const str = fs.readFileSync(path.join(__dirname, 'fixtures', 'sections.md')); const file = matter(str, { section: function(section, file) { if (typeof section.data === 'string' && section.data.trim() !== '') { - section.data = yaml.safeLoad(section.data); + section.data = yaml.load(section.data); } section.content = section.content.trim() + '\n'; } diff --git a/lib/engines.js b/lib/engines.js index 38f993d..1dfec8d 100644 --- a/lib/engines.js +++ b/lib/engines.js @@ -13,8 +13,8 @@ const engines = exports = module.exports; */ engines.yaml = { - parse: yaml.safeLoad.bind(yaml), - stringify: yaml.safeDump.bind(yaml) + parse: yaml.load.bind(yaml), + stringify: yaml.dump.bind(yaml) }; /** diff --git a/package.json b/package.json index 3ddd1ef..3441b5e 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "test": "mocha" }, "dependencies": { - "js-yaml": "^3.13.1", + "js-yaml": "^4.1.0", "kind-of": "^6.0.2", "section-matter": "^1.0.0", "strip-bom-string": "^1.0.0" diff --git a/test/parse-custom.js b/test/parse-custom.js index 14047eb..89e925a 100644 --- a/test/parse-custom.js +++ b/test/parse-custom.js @@ -16,7 +16,7 @@ describe('custom parser:', function() { var actual = matter.read('./test/fixtures/lang-yaml.md', { parser: function customParser(str, opts) { try { - return YAML.safeLoad(str, opts); + return YAML.load(str, opts); } catch (err) { throw new SyntaxError(err); } diff --git a/test/parse-yaml.js b/test/parse-yaml.js index 45bdc5c..31d15d4 100644 --- a/test/parse-yaml.js +++ b/test/parse-yaml.js @@ -53,9 +53,9 @@ describe('parse YAML:', function() { assert(actual.hasOwnProperty('orig')); }); - it('should use safeLoad when specified', function() { + it('should use load when specified', function() { var fixture = '---\nabc: xyz\nversion: 2\n---\n\nThis is an alert\n'; - var actual = matter(fixture, {safeLoad: true}); + var actual = matter(fixture); assert.deepEqual(actual.data, {abc: 'xyz', version: 2}); assert.equal(actual.content, '\nThis is an alert\n'); assert(actual.hasOwnProperty('orig'));