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 3 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
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
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
4 changes: 2 additions & 2 deletions package.json
@@ -1,7 +1,7 @@
{
"name": "gray-matter",
"description": "Parse front-matter from a string or file. Fast, reliable and easy to use. Parses YAML front matter by default, but also has support for YAML, JSON, TOML or Coffee Front-Matter, with options to set custom delimiters. Used by metalsmith, assemble, verb and many other projects.",
"version": "4.0.3",
"version": "4.0.4",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this. version changes are typically done by maintainers. Also, I personally like to play it safe with major version bumps, especially since incompatible node versions can easily sneak in.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kk reverted that change 👍

"homepage": "https://github.com/jonschlinkert/gray-matter",
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
"contributors": [
Expand Down 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
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