Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update to js-yaml v4, reduce bundle size by ~70% #145

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/sections.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand Down
4 changes: 2 additions & 2 deletions lib/engines.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
};

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion test/parse-custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down