diff --git a/Readme.md b/Readme.md index aff2bec..4ea8e44 100644 --- a/Readme.md +++ b/Readme.md @@ -18,6 +18,29 @@ Metalsmith(__dirname) .build(); ``` +### Enhanced mode (Markdown) + +Use an array and even decide, if it should already parse your Markdown files: + +```js +var Metalsmith = require('metalsmith'); +var headings = require('headings'); +var markdown = require('metalsmith-markdown'); + +Metalsmith(__dirname) + .use(headings({ + mode: 'md', // set to anything else or remove this property for HTML-mode + selectors: ['h1', 'h2'], + })) + .use(markdown()) // Invoke this function somewhere after 'headings' + .build(); +``` + +Bear in mind to include this function somewhere before your `.use(markdown())` function. +Otherwise, `metalsmith` would compile your files into HTML before it would extract your headings. + +One other thing to mention would be that `mode: 'md'` orders your headings according to their position in the `selectors` array in the options object, whereas the *legacy* HTML-mode orders your headings according to their position in your files. You choose. + ## License MIT \ No newline at end of file diff --git a/lib/index.js b/lib/index.js index 8f7a46e..cf333b1 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,6 +1,8 @@ var cheerio = require('cheerio'); +var debug = require('debug')('metalsmith-headings'); var extname = require('path').extname; +var slug = require('slug'); /** * Expose `plugin`. @@ -8,34 +10,86 @@ var extname = require('path').extname; module.exports = plugin; +/** + * Filters selectors out of a Markdown file + * @param {Object} data + * @param {string[]} selectors + */ +function filterMarkdown(data, selectors) { + const headers = { + h1: /^#{1}\s+(.+?)$/gim, + h2: /^#{2}\s+(.+?)$/gim, + h3: /^#{3}\s+(.+?)$/gim, + h4: /^#{4}\s+(.+?)$/gim, + h5: /^#{5}\s+(.+?)$/gim, + h6: /^#{6}\s+(.+?)$/gim, + }; + const regexes = selectors.map((selector) => headers[selector]).filter((entry) => entry !== null || typeof entry !== 'undefined'); + const contents = data.contents.toString(); + data.headings = []; + + regexes.forEach((regex, index) => { + let found; + while ((found = regex.exec(contents)) !== null) { + if (found.index === regex.lastIndex) { + regex.lastIndex++; + } + + if (found[1].length) { + data.headings.push({ + id: slug(found[1]), + tag: selectors[index], + text: found[1], + }); + } + } + }); + return data; +} + +/** + * Filters selectors out of an HTML file + * @param {Object} data the file object + * @param {string[]} selectors The selectors array + */ +function filterHTML(data, selectors) { + var contents = data.contents.toString(); + var $ = cheerio.load(contents); + data.headings = []; + $(selectors.join(',')).each(function() { + data.headings.push({ + id: $(this).attr('id'), + tag: $(this)[0].name, + text: $(this).text() + }); + }); + return data; +} + /** * Get the headings from any html files. * * @param {String or Object} options (optional) * @property {Array} selectors */ - -function plugin(options){ +function plugin(options) { if ('string' == typeof options) options = { selectors: [options] }; - options = options || {}; + options = options || { }; var selectors = options.selectors || ['h2']; return function(files, metalsmith, done){ setImmediate(done); - Object.keys(files).forEach(function(file){ - if ('.html' != extname(file)) return; + Object.keys(files).forEach(function(file) { var data = files[file]; - var contents = data.contents.toString(); - var $ = cheerio.load(contents); - data.headings = []; - - $(selectors.join(',')).each(function(){ - data.headings.push({ - id: $(this).attr('id'), - tag: $(this)[0].name, - text: $(this).text() - }); - }); + debug(`Currently processing: ${file}\nMode: ${options.mode || 'html (default)'}`); + if (options.mode !== 'md' && '.html' === extname(file)) { + data = filterHTML(data, selectors); + } + if (options.mode === 'md' && '.md' === extname(file)) { + data = filterMarkdown(data, selectors); + } + debug(`Found: ${data.headings.length} headings.`); + return; }); }; } \ No newline at end of file diff --git a/package.json b/package.json index 152a9b3..7fb9220 100644 --- a/package.json +++ b/package.json @@ -9,11 +9,13 @@ "test": "mocha --reporter spec" }, "dependencies": { - "cheerio": "^0.14.0" + "cheerio": "^0.14.0", + "debug": "^3.1.0", + "slug": "^0.9.1" }, "devDependencies": { - "mocha": "1.x", "metalsmith": "0.x", - "metalsmith-markdown": "^0.2.1" + "metalsmith-markdown": "^0.2.1", + "mocha": "1.x" } } diff --git a/test/index.js b/test/index.js index ed62d7e..2cc4acf 100644 --- a/test/index.js +++ b/test/index.js @@ -19,6 +19,36 @@ describe('metalsmith-headings', function(){ }); }); + it('should parse headings from Markdown only for h2', function(done){ + Metalsmith('test/fixture') + .use(headings({ selectors: ['h2'], mode: 'md' })) + .use(markdown()) + .build(function(err, files){ + if (err) return done(err); + assert.deepEqual(files['index.html'].headings, [ + { id: 'two-one', tag: 'h2', text: 'two one' }, + { id: 'two-two', tag: 'h2', text: 'two two' } + ]); + done(); + }); + }); + + it('should parse headings from Markdown for h1 and h2', function(done){ + Metalsmith('test/fixture') + .use(headings({ selectors: ['h1', 'h2'], mode: 'md' })) + .use(markdown()) + .build(function(err, files){ + if (err) return done(err); + assert.deepEqual(files['index.html'].headings, [ + { id: 'one-one', tag: 'h1', text: 'one one' }, + { id: 'one-two', tag: 'h1', text: 'one two' }, + { id: 'two-one', tag: 'h2', text: 'two one' }, + { id: 'two-two', tag: 'h2', text: 'two two' } + ]); + done(); + }); + }); + it('should accept a string shorthand', function(done){ Metalsmith('test/fixture') .use(markdown()) diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..d22653c --- /dev/null +++ b/yarn.lock @@ -0,0 +1,403 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +CSSselect@~0.4.0: + version "0.4.1" + resolved "https://registry.yarnpkg.com/CSSselect/-/CSSselect-0.4.1.tgz#f8ab7e1f8418ce63cda6eb7bd778a85d7ec492b2" + dependencies: + CSSwhat "0.4" + domutils "1.4" + +CSSwhat@0.4: + version "0.4.7" + resolved "https://registry.yarnpkg.com/CSSwhat/-/CSSwhat-0.4.7.tgz#867da0ff39f778613242c44cfea83f0aa4ebdf9b" + +ansi-regex@^0.2.0, ansi-regex@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-0.2.1.tgz#0d8e946967a3d8143f93e24e298525fc1b2235f9" + +ansi-styles@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-1.1.0.tgz#eaecbf66cd706882760b2f4691582b8f55d7a7de" + +async@~0.9.0: + version "0.9.2" + resolved "https://registry.yarnpkg.com/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d" + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + +brace-expansion@^1.1.7: + version "1.1.8" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +chalk@^0.5.0: + version "0.5.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-0.5.1.tgz#663b3a648b68b55d04690d49167aa837858f2174" + dependencies: + ansi-styles "^1.1.0" + escape-string-regexp "^1.0.0" + has-ansi "^0.1.0" + strip-ansi "^0.3.0" + supports-color "^0.2.0" + +cheerio@^0.14.0: + version "0.14.0" + resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-0.14.0.tgz#209648d501846de95cdca6440f389a7f5c29dc8f" + dependencies: + CSSselect "~0.4.0" + entities "~1.0.0" + htmlparser2 "~3.7.0" + lodash "~2.4.1" + +clone@^0.1.11: + version "0.1.19" + resolved "https://registry.yarnpkg.com/clone/-/clone-0.1.19.tgz#613fb68639b26a494ac53253e15b1a6bd88ada85" + +commander@0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-0.6.1.tgz#fa68a14f6a945d54dbbe50d8cdb3320e9e3b1a06" + +commander@2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.3.0.tgz#fd430e889832ec353b9acd1de217c11cb3eef873" + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + +core-util-is@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + +debug@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.0.0.tgz#89bd9df6732b51256bc6705342bba02ed12131ef" + dependencies: + ms "0.6.2" + +debug@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + dependencies: + ms "2.0.0" + +debug@~0.7.4: + version "0.7.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-0.7.4.tgz#06e1ea8082c2cb14e39806e22e2f6f757f92af39" + +diff@1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/diff/-/diff-1.0.8.tgz#343276308ec991b7bc82267ed55bc1411f971666" + +dom-serializer@0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.1.0.tgz#073c697546ce0780ce23be4a28e293e40bc30c82" + dependencies: + domelementtype "~1.1.1" + entities "~1.1.1" + +domelementtype@1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.3.0.tgz#b17aed82e8ab59e52dd9c19b1756e0fc187204c2" + +domelementtype@~1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.1.3.tgz#bd28773e2642881aec51544924299c5cd822185b" + +domhandler@2.2: + version "2.2.1" + resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.2.1.tgz#59df9dcd227e808b365ae73e1f6684ac3d946fc2" + dependencies: + domelementtype "1" + +domutils@1.4: + version "1.4.3" + resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.4.3.tgz#0865513796c6b306031850e175516baf80b72a6f" + dependencies: + domelementtype "1" + +domutils@1.5: + version "1.5.1" + resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.5.1.tgz#dcd8488a26f563d61079e48c9f7b7e32373682cf" + dependencies: + dom-serializer "0" + domelementtype "1" + +entities@1.0, entities@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/entities/-/entities-1.0.0.tgz#b2987aa3821347fcde642b24fdfc9e4fb712bf26" + +entities@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.1.tgz#6e5c2d0a5621b5dadaecef80b90edfb5cd7772f0" + +escape-string-regexp@1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.2.tgz#4dbc2fe674e71949caf3fb2695ce7f2dc1d9a8d1" + +escape-string-regexp@^1.0.0: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + +front-matter@~0.2.0: + version "0.2.3" + resolved "https://registry.yarnpkg.com/front-matter/-/front-matter-0.2.3.tgz#48fbaa2de1856ca475b5d38dff0b2d6d125196db" + dependencies: + yaml-js "^0.1.0" + +fs-extra@~0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-0.10.0.tgz#99c0ec2fd5eaaad9d646245e4b014b56729982af" + dependencies: + jsonfile "^1.2.0" + mkdirp "^0.5.0" + ncp "^0.5.1" + rimraf "^2.2.8" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + +glob@3.2.3: + version "3.2.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-3.2.3.tgz#e313eeb249c7affaa5c475286b0e115b59839467" + dependencies: + graceful-fs "~2.0.0" + inherits "2" + minimatch "~0.2.11" + +glob@^7.0.5: + version "7.1.2" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +graceful-fs@~2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-2.0.3.tgz#7cd2cdb228a4a3f36e95efa6cc142de7d1a136d0" + +growl@1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.8.1.tgz#4b2dec8d907e93db336624dcec0183502f8c9428" + +has-ansi@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-0.1.0.tgz#84f265aae8c0e6a88a12d7022894b7568894c62e" + dependencies: + ansi-regex "^0.2.0" + +htmlparser2@~3.7.0: + version "3.7.3" + resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.7.3.tgz#6a64c77637c08c6f30ec2a8157a53333be7cb05e" + dependencies: + domelementtype "1" + domhandler "2.2" + domutils "1.5" + entities "1.0" + readable-stream "1.1" + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@~2.0.1: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + +is-utf8@~0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" + +isarray@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" + +jade@0.26.3: + version "0.26.3" + resolved "https://registry.yarnpkg.com/jade/-/jade-0.26.3.tgz#8f10d7977d8d79f2f6ff862a81b0513ccb25686c" + dependencies: + commander "0.6.1" + mkdirp "0.3.0" + +jsonfile@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-1.2.0.tgz#5f35d6cd9f946ec97b5b18353fa9e58df1b86f6a" + +lodash@~2.4.1: + version "2.4.2" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-2.4.2.tgz#fadd834b9683073da179b3eae6d9c0d15053f73e" + +lru-cache@2: + version "2.7.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-2.7.3.tgz#6d4524e8b955f95d4f5b58851ce21dd72fb4e952" + +marked@~0.3.1: + version "0.3.6" + resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.6.tgz#b2c6c618fccece4ef86c4fc6cb8a7cbf5aeda8d7" + +metalsmith-markdown@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/metalsmith-markdown/-/metalsmith-markdown-0.2.1.tgz#1a1feeb6c76d15407b75271da81509d07932d753" + dependencies: + debug "~0.7.4" + marked "~0.3.1" + +metalsmith@0.x: + version "0.11.0" + resolved "https://registry.yarnpkg.com/metalsmith/-/metalsmith-0.11.0.tgz#72560227c9e35413cc7a3af3e4e8dbe8966fb531" + dependencies: + async "~0.9.0" + chalk "^0.5.0" + clone "^0.1.11" + front-matter "~0.2.0" + fs-extra "~0.10.0" + is-utf8 "~0.2.0" + recursive-readdir "1.1.2" + rimraf "^2.2.8" + stat-mode "^0.2.0" + ware "~0.3.0" + +minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + dependencies: + brace-expansion "^1.1.7" + +minimatch@~0.2.11: + version "0.2.14" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-0.2.14.tgz#c74e780574f63c6f9a090e90efbe6ef53a6a756a" + dependencies: + lru-cache "2" + sigmund "~1.0.0" + +minimist@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + +mkdirp@0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.3.0.tgz#1bbf5ab1ba827af23575143490426455f481fe1e" + +mkdirp@0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.0.tgz#1d73076a6df986cd9344e15e71fcc05a4c9abf12" + dependencies: + minimist "0.0.8" + +mkdirp@^0.5.0: + version "0.5.1" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + dependencies: + minimist "0.0.8" + +mocha@1.x: + version "1.21.5" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-1.21.5.tgz#7c58b09174df976e434a23b1e8d639873fc529e9" + dependencies: + commander "2.3.0" + debug "2.0.0" + diff "1.0.8" + escape-string-regexp "1.0.2" + glob "3.2.3" + growl "1.8.1" + jade "0.26.3" + mkdirp "0.5.0" + +ms@0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-0.6.2.tgz#d89c2124c6fdc1353d65a8b77bf1aac4b193708c" + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + +ncp@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/ncp/-/ncp-0.5.1.tgz#743985316e3db459281b587169e845735a05439f" + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + dependencies: + wrappy "1" + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + +readable-stream@1.1: + version "1.1.13" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.13.tgz#f6eef764f514c89e2b9e23146a75ba106756d23e" + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "0.0.1" + string_decoder "~0.10.x" + +recursive-readdir@1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/recursive-readdir/-/recursive-readdir-1.1.2.tgz#b7ba725384641751c4a092109fa47919c0a0ce04" + +rimraf@^2.2.8: + version "2.6.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" + dependencies: + glob "^7.0.5" + +sigmund@~1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590" + +slug@^0.9.1: + version "0.9.1" + resolved "https://registry.yarnpkg.com/slug/-/slug-0.9.1.tgz#af08f608a7c11516b61778aa800dce84c518cfda" + dependencies: + unicode ">= 0.3.1" + +stat-mode@^0.2.0: + version "0.2.2" + resolved "https://registry.yarnpkg.com/stat-mode/-/stat-mode-0.2.2.tgz#e6c80b623123d7d80cf132ce538f346289072502" + +string_decoder@~0.10.x: + version "0.10.31" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" + +strip-ansi@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-0.3.0.tgz#25f48ea22ca79187f3174a4db8759347bb126220" + dependencies: + ansi-regex "^0.2.1" + +supports-color@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-0.2.0.tgz#d92de2694eb3f67323973d7ae3d8b55b4c22190a" + +"unicode@>= 0.3.1": + version "10.0.0" + resolved "https://registry.yarnpkg.com/unicode/-/unicode-10.0.0.tgz#e5d51c1db93b6c71a0b879e0b0c4af7e6fdf688e" + +ware@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/ware/-/ware-0.3.0.tgz#2df8044973542ecb5eb54397d7cd3773bcf8e9eb" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + +yaml-js@^0.1.0: + version "0.1.5" + resolved "https://registry.yarnpkg.com/yaml-js/-/yaml-js-0.1.5.tgz#a01369010b3558d8aaed2394615dfd0780fd8fac"