From 05b50b4927c8628fab93a48e865b3d4f6d7a82d3 Mon Sep 17 00:00:00 2001 From: jkjoy Date: Mon, 9 Oct 2023 08:20:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9F=90=E4=BA=9B=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config.fluid.yml | 9 +- .../.github/ISSUE_TEMPLATE/bug_report.yml | 73 - .../.github/ISSUE_TEMPLATE/config.yml | 22 - .../ISSUE_TEMPLATE/feature_request.yml | 14 - .../.github/workflows/publish.yml | 19 - .../.github/workflows/stale.yml | 19 - node_modules/hexo-theme-butterfly/LICENSE | 202 -- node_modules/hexo-theme-butterfly/README.md | 111 - .../hexo-theme-butterfly/README_CN.md | 111 - node_modules/hexo-theme-butterfly/_config.yml | 986 ------- .../languages/default.yml | 123 - .../hexo-theme-butterfly/languages/en.yml | 123 - .../hexo-theme-butterfly/languages/zh-CN.yml | 124 - .../hexo-theme-butterfly/languages/zh-TW.yml | 124 - .../hexo-theme-butterfly/layout/archive.pug | 9 - .../hexo-theme-butterfly/layout/category.pug | 14 - .../layout/includes/404.pug | 12 - .../layout/includes/additional-js.pug | 65 - .../layout/includes/footer.pug | 17 - .../layout/includes/head.pug | 69 - .../layout/includes/head/Open_Graph.pug | 14 - .../layout/includes/head/analytics.pug | 28 - .../layout/includes/head/config.pug | 132 - .../layout/includes/head/config_site.pug | 30 - .../layout/includes/head/google_adsense.pug | 9 - .../layout/includes/head/noscript.pug | 14 - .../layout/includes/head/preconnect.pug | 19 - .../layout/includes/head/pwa.pug | 11 - .../includes/head/site_verification.pug | 3 - .../layout/includes/header/index.pug | 52 - .../layout/includes/header/menu_item.pug | 27 - .../layout/includes/header/nav.pug | 21 - .../layout/includes/header/post-info.pug | 146 -- .../layout/includes/header/social.pug | 4 - .../layout/includes/layout.pug | 47 - .../includes/loading/fullpage-loading.pug | 33 - .../layout/includes/loading/index.pug | 4 - .../layout/includes/loading/pace.pug | 11 - .../layout/includes/mixins/article-sort.pug | 23 - .../layout/includes/mixins/post-ui.pug | 135 - .../layout/includes/page/categories.pug | 1 - .../layout/includes/page/default-page.pug | 2 - .../layout/includes/page/flink.pug | 82 - .../layout/includes/page/tags.pug | 2 - .../layout/includes/pagination.pug | 41 - .../layout/includes/post/post-copyright.pug | 17 - .../layout/includes/post/reward.pug | 13 - .../layout/includes/rightside.pug | 61 - .../layout/includes/sidebar.pug | 18 - .../includes/third-party/abcjs/abcjs.pug | 15 - .../includes/third-party/abcjs/index.pug | 6 - .../layout/includes/third-party/aplayer.pug | 3 - .../third-party/card-post-count/artalk.pug | 35 - .../third-party/card-post-count/disqus.pug | 16 - .../third-party/card-post-count/fb.pug | 18 - .../third-party/card-post-count/index.pug | 16 - .../third-party/card-post-count/remark42.pug | 18 - .../third-party/card-post-count/twikoo.pug | 37 - .../third-party/card-post-count/valine.pug | 20 - .../third-party/card-post-count/waline.pug | 20 - .../includes/third-party/chat/chatra.pug | 50 - .../includes/third-party/chat/crisp.pug | 45 - .../includes/third-party/chat/daovoice.pug | 40 - .../includes/third-party/chat/index.pug | 10 - .../includes/third-party/chat/messenger.pug | 44 - .../includes/third-party/chat/tidio.pug | 45 - .../includes/third-party/comments/artalk.pug | 50 - .../includes/third-party/comments/disqus.pug | 49 - .../third-party/comments/disqusjs.pug | 57 - .../comments/facebook_comments.pug | 46 - .../includes/third-party/comments/giscus.pug | 53 - .../includes/third-party/comments/gitalk.pug | 41 - .../includes/third-party/comments/index.pug | 46 - .../includes/third-party/comments/js.pug | 26 - .../includes/third-party/comments/livere.pug | 26 - .../third-party/comments/remark42.pug | 68 - .../includes/third-party/comments/twikoo.pug | 53 - .../third-party/comments/utterances.pug | 36 - .../includes/third-party/comments/valine.pug | 33 - .../includes/third-party/comments/waline.pug | 34 - .../layout/includes/third-party/effect.pug | 35 - .../includes/third-party/math/index.pug | 18 - .../includes/third-party/math/katex.pug | 9 - .../includes/third-party/math/mathjax.pug | 38 - .../includes/third-party/math/mermaid.pug | 38 - .../third-party/newest-comments/artalk.pug | 110 - .../newest-comments/disqus-comment.pug | 82 - .../newest-comments/github-issues.pug | 109 - .../third-party/newest-comments/index.pug | 30 - .../third-party/newest-comments/remark42.pug | 80 - .../newest-comments/twikoo-comment.pug | 93 - .../third-party/newest-comments/valine.pug | 99 - .../third-party/newest-comments/waline.pug | 79 - .../layout/includes/third-party/pangu.pug | 20 - .../layout/includes/third-party/pjax.pug | 83 - .../layout/includes/third-party/prismjs.pug | 5 - .../includes/third-party/search/algolia.pug | 22 - .../includes/third-party/search/docsearch.pug | 27 - .../includes/third-party/search/index.pug | 6 - .../third-party/search/local-search.pug | 22 - .../includes/third-party/share/add-this.pug | 2 - .../includes/third-party/share/addtoany.pug | 10 - .../includes/third-party/share/index.pug | 7 - .../includes/third-party/share/share-js.pug | 4 - .../layout/includes/third-party/subtitle.pug | 92 - .../layout/includes/widget/card_ad.pug | 3 - .../includes/widget/card_announcement.pug | 6 - .../layout/includes/widget/card_archives.pug | 7 - .../layout/includes/widget/card_author.pug | 27 - .../includes/widget/card_bottom_self.pug | 9 - .../includes/widget/card_categories.pug | 4 - .../includes/widget/card_newest_comment.pug | 7 - .../layout/includes/widget/card_post_toc.pug | 15 - .../includes/widget/card_recent_post.pug | 27 - .../layout/includes/widget/card_tags.pug | 14 - .../layout/includes/widget/card_top_self.pug | 8 - .../layout/includes/widget/card_webinfo.pug | 35 - .../layout/includes/widget/index.pug | 34 - .../hexo-theme-butterfly/layout/index.pug | 7 - .../hexo-theme-butterfly/layout/page.pug | 20 - .../hexo-theme-butterfly/layout/post.pug | 32 - .../hexo-theme-butterfly/layout/tag.pug | 14 - .../node_modules/.bin/stylus | 12 - .../node_modules/.bin/stylus.cmd | 17 - .../node_modules/.bin/stylus.ps1 | 28 - .../node_modules/debug/LICENSE | 20 - .../node_modules/debug/README.md | 481 ---- .../node_modules/debug/package.json | 59 - .../node_modules/debug/src/browser.js | 269 -- .../node_modules/debug/src/common.js | 274 -- .../node_modules/debug/src/index.js | 10 - .../node_modules/debug/src/node.js | 263 -- .../node_modules/hexo-renderer-stylus/LICENSE | 7 - .../hexo-renderer-stylus/README.md | 98 - .../hexo-renderer-stylus/index.js | 7 - .../hexo-renderer-stylus/lib/renderer.js | 64 - .../hexo-renderer-stylus/package.json | 45 - .../node_modules/ms/index.js | 162 -- .../node_modules/ms/license.md | 21 - .../node_modules/ms/package.json | 37 - .../node_modules/ms/readme.md | 60 - .../node_modules/source-map/LICENSE | 28 - .../node_modules/source-map/README.md | 822 ------ .../source-map/dist/source-map.js | 1 - .../node_modules/source-map/lib/array-set.js | 100 - .../node_modules/source-map/lib/base64-vlq.js | 111 - .../node_modules/source-map/lib/base64.js | 18 - .../source-map/lib/binary-search.js | 107 - .../source-map/lib/mapping-list.js | 80 - .../node_modules/source-map/lib/mappings.wasm | Bin 48693 -> 0 bytes .../node_modules/source-map/lib/read-wasm.js | 49 - .../source-map/lib/source-map-consumer.js | 1237 --------- .../source-map/lib/source-map-generator.js | 413 --- .../source-map/lib/source-node.js | 404 --- .../node_modules/source-map/lib/util.js | 546 ---- .../node_modules/source-map/lib/wasm.js | 107 - .../node_modules/source-map/package.json | 91 - .../node_modules/source-map/source-map.d.ts | 369 --- .../node_modules/source-map/source-map.js | 8 - .../node_modules/stylus/Changelog.md | 1469 ----------- .../node_modules/stylus/LICENSE | 22 - .../node_modules/stylus/Readme.md | 90 - .../node_modules/stylus/bin/stylus | 846 ------ .../node_modules/stylus/index.js | 1 - .../node_modules/stylus/lib/browserify.js | 2 - .../node_modules/stylus/lib/cache/fs.js | 80 - .../node_modules/stylus/lib/cache/index.js | 25 - .../node_modules/stylus/lib/cache/memory.js | 116 - .../node_modules/stylus/lib/cache/null.js | 50 - .../node_modules/stylus/lib/colors.js | 158 -- .../node_modules/stylus/lib/convert/css.js | 328 --- .../node_modules/stylus/lib/errors.js | 55 - .../node_modules/stylus/lib/functions/acos.js | 19 - .../stylus/lib/functions/add-property.js | 29 - .../stylus/lib/functions/adjust.js | 30 - .../stylus/lib/functions/alpha.js | 38 - .../node_modules/stylus/lib/functions/asin.js | 20 - .../node_modules/stylus/lib/functions/atan.js | 20 - .../stylus/lib/functions/base-convert.js | 26 - .../stylus/lib/functions/basename.js | 17 - .../stylus/lib/functions/blend.js | 39 - .../node_modules/stylus/lib/functions/blue.js | 35 - .../stylus/lib/functions/clone.js | 14 - .../stylus/lib/functions/component.js | 62 - .../stylus/lib/functions/contrast.js | 77 - .../stylus/lib/functions/convert-angle.js | 19 - .../stylus/lib/functions/convert.js | 17 - .../stylus/lib/functions/current-media.js | 22 - .../stylus/lib/functions/define.js | 25 - .../stylus/lib/functions/dirname.js | 17 - .../stylus/lib/functions/error.js | 17 - .../stylus/lib/functions/extname.js | 17 - .../stylus/lib/functions/green.js | 35 - .../node_modules/stylus/lib/functions/hsl.js | 37 - .../node_modules/stylus/lib/functions/hsla.js | 55 - .../node_modules/stylus/lib/functions/hue.js | 36 - .../stylus/lib/functions/image-size.js | 60 - .../stylus/lib/functions/image.js | 162 -- .../stylus/lib/functions/index.js | 72 - .../stylus/lib/functions/index.styl | 297 --- .../node_modules/stylus/lib/functions/json.js | 118 - .../stylus/lib/functions/length.js | 27 - .../stylus/lib/functions/lightness.js | 36 - .../stylus/lib/functions/list-separator.js | 25 - .../stylus/lib/functions/lookup.js | 19 - .../stylus/lib/functions/luminosity.js | 40 - .../stylus/lib/functions/match.js | 45 - .../stylus/lib/functions/math-prop.js | 15 - .../node_modules/stylus/lib/functions/math.js | 19 - .../stylus/lib/functions/merge.js | 24 - .../stylus/lib/functions/operate.js | 20 - .../stylus/lib/functions/opposite-position.js | 32 - .../node_modules/stylus/lib/functions/p.js | 18 - .../stylus/lib/functions/pathjoin.js | 16 - .../node_modules/stylus/lib/functions/pop.js | 14 - .../stylus/lib/functions/prefix-classes.js | 24 - .../node_modules/stylus/lib/functions/push.js | 18 - .../stylus/lib/functions/range.js | 34 - .../node_modules/stylus/lib/functions/red.js | 35 - .../stylus/lib/functions/remove.js | 19 - .../stylus/lib/functions/replace.js | 25 - .../stylus/lib/functions/resolver.js | 85 - .../node_modules/stylus/lib/functions/rgb.js | 42 - .../node_modules/stylus/lib/functions/rgba.js | 61 - .../node_modules/stylus/lib/functions/s.js | 37 - .../stylus/lib/functions/saturation.js | 36 - .../stylus/lib/functions/selector-exists.js | 25 - .../stylus/lib/functions/selector.js | 71 - .../stylus/lib/functions/selectors.js | 43 - .../stylus/lib/functions/shift.js | 15 - .../stylus/lib/functions/slice.js | 28 - .../stylus/lib/functions/split.js | 27 - .../stylus/lib/functions/substr.js | 24 - .../node_modules/stylus/lib/functions/tan.js | 30 - .../stylus/lib/functions/trace.js | 12 - .../stylus/lib/functions/transparentify.js | 65 - .../node_modules/stylus/lib/functions/type.js | 32 - .../node_modules/stylus/lib/functions/unit.js | 25 - .../stylus/lib/functions/unquote.js | 25 - .../stylus/lib/functions/unshift.js | 18 - .../node_modules/stylus/lib/functions/url.js | 142 - .../node_modules/stylus/lib/functions/use.js | 76 - .../node_modules/stylus/lib/functions/warn.js | 17 - .../node_modules/stylus/lib/lexer.js | 897 ------- .../node_modules/stylus/lib/middleware.js | 256 -- .../stylus/lib/nodes/arguments.js | 90 - .../node_modules/stylus/lib/nodes/atblock.js | 79 - .../node_modules/stylus/lib/nodes/atrule.js | 136 - .../node_modules/stylus/lib/nodes/binop.js | 83 - .../node_modules/stylus/lib/nodes/block.js | 127 - .../node_modules/stylus/lib/nodes/boolean.js | 117 - .../node_modules/stylus/lib/nodes/call.js | 85 - .../node_modules/stylus/lib/nodes/charset.js | 58 - .../node_modules/stylus/lib/nodes/comment.js | 64 - .../node_modules/stylus/lib/nodes/each.js | 75 - .../stylus/lib/nodes/expression.js | 220 -- .../node_modules/stylus/lib/nodes/extend.js | 69 - .../node_modules/stylus/lib/nodes/feature.js | 84 - .../node_modules/stylus/lib/nodes/function.js | 128 - .../node_modules/stylus/lib/nodes/group.js | 110 - .../node_modules/stylus/lib/nodes/hsla.js | 277 -- .../node_modules/stylus/lib/nodes/ident.js | 156 -- .../node_modules/stylus/lib/nodes/if.js | 78 - .../node_modules/stylus/lib/nodes/import.js | 68 - .../node_modules/stylus/lib/nodes/index.js | 63 - .../stylus/lib/nodes/keyframes.js | 81 - .../node_modules/stylus/lib/nodes/literal.js | 112 - .../node_modules/stylus/lib/nodes/media.js | 76 - .../node_modules/stylus/lib/nodes/member.js | 82 - .../stylus/lib/nodes/namespace.js | 60 - .../node_modules/stylus/lib/nodes/node.js | 252 -- .../node_modules/stylus/lib/nodes/null.js | 88 - .../node_modules/stylus/lib/nodes/object.js | 244 -- .../node_modules/stylus/lib/nodes/params.js | 90 - .../node_modules/stylus/lib/nodes/property.js | 96 - .../stylus/lib/nodes/query-list.js | 108 - .../node_modules/stylus/lib/nodes/query.js | 170 -- .../node_modules/stylus/lib/nodes/return.js | 63 - .../node_modules/stylus/lib/nodes/rgba.js | 367 --- .../node_modules/stylus/lib/nodes/root.js | 96 - .../node_modules/stylus/lib/nodes/selector.js | 94 - .../node_modules/stylus/lib/nodes/string.js | 147 -- .../node_modules/stylus/lib/nodes/supports.js | 75 - .../node_modules/stylus/lib/nodes/ternary.js | 71 - .../node_modules/stylus/lib/nodes/unaryop.js | 66 - .../node_modules/stylus/lib/nodes/unit.js | 214 -- .../node_modules/stylus/lib/parser.js | 2297 ----------------- .../node_modules/stylus/lib/renderer.js | 246 -- .../stylus/lib/selector-parser.js | 258 -- .../node_modules/stylus/lib/stack/frame.js | 65 - .../node_modules/stylus/lib/stack/index.js | 135 - .../node_modules/stylus/lib/stack/scope.js | 62 - .../node_modules/stylus/lib/stylus.js | 103 - .../node_modules/stylus/lib/token.js | 53 - .../node_modules/stylus/lib/units.js | 20 - .../node_modules/stylus/lib/utils.js | 524 ---- .../stylus/lib/visitor/compiler.js | 588 ----- .../stylus/lib/visitor/deps-resolver.js | 172 -- .../stylus/lib/visitor/evaluator.js | 1613 ------------ .../node_modules/stylus/lib/visitor/index.js | 31 - .../stylus/lib/visitor/normalizer.js | 443 ---- .../stylus/lib/visitor/sourcemapper.js | 204 -- .../node_modules/stylus/package.json | 52 - .../hexo-theme-butterfly/package.json | 32 - node_modules/hexo-theme-butterfly/plugins.yml | 214 -- .../scripts/events/404.js | 18 - .../scripts/events/cdn.js | 97 - .../scripts/events/comment.js | 14 - .../scripts/events/init.js | 20 - .../scripts/events/stylus.js | 15 - .../scripts/events/welcome.js | 13 - .../scripts/filters/post_lazyload.js | 29 - .../scripts/filters/random_cover.js | 45 - .../scripts/helpers/aside_archives.js | 113 - .../scripts/helpers/aside_categories.js | 97 - .../scripts/helpers/findArchiveLength.js | 58 - .../scripts/helpers/inject_head_js.js | 166 -- .../scripts/helpers/page.js | 102 - .../scripts/helpers/related_post.js | 100 - .../scripts/tag/button.js | 28 - .../hexo-theme-butterfly/scripts/tag/flink.js | 39 - .../scripts/tag/gallery.js | 69 - .../hexo-theme-butterfly/scripts/tag/hide.js | 70 - .../scripts/tag/inlineImg.js | 17 - .../hexo-theme-butterfly/scripts/tag/label.js | 16 - .../scripts/tag/mermaid.js | 17 - .../hexo-theme-butterfly/scripts/tag/note.js | 27 - .../hexo-theme-butterfly/scripts/tag/score.js | 22 - .../hexo-theme-butterfly/scripts/tag/tabs.js | 62 - .../scripts/tag/timeline.js | 41 - .../source/css/_global/function.styl | 277 -- .../source/css/_global/index.styl | 196 -- .../source/css/_highlight/highlight.styl | 217 -- .../source/css/_highlight/highlight/diff.styl | 79 - .../css/_highlight/highlight/index.styl | 39 - .../source/css/_highlight/prismjs/diff.styl | 302 --- .../source/css/_highlight/prismjs/index.styl | 22 - .../css/_highlight/prismjs/line-number.styl | 41 - .../source/css/_highlight/theme.styl | 119 - .../source/css/_layout/aside.styl | 410 --- .../source/css/_layout/chat.styl | 17 - .../source/css/_layout/comments.styl | 64 - .../source/css/_layout/footer.styl | 35 - .../source/css/_layout/head.styl | 407 --- .../source/css/_layout/loading.styl | 95 - .../source/css/_layout/pagination.styl | 83 - .../source/css/_layout/post.styl | 261 -- .../source/css/_layout/relatedposts.styl | 43 - .../source/css/_layout/reward.styl | 74 - .../source/css/_layout/rightside.styl | 68 - .../source/css/_layout/sidebar.styl | 68 - .../source/css/_layout/third-party.styl | 135 - .../source/css/_mode/darkmode.styl | 150 -- .../source/css/_mode/readmode.styl | 196 -- .../source/css/_page/404.styl | 69 - .../source/css/_page/archives.styl | 109 - .../source/css/_page/categories.styl | 37 - .../source/css/_page/common.styl | 60 - .../source/css/_page/flink.styl | 87 - .../source/css/_page/homepage.styl | 113 - .../source/css/_page/tags.styl | 23 - .../source/css/_search/algolia.styl | 87 - .../source/css/_search/index.styl | 60 - .../source/css/_search/local-search.styl | 74 - .../source/css/_tags/button.styl | 55 - .../source/css/_tags/gallery.styl | 139 - .../source/css/_tags/hexo.styl | 30 - .../source/css/_tags/hide.styl | 46 - .../source/css/_tags/inlineImg.styl | 6 - .../source/css/_tags/label.styl | 11 - .../source/css/_tags/note.styl | 121 - .../source/css/_tags/tabs.styl | 74 - .../source/css/_tags/timeline.styl | 68 - .../source/css/_third-party/normalize.min.css | 180 -- .../source/css/index.styl | 15 - .../hexo-theme-butterfly/source/css/var.styl | 185 -- .../hexo-theme-butterfly/source/img/404.jpg | Bin 16393 -> 0 bytes .../source/img/favicon.png | Bin 323 -> 0 bytes .../source/img/friend_404.gif | Bin 65097 -> 0 bytes .../hexo-theme-butterfly/source/js/main.js | 827 ------ .../source/js/search/algolia.js | 177 -- .../source/js/search/local-search.js | 360 --- .../hexo-theme-butterfly/source/js/tw_cn.js | 115 - .../hexo-theme-butterfly/source/js/utils.js | 307 --- .../hexo-theme-fluid/source/img/.DS_Store | Bin 6148 -> 0 bytes .../hexo-theme-fluid/source/img/logo.png | Bin 0 -> 5835 bytes 386 files changed, 5 insertions(+), 39438 deletions(-) delete mode 100644 node_modules/hexo-theme-butterfly/.github/ISSUE_TEMPLATE/bug_report.yml delete mode 100644 node_modules/hexo-theme-butterfly/.github/ISSUE_TEMPLATE/config.yml delete mode 100644 node_modules/hexo-theme-butterfly/.github/ISSUE_TEMPLATE/feature_request.yml delete mode 100644 node_modules/hexo-theme-butterfly/.github/workflows/publish.yml delete mode 100644 node_modules/hexo-theme-butterfly/.github/workflows/stale.yml delete mode 100644 node_modules/hexo-theme-butterfly/LICENSE delete mode 100644 node_modules/hexo-theme-butterfly/README.md delete mode 100644 node_modules/hexo-theme-butterfly/README_CN.md delete mode 100644 node_modules/hexo-theme-butterfly/_config.yml delete mode 100644 node_modules/hexo-theme-butterfly/languages/default.yml delete mode 100644 node_modules/hexo-theme-butterfly/languages/en.yml delete mode 100644 node_modules/hexo-theme-butterfly/languages/zh-CN.yml delete mode 100644 node_modules/hexo-theme-butterfly/languages/zh-TW.yml delete mode 100644 node_modules/hexo-theme-butterfly/layout/archive.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/category.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/404.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/additional-js.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/footer.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/head.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/head/Open_Graph.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/head/analytics.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/head/config.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/head/config_site.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/head/google_adsense.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/head/noscript.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/head/preconnect.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/head/pwa.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/head/site_verification.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/header/index.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/header/menu_item.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/header/nav.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/header/post-info.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/header/social.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/layout.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/loading/fullpage-loading.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/loading/index.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/loading/pace.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/mixins/article-sort.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/mixins/post-ui.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/page/categories.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/page/default-page.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/page/flink.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/page/tags.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/pagination.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/post/post-copyright.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/post/reward.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/rightside.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/sidebar.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/abcjs/abcjs.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/abcjs/index.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/aplayer.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/artalk.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/disqus.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/fb.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/index.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/remark42.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/twikoo.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/valine.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/waline.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/chat/chatra.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/chat/crisp.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/chat/daovoice.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/chat/index.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/chat/messenger.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/chat/tidio.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/artalk.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/disqus.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/disqusjs.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/facebook_comments.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/giscus.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/gitalk.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/index.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/js.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/livere.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/remark42.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/twikoo.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/utterances.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/valine.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/waline.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/effect.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/math/index.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/math/katex.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/math/mathjax.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/math/mermaid.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/artalk.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/disqus-comment.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/github-issues.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/index.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/remark42.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/twikoo-comment.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/valine.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/waline.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/pangu.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/pjax.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/prismjs.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/search/algolia.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/search/docsearch.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/search/index.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/search/local-search.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/share/add-this.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/share/addtoany.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/share/index.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/share/share-js.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/third-party/subtitle.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/widget/card_ad.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/widget/card_announcement.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/widget/card_archives.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/widget/card_author.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/widget/card_bottom_self.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/widget/card_categories.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/widget/card_newest_comment.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/widget/card_post_toc.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/widget/card_recent_post.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/widget/card_tags.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/widget/card_top_self.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/widget/card_webinfo.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/includes/widget/index.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/index.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/page.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/post.pug delete mode 100644 node_modules/hexo-theme-butterfly/layout/tag.pug delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/.bin/stylus delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/.bin/stylus.cmd delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/.bin/stylus.ps1 delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/debug/LICENSE delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/debug/README.md delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/debug/package.json delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/debug/src/browser.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/debug/src/common.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/debug/src/index.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/debug/src/node.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/hexo-renderer-stylus/LICENSE delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/hexo-renderer-stylus/README.md delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/hexo-renderer-stylus/index.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/hexo-renderer-stylus/lib/renderer.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/hexo-renderer-stylus/package.json delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/ms/index.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/ms/license.md delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/ms/package.json delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/ms/readme.md delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/source-map/LICENSE delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/source-map/README.md delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/source-map/dist/source-map.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/source-map/lib/array-set.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/source-map/lib/base64-vlq.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/source-map/lib/base64.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/source-map/lib/binary-search.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/source-map/lib/mapping-list.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/source-map/lib/mappings.wasm delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/source-map/lib/read-wasm.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/source-map/lib/source-map-consumer.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/source-map/lib/source-map-generator.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/source-map/lib/source-node.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/source-map/lib/util.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/source-map/lib/wasm.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/source-map/package.json delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/source-map/source-map.d.ts delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/source-map/source-map.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/Changelog.md delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/LICENSE delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/Readme.md delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/bin/stylus delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/index.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/browserify.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/cache/fs.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/cache/index.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/cache/memory.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/cache/null.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/colors.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/convert/css.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/errors.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/acos.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/add-property.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/adjust.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/alpha.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/asin.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/atan.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/base-convert.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/basename.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/blend.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/blue.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/clone.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/component.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/contrast.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/convert-angle.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/convert.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/current-media.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/define.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/dirname.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/error.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/extname.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/green.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/hsl.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/hsla.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/hue.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/image-size.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/image.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/index.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/index.styl delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/json.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/length.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/lightness.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/list-separator.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/lookup.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/luminosity.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/match.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/math-prop.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/math.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/merge.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/operate.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/opposite-position.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/p.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/pathjoin.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/pop.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/prefix-classes.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/push.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/range.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/red.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/remove.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/replace.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/resolver.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/rgb.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/rgba.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/s.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/saturation.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/selector-exists.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/selector.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/selectors.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/shift.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/slice.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/split.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/substr.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/tan.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/trace.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/transparentify.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/type.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/unit.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/unquote.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/unshift.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/url.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/use.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/warn.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/lexer.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/middleware.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/arguments.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/atblock.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/atrule.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/binop.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/block.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/boolean.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/call.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/charset.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/comment.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/each.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/expression.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/extend.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/feature.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/function.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/group.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/hsla.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/ident.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/if.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/import.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/index.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/keyframes.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/literal.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/media.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/member.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/namespace.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/node.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/null.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/object.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/params.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/property.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/query-list.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/query.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/return.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/rgba.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/root.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/selector.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/string.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/supports.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/ternary.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/unaryop.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/unit.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/parser.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/renderer.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/selector-parser.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/stack/frame.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/stack/index.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/stack/scope.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/stylus.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/token.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/units.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/utils.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/visitor/compiler.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/visitor/deps-resolver.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/visitor/evaluator.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/visitor/index.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/visitor/normalizer.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/lib/visitor/sourcemapper.js delete mode 100644 node_modules/hexo-theme-butterfly/node_modules/stylus/package.json delete mode 100644 node_modules/hexo-theme-butterfly/package.json delete mode 100644 node_modules/hexo-theme-butterfly/plugins.yml delete mode 100644 node_modules/hexo-theme-butterfly/scripts/events/404.js delete mode 100644 node_modules/hexo-theme-butterfly/scripts/events/cdn.js delete mode 100644 node_modules/hexo-theme-butterfly/scripts/events/comment.js delete mode 100644 node_modules/hexo-theme-butterfly/scripts/events/init.js delete mode 100644 node_modules/hexo-theme-butterfly/scripts/events/stylus.js delete mode 100644 node_modules/hexo-theme-butterfly/scripts/events/welcome.js delete mode 100644 node_modules/hexo-theme-butterfly/scripts/filters/post_lazyload.js delete mode 100644 node_modules/hexo-theme-butterfly/scripts/filters/random_cover.js delete mode 100644 node_modules/hexo-theme-butterfly/scripts/helpers/aside_archives.js delete mode 100644 node_modules/hexo-theme-butterfly/scripts/helpers/aside_categories.js delete mode 100644 node_modules/hexo-theme-butterfly/scripts/helpers/findArchiveLength.js delete mode 100644 node_modules/hexo-theme-butterfly/scripts/helpers/inject_head_js.js delete mode 100644 node_modules/hexo-theme-butterfly/scripts/helpers/page.js delete mode 100644 node_modules/hexo-theme-butterfly/scripts/helpers/related_post.js delete mode 100644 node_modules/hexo-theme-butterfly/scripts/tag/button.js delete mode 100644 node_modules/hexo-theme-butterfly/scripts/tag/flink.js delete mode 100644 node_modules/hexo-theme-butterfly/scripts/tag/gallery.js delete mode 100644 node_modules/hexo-theme-butterfly/scripts/tag/hide.js delete mode 100644 node_modules/hexo-theme-butterfly/scripts/tag/inlineImg.js delete mode 100644 node_modules/hexo-theme-butterfly/scripts/tag/label.js delete mode 100644 node_modules/hexo-theme-butterfly/scripts/tag/mermaid.js delete mode 100644 node_modules/hexo-theme-butterfly/scripts/tag/note.js delete mode 100644 node_modules/hexo-theme-butterfly/scripts/tag/score.js delete mode 100644 node_modules/hexo-theme-butterfly/scripts/tag/tabs.js delete mode 100644 node_modules/hexo-theme-butterfly/scripts/tag/timeline.js delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_global/function.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_global/index.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_highlight/highlight.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_highlight/highlight/diff.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_highlight/highlight/index.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_highlight/prismjs/diff.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_highlight/prismjs/index.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_highlight/prismjs/line-number.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_highlight/theme.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_layout/aside.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_layout/chat.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_layout/comments.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_layout/footer.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_layout/head.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_layout/loading.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_layout/pagination.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_layout/post.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_layout/relatedposts.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_layout/reward.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_layout/rightside.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_layout/sidebar.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_layout/third-party.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_mode/darkmode.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_mode/readmode.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_page/404.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_page/archives.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_page/categories.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_page/common.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_page/flink.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_page/homepage.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_page/tags.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_search/algolia.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_search/index.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_search/local-search.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_tags/button.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_tags/gallery.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_tags/hexo.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_tags/hide.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_tags/inlineImg.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_tags/label.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_tags/note.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_tags/tabs.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_tags/timeline.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/_third-party/normalize.min.css delete mode 100644 node_modules/hexo-theme-butterfly/source/css/index.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/css/var.styl delete mode 100644 node_modules/hexo-theme-butterfly/source/img/404.jpg delete mode 100644 node_modules/hexo-theme-butterfly/source/img/favicon.png delete mode 100644 node_modules/hexo-theme-butterfly/source/img/friend_404.gif delete mode 100644 node_modules/hexo-theme-butterfly/source/js/main.js delete mode 100644 node_modules/hexo-theme-butterfly/source/js/search/algolia.js delete mode 100644 node_modules/hexo-theme-butterfly/source/js/search/local-search.js delete mode 100644 node_modules/hexo-theme-butterfly/source/js/tw_cn.js delete mode 100644 node_modules/hexo-theme-butterfly/source/js/utils.js delete mode 100644 node_modules/hexo-theme-fluid/source/img/.DS_Store create mode 100644 node_modules/hexo-theme-fluid/source/img/logo.png diff --git a/_config.fluid.yml b/_config.fluid.yml index 3f6482d1..9f6164d9 100644 --- a/_config.fluid.yml +++ b/_config.fluid.yml @@ -18,11 +18,11 @@ # 用于浏览器标签的图标 # Icon for browser tab -favicon: /img/fluid.png +favicon: /img/logo.png # 用于苹果设备的图标 # Icon for Apple touch -apple_touch_icon: /img/fluid.png +apple_touch_icon: /img/logo.png # 浏览器标签页中的标题分隔符,效果: 文章名 - 站点名 # Title separator in browser tab, eg: article - site @@ -427,6 +427,7 @@ footer: Fluid
PowerBy 浪子 ©2023 + ' # 展示网站的 PV、UV 统计数 @@ -664,7 +665,7 @@ post: # 显示更新日期 # Show update date update_date: - enable: false + enable: true format: "LL" # 文章底部上一篇下一篇功能 @@ -698,7 +699,7 @@ post: math: # 开启后文章默认可用,自定义页面如需使用,需在 Front-matter 中指定 `math: true` # If you want to use math on the custom page, you need to set `math: true` in Front-matter - enable: false + enable: true # 开启后,只有在文章 Front-matter 里指定 `math: true` 才会在文章页启动公式转换,以便在页面不包含公式时提高加载速度 # If true, only set `math: true` in Front-matter will enable math, to load faster when the page does not contain math diff --git a/node_modules/hexo-theme-butterfly/.github/ISSUE_TEMPLATE/bug_report.yml b/node_modules/hexo-theme-butterfly/.github/ISSUE_TEMPLATE/bug_report.yml deleted file mode 100644 index 5c59f64b..00000000 --- a/node_modules/hexo-theme-butterfly/.github/ISSUE_TEMPLATE/bug_report.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: Bug report -description: Create a report to help us improve -title: '[Bug]: ' - -body: - - type: markdown - attributes: - value: | - 重要:請依照該模板來提交 - Please follow the template to create a new issue - - type: input - id: butterfly-ver - attributes: - label: 使用的 Butterfly 版本? | What version of Butterfly are you use? - description: 檢視主題的 package.json | Check the theme's package.json - validations: - required: true - - - type: dropdown - id: modify - attributes: - label: 是否修改过主题文件? || Has the theme files been modified? - options: - - 是 (Yes) - - 不是 (No) - validations: - required: true - - - type: dropdown - id: browser - attributes: - label: 使用的瀏覽器? || What browse are you using? - options: - - Chrome - - Edge - - Safari - - Opera - - Other - validations: - required: true - - - type: dropdown - id: platform - attributes: - label: 使用的系統? || What operating system are you using? - options: - - Windows - - macOS - - Linux - - Android - - iOS - - Other - validations: - required: true - - - type: textarea - id: description - attributes: - label: 問題描述 | Describe the bug - description: 請描述你的問題現象 | A clear and concise description of what the bug is. - placeholder: 請儘量提供截圖來定位問題 | If applicable, add screenshots to help explain your problem - value: - validations: - required: true - - - type: input - id: website - attributes: - label: 出現問題網站 | Website - description: 請提供下可復現網站地址 | Please supply a website url which can reproduce problem. - placeholder: - validations: - required: true diff --git a/node_modules/hexo-theme-butterfly/.github/ISSUE_TEMPLATE/config.yml b/node_modules/hexo-theme-butterfly/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index 09ef9892..00000000 --- a/node_modules/hexo-theme-butterfly/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,22 +0,0 @@ -blank_issues_enabled: false -contact_links: - - name: Questions about Butterfly - url: https://github.com/jerryc127/hexo-theme-butterfly/discussions - about: 一些使用問題請到 Discussion 詢問。 Please ask questions in Discussion. - - - name: Butterfly Q&A - url: https://butterfly.js.org/posts/98d20436/ - about: Butterfly Q&A - - - name: Telegram - url: https://t.me/bu2fly - about: 'Official Telegram Group' - - - name: QQ 1群 - url: https://jq.qq.com/?_wv=1027&k=KU9105XR - about: '群號 1070540070,不要兩個Q群都添加' - - - name: QQ 2群 - url: https://jq.qq.com/?_wv=1027&k=r1nK0DQz - about: '群號 978221020,不要兩個Q群都添加' - diff --git a/node_modules/hexo-theme-butterfly/.github/ISSUE_TEMPLATE/feature_request.yml b/node_modules/hexo-theme-butterfly/.github/ISSUE_TEMPLATE/feature_request.yml deleted file mode 100644 index d8ea8f98..00000000 --- a/node_modules/hexo-theme-butterfly/.github/ISSUE_TEMPLATE/feature_request.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Feature request -description: Suggest an idea for this project -title: '[Feature]: ' - -body: - - type: textarea - id: feature-request - attributes: - label: 想要的功能 | What feature do you want? - description: 請描述你需要的新功能 | A clear and concise description of what the feature is. - placeholder: - value: - validations: - require: true \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/.github/workflows/publish.yml b/node_modules/hexo-theme-butterfly/.github/workflows/publish.yml deleted file mode 100644 index eee034d8..00000000 --- a/node_modules/hexo-theme-butterfly/.github/workflows/publish.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: npm publish - -on: - release: - types: [created] -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - # Setup .npmrc file to publish to npm - - uses: actions/setup-node@v1 - with: - node-version: '12.x' - registry-url: 'https://registry.npmjs.org' - - run: npm install - - run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/.github/workflows/stale.yml b/node_modules/hexo-theme-butterfly/.github/workflows/stale.yml deleted file mode 100644 index b7c7ff51..00000000 --- a/node_modules/hexo-theme-butterfly/.github/workflows/stale.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: 'Close stale issues and PRs' -on: - schedule: - - cron: '30 1 * * *' - -jobs: - stale: - runs-on: ubuntu-latest - steps: - - uses: actions/stale@v5 - with: - days-before-issue-stale: 30 - days-before-pr-stale: -1 - days-before-close: 7 - stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.' - close-pr-message: 'This issue has not seen any activity since it was marked stale. Closing.' - stale-issue-label: 'Stale' - exempt-issue-labels: 'pinned,bug,enhancement,documentation,Plan' - operations-per-run: 1000 \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/LICENSE b/node_modules/hexo-theme-butterfly/LICENSE deleted file mode 100644 index 9b5e4019..00000000 --- a/node_modules/hexo-theme-butterfly/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/README.md b/node_modules/hexo-theme-butterfly/README.md deleted file mode 100644 index f2eda77e..00000000 --- a/node_modules/hexo-theme-butterfly/README.md +++ /dev/null @@ -1,111 +0,0 @@ -
-中文 -
- -# hexo-theme-butterfly - -![master version](https://img.shields.io/github/package-json/v/jerryc127/hexo-theme-butterfly/master?color=%231ab1ad&label=master) -![master version](https://img.shields.io/github/package-json/v/jerryc127/hexo-theme-butterfly/dev?label=dev) -![https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff](https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff) -![hexo version](https://img.shields.io/badge/hexo-5.3.0+-0e83c) -![license](https://img.shields.io/github/license/jerryc127/hexo-theme-butterfly?color=FF5531) - -![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/theme-butterfly-readme.png) - -Demo: 👍 [Butterfly](https://butterfly.js.org/) || 🤞 [CrazyWong](https://blog.crazywong.com/) - -Docs: 📖 [Butterfly Docs](https://butterfly.js.org/posts/21cfbf15/) - -Based on [hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody) theme. - -## 💻 Installation - -### GIT - -> If you are in Mainland China, you can download in [Gitee](https://gitee.com/immyw/hexo-theme-butterfly.git) - -Stable branch [recommend]: - -``` -git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly -``` - -Dev branch: - -``` -git clone -b dev https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly -``` - -### NPM - -> It supports Hexo 5.0.0 or later - -In Hexo site root directory - -```powershell -npm i hexo-theme-butterfly -``` - -## ⚙ Configuration - - Set theme in the hexo work folder's root config file `_config.yml`: - -> theme: butterfly - - If you don't have pug & stylus renderer, try this: - -> npm install hexo-renderer-pug hexo-renderer-stylus - -## 🎉 Features - -- [x] Card UI Design -- [X] Support sub-menu -- [x] Two-column layout -- [x] Responsive Web Design -- [x] Dark Mode -- [x] Pjax -- [x] Read Mode -- [x] Conversion between Traditional and Simplified Chinese -- [X] TOC catalog is available for both computers and mobile phones -- [X] Built-in Syntax Highlighting Themes (darker/pale night/light/ocean/mac/mac light), also support customization -- [X] Code Blocks (Display code language/close or expand Code Blocks/Copy Button/word wrap) -- [X] Disable copy/Add a Copyright Notice to the Copied Text -- [X] Search (Algolia Search/Local Search) -- [x] Mathjax and Katex -- [x] Built-in 404 page -- [x] WordCount -- [x] Related articles -- [x] Displays outdated notice for a post -- [x] Share (AddThis/Sharejs/Addtoany) -- [X] Comment (Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus/Remark42/artalk) -- [x] Multiple Comment System Support -- [x] Online Chats (Chatra/Tidio/Daovoice/Crisp/messenger) -- [x] Web analytics -- [x] Google AdSense -- [x] Webmaster Verification -- [x] Change website colour scheme -- [x] Typewriter Effect: activate_power_mode -- [x] Background effects (Canvas ribbon/canvas_ribbon_piao/canvas_nest) -- [x] Mouse click effects (Fireworks/Heart/Text) -- [x] Preloader/Loading Animation/pace.js -- [x] Busuanzi visitor counter -- [x] Medium Zoom/Fancybox -- [x] Mermaid -- [x] Justified Gallery -- [x] Lazyload images -- [x] Instantpage/Pangu/Snackbar notification toast/PWA...... - -## ✨ Contributors - - - - - -## 📷 Screenshots - -![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-1.jpg) -![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-2.jpg) -![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-3.jpg) -![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-4.jpg) -![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-1.png) -![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-2.png) \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/README_CN.md b/node_modules/hexo-theme-butterfly/README_CN.md deleted file mode 100644 index 22d97bff..00000000 --- a/node_modules/hexo-theme-butterfly/README_CN.md +++ /dev/null @@ -1,111 +0,0 @@ -
- English -
- -# hexo-theme-butterfly - -![master version](https://img.shields.io/github/package-json/v/jerryc127/hexo-theme-butterfly/master?color=%231ab1ad&label=master) -![master version](https://img.shields.io/github/package-json/v/jerryc127/hexo-theme-butterfly/dev?label=dev) -![https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff](https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff) -![hexo version](https://img.shields.io/badge/hexo-5.3.0+-0e83c) -![license](https://img.shields.io/github/license/jerryc127/hexo-theme-butterfly?color=FF5531) - -![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/theme-butterfly-readme.png) - -預覽: 👍 [Butterfly](https://butterfly.js.org/) || 🤞 [CrazyWong](https://blog.crazywong.com/) - -文檔: 📖 [Butterfly Docs](https://butterfly.js.org/posts/21cfbf15/) - -一款基於[hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody)修改的主題 - -## 💻 安裝 - -### Git 安裝 - -> 本倉庫同時上傳到 [Gitee](https://gitee.com/immyw/hexo-theme-butterfly.git),如果你訪問 Github 緩慢,可從 Gitee 中下載。 - -在博客根目錄裡安裝穩定版【推薦】 - -```powershell -git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly -``` - -如果想要安裝比較新的dev分支,可以 - -```powershell -git clone -b dev https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly -``` - -### npm 安裝 - -> 此方法只支持Hexo 5.0.0以上版本 - -在博客根目錄裡 - -```powershell -npm i hexo-theme-butterfly -``` - -## ⚙ 應用主題 - -修改hexo配置文件`_config.yml`,把主題改為`Butterfly` - -``` -theme: butterfly -``` - ->如果你沒有pug以及stylus的渲染器,請下載安裝: npm install hexo-renderer-pug hexo-renderer-stylus --save - -## 🎉 特色 - -- [x] 卡片化設計 -- [X] 支持二級目錄 -- [x] 雙欄設計 -- [x] 響應式主題 -- [x] 夜間模式 -- [x] Pjax -- [x] 文章閲讀模式 -- [x] 簡體和繁體轉換 -- [X] 電腦和手機都可查看TOC目錄 -- [X] 內置多種代碼配色(darker/pale night/light/ocean/mac/mac light),可自定義代碼配色 -- [X] 代碼塊顯示代碼語言/關閉或展開代碼塊/代碼複製/代碼自動換行 -- [X] 可關閉文字複製/可開啟內容複製增加版權信息) -- [X] 兩種搜索( Algolia 搜索和本地搜索) -- [x] Mathjax 和 Katex -- [x] 內置404頁面 -- [x] 顯示字數統計 -- [x] 顯示相關文章 -- [x] 過期文章提醒 -- [x] 多種分享系統(AddThis/Sharejs/Addtoany) -- [X] 多種評論系統(Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus/Remark42/artalk) -- [x] 支持雙評論部署 -- [x] 多種在線聊天(Chatra/Tidio/Daovoice/Crisp/messenger) -- [x] 多種分析系統 -- [x] 谷歌廣告/手動廣告位置 -- [x] 各種站長驗證(Google/Bing/Baidu/360/Yandex) -- [x] 修改網站配色 -- [x] 打字特效 activate_power_mode -- [x] 多種背景特效(靜止彩帶/動態彩帶/Canvas Nest) -- [x] 多種鼠標點擊特效(煙花/文字/愛心) -- [x] 內置一種 Preloader 加載動畫和 pace.js 加載動畫條 -- [x] 不蒜子訪問統計 -- [x] 兩種大圖模式(Medium Zoom/Fancybox) -- [x] Mermaid 圖表顯示 -- [x] 照片牆 -- [x] 圖片懶加載 -- [x] Instantpage/Pangu/Snackbar彈窗/PWA...... - -## ✨ 貢獻者 - - - - - -## 📷 截圖 - -![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-1.jpg) -![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-2.jpg) -![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-3.jpg) -![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-4.jpg) -![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-1.png) -![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-2.png) diff --git a/node_modules/hexo-theme-butterfly/_config.yml b/node_modules/hexo-theme-butterfly/_config.yml deleted file mode 100644 index 78bd0604..00000000 --- a/node_modules/hexo-theme-butterfly/_config.yml +++ /dev/null @@ -1,986 +0,0 @@ -# Navigation bar settings (導航欄設置) -# see https://butterfly.js.org/posts/4aa8abbe/##導航欄設置-Navigation-bar-settings -# -------------------------------------- - -nav: - logo: # image - display_title: true - fixed: false # fixed navigation bar - -# Menu 目錄 -menu: - # Home: / || fas fa-home - # Archives: /archives/ || fas fa-archive - # Tags: /tags/ || fas fa-tags - # Categories: /categories/ || fas fa-folder-open - # List||fas fa-list: - # Music: /music/ || fas fa-music - # Movie: /movies/ || fas fa-video - # Link: /link/ || fas fa-link - # About: /about/ || fas fa-heart - -# Code Blocks (代碼相關) -# -------------------------------------- - -highlight_theme: light # darker / pale night / light / ocean / mac / mac light / false -highlight_copy: true # copy button -highlight_lang: true # show the code language -highlight_shrink: false # true: shrink the code blocks / false: expand the code blocks | none: expand code blocks and hide the button -highlight_height_limit: false # unit: px -code_word_wrap: false - -# Social Settings (社交圖標設置) -# formal: -# icon: link || the description || color -social: - # fab fa-github: https://github.com/xxxxx || Github || '#24292e' - # fas fa-envelope: mailto:xxxxxx@gmail.com || Email || '#4a7dbe' - -# Image (圖片設置) -# -------------------------------------- - -# Favicon(網站圖標) -favicon: /img/favicon.png - -# Avatar (頭像) -avatar: - img: https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png - effect: false - -# Disable all banner image -disable_top_img: false - -# The banner image of home page -index_img: - -# If the banner of page not setting, it will show the top_img -default_top_img: - -# The banner image of archive page -archive_img: - -# If the banner of tag page not setting, it will show the top_img -# note: tag page, not tags page (子標籤頁面的 top_img) -tag_img: - -# The banner image of tag page -# format: -# - tag name: xxxxx -tag_per_img: - -# If the banner of category page not setting, it will show the top_img -# note: category page, not categories page (子分類頁面的 top_img) -category_img: - -# The banner image of category page -# format: -# - category name: xxxxx -category_per_img: - -cover: - # display the cover or not (是否顯示文章封面) - index_enable: true - aside_enable: true - archives_enable: true - # the position of cover in home page (封面顯示的位置) - # left/right/both - position: both - # When cover is not set, the default cover is displayed (當沒有設置cover時,默認的封面顯示) - default_cover: - # - https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg - -# Replace Broken Images (替換無法顯示的圖片) -error_img: - flink: /img/friend_404.gif - post_page: /img/404.jpg - -# A simple 404 page -error_404: - enable: false - subtitle: 'Page Not Found' - background: https://i.loli.net/2020/05/19/aKOcLiyPl2JQdFD.png - -post_meta: - page: # Home Page - date_type: created # created or updated or both 主頁文章日期是創建日或者更新日或都顯示 - date_format: date # date/relative 顯示日期還是相對日期 - categories: true # true or false 主頁是否顯示分類 - tags: false # true or false 主頁是否顯示標籤 - label: true # true or false 顯示描述性文字 - post: - date_type: both # created or updated or both 文章頁日期是創建日或者更新日或都顯示 - date_format: date # date/relative 顯示日期還是相對日期 - categories: true # true or false 文章頁是否顯示分類 - tags: true # true or false 文章頁是否顯示標籤 - label: true # true or false 顯示描述性文字 - -# Display the article introduction on homepage -# 1: description -# 2: both (if the description exists, it will show description, or show the auto_excerpt) -# 3: auto_excerpt (default) -# false: do not show the article introduction -index_post_content: - method: 3 - length: 500 # if you set method to 2 or 3, the length need to config - -# anchor -anchor: - button: - enable: false - always_show: false - icon: # the unicode value of Font Awesome icon, such as '\3423' - auto_update: false # when you scroll in post, the URL will update according to header id. - -# figcaption (圖片描述文字) -photofigcaption: false - -# copy settings -# copyright: Add the copyright information after copied content (複製的內容後面加上版權信息) -copy: - enable: true - copyright: - enable: false - limit_count: 50 - -# Post -# -------------------------------------- - -# toc (目錄) -toc: - post: true - page: false - number: true - expand: false - style_simple: false # for post - scroll_percent: true - -post_copyright: - enable: true - decode: false - author_href: - license: CC BY-NC-SA 4.0 - license_url: https://creativecommons.org/licenses/by-nc-sa/4.0/ - -# Sponsor/reward -reward: - enable: false - QR_code: - # - img: /img/wechat.jpg - # link: - # text: wechat - # - img: /img/alipay.jpg - # link: - # text: alipay - -# Post edit -# Easily browse and edit blog source code online. -post_edit: - enable: false - # url: https://github.com/user-name/repo-name/edit/branch-name/subdirectory-name/ - # For example: https://github.com/jerryc127/butterfly.js.org/edit/main/source/ - url: - -# Related Articles -related_post: - enable: true - limit: 6 # Number of posts displayed - date_type: created # or created or updated 文章日期顯示創建日或者更新日 - -# post_pagination (分頁) -# value: 1 || 2 || false -# 1: The 'next post' will link to old post -# 2: The 'next post' will link to new post -# false: disable pagination -post_pagination: 1 - -# Displays outdated notice for a post (文章過期提醒) -noticeOutdate: - enable: false - style: flat # style: simple/flat - limit_day: 500 # When will it be shown - position: top # position: top/bottom - message_prev: It has been - message_next: days since the last update, the content of the article may be outdated. - -# Footer Settings -# -------------------------------------- -footer: - owner: - enable: true - since: 2020 - custom_text: - copyright: true # Copyright of theme and framework - -# aside (側邊欄) -# -------------------------------------- - -aside: - enable: true - hide: false - button: true - mobile: true # display on mobile - position: right # left or right - display: - archive: true - tag: true - category: true - card_author: - enable: true - description: - button: - enable: true - icon: fab fa-github - text: Follow Me - link: https://github.com/xxxxxx - card_announcement: - enable: true - content: This is my Blog - card_recent_post: - enable: true - limit: 5 # if set 0 will show all - sort: date # date or updated - sort_order: # Don't modify the setting unless you know how it works - card_categories: - enable: true - limit: 8 # if set 0 will show all - expand: none # none/true/false - sort_order: # Don't modify the setting unless you know how it works - card_tags: - enable: true - limit: 40 # if set 0 will show all - color: false - orderby: random # Order of tags, random/name/length - order: 1 # Sort of order. 1, asc for ascending; -1, desc for descending - sort_order: # Don't modify the setting unless you know how it works - card_archives: - enable: true - type: monthly # yearly or monthly - format: MMMM YYYY # eg: YYYY年MM月 - order: -1 # Sort of order. 1, asc for ascending; -1, desc for descending - limit: 8 # if set 0 will show all - sort_order: # Don't modify the setting unless you know how it works - card_webinfo: - enable: true - post_count: true - last_push_date: true - sort_order: # Don't modify the setting unless you know how it works - -# busuanzi count for PV / UV in site -# 訪問人數 -busuanzi: - site_uv: true - site_pv: true - page_pv: true - -# Time difference between publish date and now (網頁運行時間) -# Formal: Month/Day/Year Time or Year/Month/Day Time -runtimeshow: - enable: false - publish_date: - -# Aside widget - Newest Comments -newest_comments: - enable: false - sort_order: # Don't modify the setting unless you know how it works - limit: 6 - storage: 10 # unit: mins, save data to localStorage - avatar: true - -# Bottom right button (右下角按鈕) -# -------------------------------------- - -# Conversion between Traditional and Simplified Chinese (簡繁轉換) -translate: - enable: false - # The text of a button - default: 繁 - # the language of website (1 - Traditional Chinese/ 2 - Simplified Chinese) - defaultEncoding: 2 - # Time delay - translateDelay: 0 - # The text of the button when the language is Simplified Chinese - msgToTraditionalChinese: '繁' - # The text of the button when the language is Traditional Chinese - msgToSimplifiedChinese: '簡' - -# Read Mode (閲讀模式) -readmode: true - -# dark mode -darkmode: - enable: true - # Toggle Button to switch dark/light mode - button: true - # Switch dark/light mode automatically (自動切換 dark mode和 light mode) - # autoChangeMode: 1 Following System Settings, if the system doesn't support dark mode, it will switch dark mode between 6 pm to 6 am - # autoChangeMode: 2 Switch dark mode between 6 pm to 6 am - # autoChangeMode: false - autoChangeMode: false - # Set the light mode time. The value is between 0 and 24. If not set, the default value is 6 and 18 - start: # 8 - end: # 22 - -# show scroll percent in scroll-to-top button -rightside_scroll_percent: false - -# Don't modify the following settings unless you know how they work (非必要請不要修改 ) -# Choose: readmode,translate,darkmode,hideAside,toc,chat,comment -# Don't repeat 不要重複 -rightside_item_order: - enable: false - hide: # readmode,translate,darkmode,hideAside - show: # toc,chat,comment - -# Math (數學) -# -------------------------------------- -# About the per_page -# if you set it to true, it will load mathjax/katex script in each page (true 表示每一頁都加載js) -# if you set it to false, it will load mathjax/katex script according to your setting (add the 'mathjax: true' in page's front-matter) -# (false 需要時加載,須在使用的 Markdown Front-matter 加上 mathjax: true) - -# MathJax -mathjax: - enable: false - per_page: false - -# KaTeX -katex: - enable: false - per_page: false - hide_scrollbar: true - -# search (搜索) -# see https://butterfly.js.org/posts/ceeb73f/#搜索系統 -# -------------------------------------- - -# Algolia search -algolia_search: - enable: false - hits: - per_page: 6 - -# Local search -local_search: - enable: false - # Preload the search data when the page loads. - preload: false - # Show top n results per article, show all results by setting to -1 - top_n_per_article: 1 - # Unescape html strings to the readable one. - unescape: false - CDN: - -# Docsearch -docsearch: - enable: false - appId: - apiKey: - indexName: - option: - -# Share System (分享) -# -------------------------------------- - -# AddThis -# https://www.addthis.com/ -addThis: - enable: false - pubid: - -# Share.js -# https://github.com/overtrue/share.js -sharejs: - enable: true - sites: facebook,twitter,wechat,weibo,qq - -# AddToAny -# https://www.addtoany.com/ -addtoany: - enable: false - item: facebook,twitter,wechat,sina_weibo,facebook_messenger,email,copy_link - -# Comments System -# -------------------------------------- - -comments: - # Up to two comments system, the first will be shown as default - # Choose: Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus/Remark42/Artalk - use: # Valine,Disqus - text: true # Display the comment name next to the button - # lazyload: The comment system will be load when comment element enters the browser's viewport. - # If you set it to true, the comment count will be invalid - lazyload: false - count: false # Display comment count in post's top_img - card_post_count: false # Display comment count in Home Page - -# disqus -# https://disqus.com/ -disqus: - shortname: - apikey: # For newest comments widget - -# Alternative Disqus - Render comments with Disqus API -# DisqusJS 評論系統,可以實現在網路審查地區載入 Disqus 評論列表,兼容原版 -# https://github.com/SukkaW/DisqusJS -disqusjs: - shortname: - apikey: - option: - -# livere (來必力) -# https://www.livere.com/ -livere: - uid: - -# gitalk -# https://github.com/gitalk/gitalk -gitalk: - client_id: - client_secret: - repo: - owner: - admin: - option: - -# valine -# https://valine.js.org -valine: - appId: # leancloud application app id - appKey: # leancloud application app key - avatar: monsterid # gravatar style https://valine.js.org/#/avatar - serverURLs: # This configuration is suitable for domestic custom domain name users, overseas version will be automatically detected (no need to manually fill in) - bg: # valine background - visitor: false - option: - -# waline - A simple comment system with backend support fork from Valine -# https://waline.js.org/ -waline: - serverURL: # Waline server address url - bg: # waline background - pageview: false - option: - -# utterances -# https://utteranc.es/ -utterances: - repo: - # Issue Mapping: pathname/url/title/og:title - issue_term: pathname - # Theme: github-light/github-dark/github-dark-orange/icy-dark/dark-blue/photon-dark - light_theme: github-light - dark_theme: photon-dark - -# Facebook Comments Plugin -# https://developers.facebook.com/docs/plugins/comments/ -facebook_comments: - app_id: - user_id: # optional - pageSize: 10 # The number of comments to show - order_by: social # social/time/reverse_time - lang: zh_TW # Language en_US/zh_CN/zh_TW and so on - -# Twikoo -# https://github.com/imaegoo/twikoo -twikoo: - envId: - region: - visitor: false - option: - -# Giscus -# https://giscus.app/ -giscus: - repo: - repo_id: - category_id: - theme: - light: light - dark: dark - option: - -# Remark42 -# https://remark42.com/docs/configuration/frontend/ -remark42: - host: # Your Host URL - siteId: # Your Site ID - option: - -# Artalk -# https://artalk.js.org/guide/frontend/config.html -artalk: - server: - site: - visitor: false - option: - -# Chat Services -# -------------------------------------- - -# Chat Button [recommend] -# It will create a button in the bottom right corner of website, and hide the origin button -chat_btn: false - -# The origin chat button is displayed when scrolling up, and the button is hidden when scrolling down -chat_hide_show: false - -# chatra -# https://chatra.io/ -chatra: - enable: false - id: - -# tidio -# https://www.tidio.com/ -tidio: - enable: false - public_key: - -# daovoice -# http://dashboard.daovoice.io/app -daovoice: - enable: false - app_id: - -# crisp -# https://crisp.chat/en/ -crisp: - enable: false - website_id: - -# messenger -# https://developers.facebook.com/docs/messenger-platform/discovery/facebook-chat-plugin/ -messenger: - enable: false - pageID: - lang: zh_TW # Language en_US/zh_CN/zh_TW and so on - -# Analysis -# -------------------------------------- - -# Baidu Analytics -# https://tongji.baidu.com/web/welcome/login -baidu_analytics: - -# Google Analytics -# https://analytics.google.com/analytics/web/ -google_analytics: - -# Cloudflare Analytics -# https://www.cloudflare.com/zh-tw/web-analytics/ -cloudflare_analytics: - -# Microsoft Clarity -# https://clarity.microsoft.com/ -microsoft_clarity: - -# Advertisement -# -------------------------------------- - -# Google Adsense (谷歌廣告) -google_adsense: - enable: false - auto_ads: true - js: https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js - client: - enable_page_level_ads: true - -# Insert ads manually (手動插入廣告) -# ad: -# index: -# aside: -# post: - -# Verification (站長驗證) -# -------------------------------------- - -site_verification: - # - name: google-site-verification - # content: xxxxxx - # - name: baidu-site-verification - # content: xxxxxxx - -# Beautify/Effect (美化/效果) -# -------------------------------------- - -# Theme color for customize -# Notice: color value must in double quotes like "#000" or may cause error! - -# theme_color: -# enable: true -# main: "#49B1F5" -# paginator: "#00c4b6" -# button_hover: "#FF7242" -# text_selection: "#00c4b6" -# link_color: "#99a9bf" -# meta_color: "#858585" -# hr_color: "#A4D8FA" -# code_foreground: "#F47466" -# code_background: "rgba(27, 31, 35, .05)" -# toc_color: "#00c4b6" -# blockquote_padding_color: "#49b1f5" -# blockquote_background_color: "#49b1f5" -# scrollbar_color: "#49b1f5" -# meta_theme_color_light: "ffffff" -# meta_theme_color_dark: "#0d0d0d" - -# The top_img settings of home page -# default: top img - full screen, site info - middle (默認top_img全屏,site_info在中間) -# The position of site info, eg: 300px/300em/300rem/10% (主頁標題距離頂部距離) -index_site_info_top: -# The height of top_img, eg: 300px/300em/300rem (主頁top_img高度) -index_top_img_height: - -# The user interface setting of category and tag page (category和tag頁的UI設置) -# index - same as Homepage UI (index 值代表 UI將與首頁的UI一樣) -# default - same as archives UI 默認跟archives頁面UI一樣 -category_ui: # 留空或 index -tag_ui: # 留空或 index - -# Website Background (設置網站背景) -# can set it to color or image (可設置圖片 或者 顔色) -# The formal of image: url(http://xxxxxx.com/xxx.jpg) -background: - -# Footer Background -footer_bg: false - -# Add mask to header or footer (为 header 或 footer 添加黑色半透遮罩) -mask: - header: true - footer: true - -# the position of bottom right button/default unit: px (右下角按鈕距離底部的距離/默認單位為px) -rightside-bottom: - -# Enter transitions (開啓網頁進入效果) -enter_transitions: true - -# Typewriter Effect (打字效果) -# https://github.com/disjukr/activate-power-mode -activate_power_mode: - enable: false - colorful: true # open particle animation (冒光特效) - shake: true # open shake (抖動特效) - mobile: false - -# Background effects (背景特效) -# -------------------------------------- - -# canvas_ribbon (靜止彩帶背景) -# See: https://github.com/hustcc/ribbon.js -canvas_ribbon: - enable: false - size: 150 - alpha: 0.6 - zIndex: -1 - click_to_change: false - mobile: false - -# Fluttering Ribbon (動態彩帶) -canvas_fluttering_ribbon: - enable: false - mobile: false - -# canvas_nest -# https://github.com/hustcc/canvas-nest.js -canvas_nest: - enable: false - color: '0,0,255' #color of lines, default: '0,0,0'; RGB values: (R,G,B).(note: use ',' to separate.) - opacity: 0.7 # the opacity of line (0~1), default: 0.5. - zIndex: -1 # z-index property of the background, default: -1. - count: 99 # the number of lines, default: 99. - mobile: false - -# Mouse click effects: fireworks (鼠標點擊效果: 煙火特效) -fireworks: - enable: false - zIndex: 9999 # -1 or 9999 - mobile: false - -# Mouse click effects: Heart symbol (鼠標點擊效果: 愛心) -click_heart: - enable: false - mobile: false - -# Mouse click effects: words (鼠標點擊效果: 文字) -ClickShowText: - enable: false - text: - # - I - # - LOVE - # - YOU - fontSize: 15px - random: false - mobile: false - -# Default display mode (網站默認的顯示模式) -# light (default) / dark -display_mode: light - -# Beautify (美化頁面顯示) -beautify: - enable: false - field: post # site/post - title-prefix-icon: # '\f0c1' - title-prefix-icon-color: # '#F47466' - -# Global font settings -# Don't modify the following settings unless you know how they work (非必要不要修改) -font: - global-font-size: - code-font-size: - font-family: - code-font-family: - -# Font settings for the site title and site subtitle -# 左上角網站名字 主頁居中網站名字 -blog_title_font: - font_link: - font-family: - -# The setting of divider icon (水平分隔線圖標設置) -hr_icon: - enable: true - icon: # the unicode value of Font Awesome icon, such as '\3423' - icon-top: - -# the subtitle on homepage (主頁subtitle) -subtitle: - enable: false - # Typewriter Effect (打字效果) - effect: true - # Customize typed.js (配置typed.js) - # https://github.com/mattboldt/typed.js/#customization - typed_option: - # source 調用第三方服務 - # source: false 關閉調用 - # source: 1 調用一言網的一句話(簡體) https://hitokoto.cn/ - # source: 2 調用一句網(簡體) https://yijuzhan.com/ - # source: 3 調用今日詩詞(簡體) https://www.jinrishici.com/ - # subtitle 會先顯示 source , 再顯示 sub 的內容 - source: false - # 如果關閉打字效果,subtitle 只會顯示 sub 的第一行文字 - sub: - -# Loading Animation (加載動畫) -preloader: - enable: false - # source - # 1. fullpage-loading - # 2. pace (progress bar) - source: 1 - # pace theme (see https://codebyzach.github.io/pace/) - pace_css_url: - -# wordcount (字數統計) -# see https://butterfly.js.org/posts/ceeb73f/#字數統計 -wordcount: - enable: false - post_wordcount: true - min2read: true - total_wordcount: true - -# Lightbox (圖片大圖查看模式) -# -------------------------------------- -# You can only choose one, or neither (只能選擇一個 或者 兩個都不選) - -# medium-zoom -# https://github.com/francoischalifour/medium-zoom -medium_zoom: false - -# fancybox -# https://fancyapps.com/fancybox/ -fancybox: true - -# Tag Plugins settings (標籤外掛) -# -------------------------------------- - -# abcjs (樂譜渲染) -# See https://github.com/paulrosen/abcjs -abcjs: - enable: false - per_page: true - -# mermaid -# see https://github.com/mermaid-js/mermaid -mermaid: - enable: false - # built-in themes: default/forest/dark/neutral - theme: - light: default - dark: dark - -# Note (Bootstrap Callout) -note: - # Note tag style values: - # - simple bs-callout old alert style. Default. - # - modern bs-callout new (v2-v3) alert style. - # - flat flat callout style with background, like on Mozilla or StackOverflow. - # - disabled disable all CSS styles import of note tag. - style: flat - icons: true - border_radius: 3 - # Offset lighter of background in % for modern and flat styles (modern: -12 | 12; flat: -18 | 6). - # Offset also applied to label tag variables. This option can work with disabled note tag. - light_bg_offset: 0 - -# other -# -------------------------------------- - -# Pjax -# It may contain bugs and unstable, give feedback when you find the bugs. -# https://github.com/MoOx/pjax -pjax: - enable: false - exclude: - # - xxxx - # - xxxx - -# Inject the css and script (aplayer/meting) -aplayerInject: - enable: false - per_page: true - -# Snackbar (Toast Notification 彈窗) -# https://github.com/polonel/SnackBar -# position 彈窗位置 -# 可選 top-left / top-center / top-right / bottom-left / bottom-center / bottom-right -snackbar: - enable: false - position: bottom-left - bg_light: '#49b1f5' # The background color of Toast Notification in light mode - bg_dark: '#1f1f1f' # The background color of Toast Notification in dark mode - -# https://instant.page/ -# prefetch (預加載) -instantpage: false - -# https://github.com/vinta/pangu.js -# Insert a space between Chinese character and English character (中英文之間添加空格) -pangu: - enable: false - field: site # site/post - -# Lazyload (圖片懶加載) -# https://github.com/verlok/vanilla-lazyload -lazyload: - enable: false - field: site # site/post - placeholder: - blur: false - -# PWA -# See https://github.com/JLHwung/hexo-offline -# --------------- -# pwa: -# enable: false -# manifest: /pwa/manifest.json -# apple_touch_icon: /pwa/apple-touch-icon.png -# favicon_32_32: /pwa/32.png -# favicon_16_16: /pwa/16.png -# mask_icon: /pwa/safari-pinned-tab.svg - -# Open graph meta tags -# https://developers.facebook.com/docs/sharing/webmasters/ -Open_Graph_meta: - enable: true - option: - # twitter_card: - # twitter_image: - # twitter_id: - # twitter_site: - # google_plus: - # fb_admins: - # fb_app_id: - -# Add the vendor prefixes to ensure compatibility -css_prefix: true - -# Inject -# Insert the code to head (before '' tag) and the bottom (before '' tag) -# 插入代码到头部 之前 和 底部 之前 -inject: - head: - # - - bottom: - # - - -# CDN -# Don't modify the following settings unless you know how they work -# 非必要請不要修改 -CDN: - # The CDN provider of internal scripts (主題內部 js 的 cdn 配置) - # option: local/jsdelivr/unpkg/cdnjs/custom - # Dev version can only choose. ( dev版的主題只能設置為 local ) - internal_provider: local - - # The CDN provider of third party scripts (第三方 js 的 cdn 配置) - # option: local/jsdelivr/unpkg/cdnjs/custom - # when set it to local, you need to install hexo-butterfly-extjs - third_party_provider: jsdelivr - - # Add version number to url, true or false - version: false - - # Custom format - # For example: https://cdn.staticfile.org/${cdnjs_name}/${version}/${min_cdnjs_file} - custom_format: - - option: - # main_css: - # main: - # utils: - # translate: - # local_search: - # algolia_js: - # algolia_search: - # instantsearch: - # docsearch_js: - # docsearch_css: - # pjax: - # gitalk: - # gitalk_css: - # blueimp_md5: - # valine: - # disqusjs: - # disqusjs_css: - # twikoo: - # waline_js: - # waline_css: - # giscus: - # sharejs: - # sharejs_css: - # mathjax: - # katex: - # katex_copytex: - # mermaid: - # canvas_ribbon: - # canvas_fluttering_ribbon: - # canvas_nest: - # lazyload: - # instantpage: - # typed: - # pangu: - # fancybox_css: - # fancybox: - # medium_zoom: - # snackbar_css: - # snackbar: - # activate_power_mode: - # fireworks: - # click_heart: - # ClickShowText: - # fontawesome: - # flickr_justified_gallery_js: - # flickr_justified_gallery_css: - # aplayer_css: - # aplayer_js: - # meting_js: - # prismjs_js: - # prismjs_lineNumber_js: - # prismjs_autoloader: - # artalk_js: - # artalk_css: - # busuanzi: - # abcjs_basic_js: diff --git a/node_modules/hexo-theme-butterfly/languages/default.yml b/node_modules/hexo-theme-butterfly/languages/default.yml deleted file mode 100644 index 20296e56..00000000 --- a/node_modules/hexo-theme-butterfly/languages/default.yml +++ /dev/null @@ -1,123 +0,0 @@ -footer: - framework: Framework - theme: Theme - -copy: - success: Copy successfully - error: Copy error - noSupport: The browser does not support - -page: - articles: Articles - tag: Tag - category: Category - archives: Archives - -card_post_count: comments - -sticky: Sticky -no_title: No title - -post: - created: Created - updated: Updated - wordcount: Word count - min2read: Reading time - min2read_unit: min - page_pv: Post View - comments: Comments - copyright: - author: Author - link: Link - copyright_notice: Copyright Notice - copyright_content: 'All articles in this blog are licensed under %s unless stating additionally.' - recommend: Related Articles - edit: Edited on - -search: - title: Search - load_data: Loading the Database - algolia_search: - input_placeholder: Search for Posts - hits_empty: "We didn't find any results for the search: ${query}." - hits_stats: '${hits} results found in ${time} ms' - - local_search: - input_placeholder: Search for Posts - hits_empty: "We didn't find any results for the search: ${query}" - hits_stats: '${hits} results found' - -pagination: - prev: Previous Post - next: Next Post - -comment: Comment - -aside: - articles: Articles - tags: Tags - categories: Categories - card_announcement: Announcement - card_categories: Categories - card_tags: Tags - card_archives: Archives - card_recent_post: Recent Post - card_webinfo: - headline: Info - article_name: Article - runtime: - name: Run time - unit: days - last_push_date: - name: Last Push - site_wordcount: Total Count - site_uv_name: UV - site_pv_name: PV - more_button: More - card_newest_comments: - headline: Newest Comments - loading_text: loading... - error: Unable to get the data, please make sure the settings are correct. - zero: No Comment - image: image - link: link - code: code - card_toc: Catalog - -date_suffix: - just: Just - min: minutes ago - hour: hours ago - day: days ago - month: months ago - -donate: Donate -share: Share - -rightside: - readmode_title: Read Mode - translate_title: Toggle Between Traditional Chinese And Simplified Chinese - night_mode_title: Toggle Between Light And Dark Mode - back_to_top: Back To Top - toc: Table Of Contents - scroll_to_comment: Scroll To Comments - setting: Setting - aside: Toggle between single-column and double-column - chat: Chat - -copy_copyright: - author: Author - link: Link - source: Source - info: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source. - -Snackbar: - chs_to_cht: Traditional Chinese Activated Manually - cht_to_chs: Simplified Chinese Activated Manually - day_to_night: Dark Mode Activated Manually - night_to_day: Light Mode Activated Manually - -loading: Loading... -load_more: Load More - -error404: Page not found diff --git a/node_modules/hexo-theme-butterfly/languages/en.yml b/node_modules/hexo-theme-butterfly/languages/en.yml deleted file mode 100644 index b7b0b8fb..00000000 --- a/node_modules/hexo-theme-butterfly/languages/en.yml +++ /dev/null @@ -1,123 +0,0 @@ -footer: - framework: Framework - theme: Theme - -copy: - success: Copy successfully - error: Copy error - noSupport: The browser does not support - -page: - articles: Articles - tag: Tag - category: Category - archives: Archives - -card_post_count: comments - -sticky: Sticky -no_title: No title - -post: - created: Created - updated: Updated - wordcount: Word count - min2read: Reading time - min2read_unit: min - page_pv: Post View - comments: Comments - copyright: - author: Author - link: Link - copyright_notice: Copyright Notice - copyright_content: 'All articles in this blog are licensed under %s unless stating additionally.' - recommend: Related Articles - edit: Edited on - -search: - title: Search - load_data: Loading the Database - algolia_search: - input_placeholder: Search for Posts - hits_empty: "We didn't find any results for the search: ${query}." - hits_stats: '${hits} results found in ${time} ms' - - local_search: - input_placeholder: Search for Posts - hits_empty: "We didn't find any results for the search: ${query}" - hits_stats: '${hits} results found' - -pagination: - prev: Previous Post - next: Next Post - -comment: Comment - -aside: - articles: Articles - tags: Tags - categories: Categories - card_announcement: Announcement - card_categories: Categories - card_tags: Tags - card_archives: Archives - card_recent_post: Recent Post - card_webinfo: - headline: Info - article_name: Article - runtime: - name: Run time - unit: days - last_push_date: - name: Last Push - site_wordcount: Total Count - site_uv_name: UV - site_pv_name: PV - more_button: More - card_newest_comments: - headline: Newest Comments - loading_text: loading... - error: Unable to get the data, please make sure the settings are correct. - zero: No Comment - image: image - link: link - code: code - card_toc: Catalog - -date_suffix: - just: Just - min: minutes ago - hour: hours ago - day: days ago - month: months ago - -donate: Donate -share: Share - -rightside: - readmode_title: Read Mode - translate_title: Switch Between Traditional Chinese And Simplified Chinese - night_mode_title: Switch Between Light And Dark Mode - back_to_top: Back To Top - toc: Table Of Contents - scroll_to_comment: Scroll To Comments - setting: Setting - aside: Toggle between single-column and double-column - chat: Chat - -copy_copyright: - author: Author - link: Link - source: Source - info: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source. - -Snackbar: - chs_to_cht: Traditional Chinese Activated Manually - cht_to_chs: Simplified Chinese Activated Manually - day_to_night: Dark Mode Activated Manually - night_to_day: Light Mode Activated Manually - -loading: Loading... -load_more: Load More - -error404: Page not found diff --git a/node_modules/hexo-theme-butterfly/languages/zh-CN.yml b/node_modules/hexo-theme-butterfly/languages/zh-CN.yml deleted file mode 100644 index 68a52727..00000000 --- a/node_modules/hexo-theme-butterfly/languages/zh-CN.yml +++ /dev/null @@ -1,124 +0,0 @@ -footer: - framework: 框架 - theme: 主题 - -copy: - success: 复制成功 - error: 复制错误 - noSupport: 浏览器不支持 - -page: - articles: 文章总览 - tag: 标签 - category: 分类 - archives: 归档 - -card_post_count: 条评论 - -sticky: 置顶 -no_title: 无题 - -post: - created: 发表于 - updated: 更新于 - wordcount: 字数总计 - min2read: 阅读时长 - min2read_unit: 分钟 - page_pv: 阅读量 - comments: 评论数 - copyright: - author: 文章作者 - link: 文章链接 - copyright_notice: 版权声明 - copyright_content: '本博客所有文章除特别声明外,均采用 - %s 许可协议。转载请注明来自 %s!' - recommend: 相关推荐 - edit: 编辑 - -search: - title: 搜索 - load_data: 数据库加载中 - algolia_search: - input_placeholder: 搜索文章 - hits_empty: '找不到您查询的内容:${query}' - hits_stats: '找到 ${hits} 条结果,用时 ${time} 毫秒' - - local_search: - input_placeholder: 搜索文章 - hits_empty: '找不到您查询的内容:${query}' - hits_stats: '共找到 ${hits} 篇文章' - -pagination: - prev: 上一篇 - next: 下一篇 - -comment: 评论 - -aside: - articles: 文章 - tags: 标签 - categories: 分类 - card_announcement: 公告 - card_categories: 分类 - card_tags: 标签 - card_archives: 归档 - card_recent_post: 最新文章 - card_webinfo: - headline: 网站资讯 - article_name: 文章数目 - runtime: - name: 已运行时间 - unit: 天 - last_push_date: - name: 最后更新时间 - site_wordcount: 本站总字数 - site_uv_name: 本站访客数 - site_pv_name: 本站总访问量 - more_button: 查看更多 - card_newest_comments: - headline: 最新评论 - loading_text: 正在加载中... - error: 无法获取评论,请确认相关配置是否正确 - zero: 没有评论 - image: 图片 - link: 链接 - code: 代码 - card_toc: 目录 - -date_suffix: - just: 刚刚 - min: 分钟前 - hour: 小时前 - day: 天前 - month: 个月前 - -donate: 打赏 -share: 分享 - -rightside: - readmode_title: 阅读模式 - translate_title: 简繁转换 - night_mode_title: 浅色和深色模式转换 - back_to_top: 回到顶部 - toc: 目录 - scroll_to_comment: 直达评论 - setting: 设置 - aside: 单栏和双栏切换 - chat: 聊天 - -copy_copyright: - author: 作者 - link: 链接 - source: 来源 - info: 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。 - -Snackbar: - chs_to_cht: 你已切换为繁体 - cht_to_chs: 你已切换为简体 - day_to_night: 你已切换为深色模式 - night_to_day: 你已切换为浅色模式 - -loading: 加载中... -load_more: 加载更多 - -error404: 页面没有找到 diff --git a/node_modules/hexo-theme-butterfly/languages/zh-TW.yml b/node_modules/hexo-theme-butterfly/languages/zh-TW.yml deleted file mode 100644 index 15a1738e..00000000 --- a/node_modules/hexo-theme-butterfly/languages/zh-TW.yml +++ /dev/null @@ -1,124 +0,0 @@ -footer: - framework: 框架 - theme: 主題 - -copy: - success: 複製成功 - error: 複製錯誤 - noSupport: 瀏覽器不支援 - -page: - articles: 文章總覽 - tag: 標籤 - category: 分類 - archives: 歸檔 - -card_post_count: 條評論 - -sticky: 置頂 -no_title: 無題 - -post: - created: 發表於 - updated: 更新於 - wordcount: 字數總計 - min2read: 閱讀時長 - min2read_unit: 分鐘 - page_pv: 閱讀量 - comments: 評論數 - copyright: - author: 文章作者 - link: 文章連結 - copyright_notice: 版權聲明 - copyright_content: '本部落格所有文章除特別聲明外,均採用 - %s 許可協議。轉載請註明來自 %s!' - recommend: 相關推薦 - edit: 編輯 - -search: - title: 搜尋 - load_data: 資料庫載入中 - algolia_search: - input_placeholder: 搜尋文章 - hits_empty: '找不到您查詢的內容:${query}' - hits_stats: '找到 ${hits} 條結果,用時 ${time} 毫秒' - - local_search: - input_placeholder: 搜尋文章 - hits_empty: '找不到您查詢的內容:${query}' - hits_stats: '共找到 ${hits} 篇文章' - -pagination: - prev: 上一篇 - next: 下一篇 - -comment: 評論 - -aside: - articles: 文章 - tags: 標籤 - categories: 分類 - card_announcement: 公告 - card_categories: 分類 - card_tags: 標籤 - card_archives: 歸檔 - card_recent_post: 最新文章 - card_webinfo: - headline: 網站資訊 - article_name: 文章數目 - runtime: - name: 已執行時間 - unit: 天 - last_push_date: - name: 最後更新時間 - site_wordcount: 本站總字數 - site_uv_name: 本站訪客數 - site_pv_name: 本站總訪問量 - more_button: 檢視更多 - card_newest_comments: - headline: 最新評論 - loading_text: 正在載入中... - error: 無法獲取評論,請確認相關配置是否正確 - zero: 沒有評論 - image: 圖片 - link: 連結 - code: 程式碼 - card_toc: 目錄 - -date_suffix: - just: 剛剛 - min: 分鐘前 - hour: 小時前 - day: 天前 - month: 個月前 - -donate: 打賞 -share: 分享 - -rightside: - readmode_title: 閱讀模式 - translate_title: 簡繁轉換 - night_mode_title: 淺色和深色模式轉換 - back_to_top: 回到頂部 - toc: 目錄 - scroll_to_comment: 直達評論 - setting: 設定 - aside: 單欄和雙欄切換 - chat: 聊天 - -copy_copyright: - author: 作者 - link: 連結 - source: 來源 - info: 著作權歸作者所有。商業轉載請聯絡作者獲得授權,非商業轉載請註明出處。 - -Snackbar: - chs_to_cht: 你已切換為繁體 - cht_to_chs: 你已切換為簡體 - day_to_night: 你已切換為深色模式 - night_to_day: 你已切換為淺色模式 - -loading: 載入中... -load_more: 載入更多 - -error404: 頁面沒有找到 diff --git a/node_modules/hexo-theme-butterfly/layout/archive.pug b/node_modules/hexo-theme-butterfly/layout/archive.pug deleted file mode 100644 index 7a79f1b1..00000000 --- a/node_modules/hexo-theme-butterfly/layout/archive.pug +++ /dev/null @@ -1,9 +0,0 @@ -extends includes/layout.pug - -block content - include ./includes/mixins/article-sort.pug - #archive - - const archiveLength = findArchiveLength(fragment_cache) - .article-sort-title= _p('page.articles') + ' - ' + archiveLength - +articleSort(page.posts) - include includes/pagination.pug \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/category.pug b/node_modules/hexo-theme-butterfly/layout/category.pug deleted file mode 100644 index 17221f18..00000000 --- a/node_modules/hexo-theme-butterfly/layout/category.pug +++ /dev/null @@ -1,14 +0,0 @@ -extends includes/layout.pug - -block content - if theme.category_ui == 'index' - include ./includes/mixins/post-ui.pug - #recent-posts.recent-posts.category_ui - +postUI - include includes/pagination.pug - else - include ./includes/mixins/article-sort.pug - #category - .article-sort-title= _p('page.category') + ' - ' + page.category - +articleSort(page.posts) - include includes/pagination.pug \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/404.pug b/node_modules/hexo-theme-butterfly/layout/includes/404.pug deleted file mode 100644 index 27cad1ba..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/404.pug +++ /dev/null @@ -1,12 +0,0 @@ -- var top_img_404 = theme.error_404.background || theme.default_top_img - -#body-wrap.error404 - include ./header/index.pug - - #error-wrap - .error-content - .error-img - img(src=url_for(top_img_404) alt='Page not found') - .error-info - h1.error_title= '404' - .error_subtitle= theme.error_404.subtitle || _p('error404') diff --git a/node_modules/hexo-theme-butterfly/layout/includes/additional-js.pug b/node_modules/hexo-theme-butterfly/layout/includes/additional-js.pug deleted file mode 100644 index a066103a..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/additional-js.pug +++ /dev/null @@ -1,65 +0,0 @@ -div - script(src=url_for(theme.asset.utils)) - script(src=url_for(theme.asset.main)) - - if theme.translate.enable - script(src=url_for(theme.asset.translate)) - - if theme.medium_zoom - script(src=url_for(theme.asset.medium_zoom)) - else if theme.fancybox - script(src=url_for(theme.asset.fancybox)) - - if theme.instantpage - script(src=url_for(theme.asset.instantpage), type='module') - - if theme.lazyload.enable - script(src=url_for(theme.asset.lazyload)) - - if theme.snackbar.enable - script(src=url_for(theme.asset.snackbar)) - - if theme.pangu.enable - != partial("includes/third-party/pangu.pug", {}, { cache: true }) - - .js-pjax - if needLoadCountJs - != partial("includes/third-party/card-post-count/index", {}, { cache: true }) - - if loadSubJs - include ./third-party/subtitle.pug - - include ./third-party/math/index.pug - - include ./third-party/abcjs/index.pug - - if commentsJsLoad - include ./third-party/comments/js.pug - - != partial("includes/third-party/prismjs", {}, { cache: true }) - - if theme.aside.enable && theme.newest_comments.enable - if theme.pjax.enable - != partial("includes/third-party/newest-comments/index", {}, { cache: true }) - else if (!is_post() && page.aside !== false) - != partial("includes/third-party/newest-comments/index", {}, { cache: true }) - - != fragment_cache('injectBottom', function(){return injectHtml(theme.inject.bottom)}) - - != partial("includes/third-party/effect", {}, { cache: true }) - - != partial("includes/third-party/chat/index", {}, { cache: true }) - - if theme.aplayerInject && theme.aplayerInject.enable - if theme.pjax.enable || theme.aplayerInject.per_page - include ./third-party/aplayer.pug - else if page.aplayer - include ./third-party/aplayer.pug - - if theme.pjax.enable - != partial("includes/third-party/pjax", {}, { cache: true }) - - if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv - script(async data-pjax src= theme.asset.busuanzi || '//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js') - - !=partial('includes/third-party/search/index', {}, {cache: true}) \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/footer.pug b/node_modules/hexo-theme-butterfly/layout/includes/footer.pug deleted file mode 100644 index 6d20fbc2..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/footer.pug +++ /dev/null @@ -1,17 +0,0 @@ -#footer-wrap - if theme.footer.owner.enable - - var now = new Date() - - var nowYear = now.getFullYear() - if theme.footer.owner.since && theme.footer.owner.since != nowYear - .copyright!= `©${theme.footer.owner.since} - ${nowYear} By ${config.author}` - else - .copyright!= `©${nowYear} By ${config.author}` - if theme.footer.copyright - .framework-info - span= _p('footer.framework') + ' ' - a(href='https://hexo.io')= 'Hexo' - span.footer-separator | - span= _p('footer.theme') + ' ' - a(href='https://github.com/jerryc127/hexo-theme-butterfly')= 'Butterfly' - if theme.footer.custom_text - .footer_custom_text!=`${theme.footer.custom_text}` diff --git a/node_modules/hexo-theme-butterfly/layout/includes/head.pug b/node_modules/hexo-theme-butterfly/layout/includes/head.pug deleted file mode 100644 index 3a88f375..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/head.pug +++ /dev/null @@ -1,69 +0,0 @@ -- var pageTitle -- is_archive() ? page.title = findArchivesTitle(page, theme.menu, date) : '' -- if (is_tag()) pageTitle = _p('page.tag') + ': ' + page.tag -- else if (is_category()) pageTitle = _p('page.category') + ': ' + page.category -- else if (is_current('/404.html', [strict])) pageTitle = _p('error404') -- else pageTitle = page.title || config.title || '' - -- var isSubtitle = config.subtitle ? ' - ' + config.subtitle : '' -- var tabTitle = is_home() || !pageTitle ? config.title + isSubtitle : pageTitle + ' | ' + config.title -- var pageAuthor = config.email ? config.author + ',' + config.email : config.author -- var pageCopyright = config.copyright || config.author -- var themeColorLight = theme.theme_color && theme.theme_color.enable && theme.theme_color.meta_theme_color_light || '#ffffff' -- var themeColorDark = theme.theme_color && theme.theme_color.enable && theme.theme_color.meta_theme_color_dark || '#0d0d0d' -- var themeColor = theme.display_mode === 'dark' ? themeColorDark : themeColorLight - -meta(charset='UTF-8') -meta(http-equiv="X-UA-Compatible" content="IE=edge") -meta(name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover") -title= tabTitle -meta(name="author" content=pageAuthor) -meta(name="copyright" content=pageCopyright) -meta(name ="format-detection" content="telephone=no") -meta(name="theme-color" content=themeColor) - -//- Open_Graph -include ./head/Open_Graph.pug - -!=favicon_tag(theme.favicon || config.favicon) -link(rel="canonical" href=urlNoIndex(null,config.pretty_urls.trailing_index,config.pretty_urls.trailing_html)) - -//- 預解析 -!=partial('includes/head/preconnect', {}, {cache: true}) - -//- 網站驗證 -!=partial('includes/head/site_verification', {}, {cache: true}) - -//- PWA -if (theme.pwa && theme.pwa.enable) - !=partial('includes/head/pwa', {}, {cache: true}) - -//- main css -link(rel='stylesheet', href=url_for(theme.asset.main_css)) -link(rel='stylesheet', href=url_for(theme.asset.fontawesome) media="print" onload="this.media='all'") - -if (theme.snackbar && theme.snackbar.enable) - link(rel='stylesheet', href=url_for(theme.asset.snackbar_css) media="print" onload="this.media='all'") - -if theme.fancybox - link(rel='stylesheet' href=url_for(theme.asset.fancybox_css) media="print" onload="this.media='all'") - -//- google_adsense -!=partial('includes/head/google_adsense', {}, {cache: true}) - -//- analytics -!=partial('includes/head/analytics', {}, {cache: true}) - -//- font -if theme.blog_title_font && theme.blog_title_font.font_link - link(rel='stylesheet' href=url_for(theme.blog_title_font.font_link) media="print" onload="this.media='all'") - -//- global config -!=partial('includes/head/config', {}, {cache: true}) - -include ./head/config_site.pug -include ./head/noscript.pug - -!=fragment_cache('injectHeadJs', function(){return inject_head_js()}) - -!=fragment_cache('injectHead', function(){return injectHtml(theme.inject.head)}) diff --git a/node_modules/hexo-theme-butterfly/layout/includes/head/Open_Graph.pug b/node_modules/hexo-theme-butterfly/layout/includes/head/Open_Graph.pug deleted file mode 100644 index d618b785..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/head/Open_Graph.pug +++ /dev/null @@ -1,14 +0,0 @@ -if theme.Open_Graph_meta.enable - - - const coverVal = page.cover_type === 'img' ? page.cover : theme.avatar.img - let ogOption = Object.assign({ - type: is_post() ? 'article' : 'website', - image: coverVal ? full_url_for(coverVal) : '', - fb_admins: theme.facebook_comments.user_id || '', - fb_app_id: theme.facebook_comments.app_id || '', - }, theme.Open_Graph_meta.option) - - - != open_graph(ogOption) -else - meta(name="description" content=page_description()) - diff --git a/node_modules/hexo-theme-butterfly/layout/includes/head/analytics.pug b/node_modules/hexo-theme-butterfly/layout/includes/head/analytics.pug deleted file mode 100644 index 4cde8a52..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/head/analytics.pug +++ /dev/null @@ -1,28 +0,0 @@ -if theme.baidu_analytics - script. - var _hmt = _hmt || []; - (function() { - var hm = document.createElement("script"); - hm.src = "https://hm.baidu.com/hm.js?!{theme.baidu_analytics}"; - var s = document.getElementsByTagName("script")[0]; - s.parentNode.insertBefore(hm, s); - })(); - -if theme.google_analytics - script(async src=`https://www.googletagmanager.com/gtag/js?id=${theme.google_analytics}`) - script. - window.dataLayer = window.dataLayer || []; - function gtag(){dataLayer.push(arguments);} - gtag('js', new Date()); - gtag('config', '!{theme.google_analytics}'); - -if theme.cloudflare_analytics - script(defer data-pjax src='https://static.cloudflareinsights.com/beacon.min.js' data-cf-beacon=`{"token": "${theme.cloudflare_analytics}"}`) - -if theme.microsoft_clarity - script. - (function(c,l,a,r,i,t,y){ - c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)}; - t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i; - y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y); - })(window, document, "clarity", "script", "!{theme.microsoft_clarity}"); \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/head/config.pug b/node_modules/hexo-theme-butterfly/layout/includes/head/config.pug deleted file mode 100644 index 51a9ac0d..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/head/config.pug +++ /dev/null @@ -1,132 +0,0 @@ -- - let algolia = 'undefined'; - let env = process.env; - if (theme.algolia_search.enable) { - algolia = JSON.stringify({ - appId: env.ALGOLIA_APP_ID || config.algolia.appId || config.algolia.applicationID, - apiKey: env.ALGOLIA_API_KEY || config.algolia.apiKey, - indexName: env.ALGOLIA_INDEX_NAME || config.algolia.indexName, - hits: theme.algolia_search.hits, - // search languages - languages: { - input_placeholder: _p("search.algolia_search.input_placeholder"), - hits_empty: _p("search.algolia_search.hits_empty"), - hits_stats: _p("search.algolia_search.hits_stats"), - } - }) - } - - let localSearch = 'undefined'; - if (theme.local_search && theme.local_search.enable) { - localSearch = JSON.stringify({ - path: theme.local_search.CDN ? theme.local_search.CDN : config.root + config.search.path, - preload: theme.local_search.preload, - top_n_per_article: theme.local_search.top_n_per_article, - unescape: theme.local_search.unescape, - languages: { - // search languages - hits_empty: _p("search.local_search.hits_empty"), - hits_stats: _p("search.local_search.hits_stats"), - } - }) - } - - let translate = 'undefined'; - if (theme.translate && theme.translate.enable){ - translate = JSON.stringify({ - defaultEncoding: theme.translate.defaultEncoding, - translateDelay: theme.translate.translateDelay, - msgToTraditionalChinese: theme.translate.msgToTraditionalChinese, - msgToSimplifiedChinese: theme.translate.msgToSimplifiedChinese - }) - } - - let copyright = 'undefined'; - if (theme.copy.enable && theme.copy.copyright.enable){ - copyright = JSON.stringify({ - limitCount: theme.copy.copyright.limit_count, - languages: { - author: _p("copy_copyright.author") + ': ' + config.author, - link: _p("copy_copyright.link") + ': ', - source: _p("copy_copyright.source") + ': ' + config.title, - info: _p("copy_copyright.info") - } - }) - } - - let Snackbar = 'undefined'; - if (theme.snackbar && theme.snackbar.enable) { - Snackbar = JSON.stringify({ - chs_to_cht: _p("Snackbar.chs_to_cht"), - cht_to_chs: _p("Snackbar.cht_to_chs"), - day_to_night: _p("Snackbar.day_to_night"), - night_to_day: _p("Snackbar.night_to_day"), - bgLight: theme.snackbar.bg_light, - bgDark: theme.snackbar.bg_dark, - position: theme.snackbar.position, - }) - } - - let noticeOutdate = 'undefined'; - if (theme.noticeOutdate && theme.noticeOutdate.enable) { - noticeOutdate = JSON.stringify({ - limitDay: theme.noticeOutdate.limit_day, - position: theme.noticeOutdate.position, - messagePrev: theme.noticeOutdate.message_prev, - messageNext: theme.noticeOutdate.message_next, - }) - } - - let highlight = 'undefined'; - if ((config.highlight && config.highlight.enable) || (config.prismjs && config.prismjs.enable)) { - highlight = JSON.stringify({ - plugin: config.highlight.enable ? 'highlighjs' : 'prismjs', - highlightCopy: theme.highlight_copy, - highlightLang: theme.highlight_lang, - highlightHeightLimit: theme.highlight_height_limit - }) - } - -script. - const GLOBAL_CONFIG = { - root: '!{config.root}', - algolia: !{algolia}, - localSearch: !{localSearch}, - translate: !{translate}, - noticeOutdate: !{noticeOutdate}, - highlight: !{highlight}, - copy: { - success: '!{_p("copy.success")}', - error: '!{_p("copy.error")}', - noSupport: '!{_p("copy.noSupport")}' - }, - relativeDate: { - homepage: !{theme.post_meta.page.date_format === 'relative'}, - post: !{theme.post_meta.post.date_format === 'relative'} - }, - runtime: '!{theme.runtimeshow.enable ? _p("aside.card_webinfo.runtime.unit") : ""}', - dateSuffix: { - just: '!{_p("date_suffix.just")}', - min: '!{_p("date_suffix.min")}', - hour: '!{_p("date_suffix.hour")}', - day: '!{_p("date_suffix.day")}', - month: '!{_p("date_suffix.month")}' - }, - copyright: !{copyright}, - lightbox: '!{ theme.medium_zoom ? "mediumZoom" : (theme.fancybox ? "fancybox" : "null" )}', - Snackbar: !{Snackbar}, - source: { - justifiedGallery: { - js: '!{url_for(theme.asset.flickr_justified_gallery_js)}', - css: '!{url_for(theme.asset.flickr_justified_gallery_css)}' - } - }, - isPhotoFigcaption: !{theme.photofigcaption}, - islazyload: !{theme.lazyload.enable}, - isAnchor: !{theme.anchor.auto_update || false}, - percent: { - toc: !{theme.toc.scroll_percent}, - rightside: !{theme.rightside_scroll_percent}, - }, - autoDarkmode: !{theme.darkmode.enable && theme.darkmode.autoChangeMode === 1} - } diff --git a/node_modules/hexo-theme-butterfly/layout/includes/head/config_site.pug b/node_modules/hexo-theme-butterfly/layout/includes/head/config_site.pug deleted file mode 100644 index 3cffa057..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/head/config_site.pug +++ /dev/null @@ -1,30 +0,0 @@ -- - const titleVal = pageTitle.replace(/'/ig,"\\'") - - let isHighlightShrink - if (theme.highlight_shrink == 'none') isHighlightShrink = 'undefined' - else if (page.highlight_shrink === true || page.highlight_shrink === false) isHighlightShrink = page.highlight_shrink - else isHighlightShrink = theme.highlight_shrink - - var showToc = false - if (theme.aside.enable && page.aside !== false) { - let tocEnable = false - if (is_post()) { - if (theme.toc.post) tocEnable = true - } else if (is_page()) { - if (theme.toc.page) tocEnable = true - } - const pageToc = page.toc === true || page.toc === false ? page.toc : tocEnable - showToc = pageToc && (toc(page.content) !== '' || page.encrypt == true ) - } -- - -script#config-diff. - var GLOBAL_CONFIG_SITE = { - title: '!{titleVal}', - isPost: !{is_post()}, - isHome: !{is_home()}, - isHighlightShrink: !{isHighlightShrink}, - isToc: !{showToc}, - postUpdate: '!{full_date(page.updated)}' - } diff --git a/node_modules/hexo-theme-butterfly/layout/includes/head/google_adsense.pug b/node_modules/hexo-theme-butterfly/layout/includes/head/google_adsense.pug deleted file mode 100644 index f4dac013..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/head/google_adsense.pug +++ /dev/null @@ -1,9 +0,0 @@ -if (theme.google_adsense && theme.google_adsense.enable) - script(async src=theme.google_adsense.js) - - if theme.google_adsense.auto_ads - script. - (adsbygoogle = window.adsbygoogle || []).push({ - google_ad_client: '!{theme.google_adsense.client}', - enable_page_level_ads: '!{theme.google_adsense.enable_page_level_ads}' - }); \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/head/noscript.pug b/node_modules/hexo-theme-butterfly/layout/includes/head/noscript.pug deleted file mode 100644 index 87782046..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/head/noscript.pug +++ /dev/null @@ -1,14 +0,0 @@ -noscript. - \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/head/preconnect.pug b/node_modules/hexo-theme-butterfly/layout/includes/head/preconnect.pug deleted file mode 100644 index 44233714..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/head/preconnect.pug +++ /dev/null @@ -1,19 +0,0 @@ -link(rel="preconnect" href="//cdn.jsdelivr.net") - -if theme.google_analytics - link(rel="preconnect" href="//www.google-analytics.com" crossorigin='') - -if theme.baidu_analytics - link(rel="preconnect" href="//hm.baidu.com") - -if theme.cloudflare_analytics - link(rel="preconnect" href="//static.cloudflareinsights.com") - -if theme.microsoft_clarity - link(rel="preconnect" href="//www.clarity.ms") - -if theme.blog_title_font && theme.blog_title_font.font_link && theme.blog_title_font.font_link.indexOf('//fonts.googleapis.com') != -1 - link(rel="preconnect" href="//fonts.googleapis.com" crossorigin='') - -if !theme.asset.busuanzi && (theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv) - link(rel="preconnect" href="//busuanzi.ibruce.info") \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/head/pwa.pug b/node_modules/hexo-theme-butterfly/layout/includes/head/pwa.pug deleted file mode 100644 index 5e9e5ba0..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/head/pwa.pug +++ /dev/null @@ -1,11 +0,0 @@ -link(rel="manifest" href=url_for(theme.pwa.manifest)) -if(theme.pwa.theme_color) - meta(name="msapplication-TileColor" content=theme.pwa.theme_color) -if(theme.pwa.apple_touch_icon) - link(rel="apple-touch-icon" sizes="180x180" href=url_for(theme.pwa.apple_touch_icon)) -if(theme.pwa.favicon_32_32) - link(rel="icon" type="image/png" sizes="32x32" href=url_for(theme.pwa.favicon_32_32)) -if(theme.pwa.favicon_16_16) - link(rel="icon" type="image/png" sizes="16x16" href=url_for(theme.pwa.favicon_16_16)) -if(theme.pwa.mask_icon) - link(rel="mask-icon" href=url_for(theme.pwa.mask_icon) color="#5bbad5") diff --git a/node_modules/hexo-theme-butterfly/layout/includes/head/site_verification.pug b/node_modules/hexo-theme-butterfly/layout/includes/head/site_verification.pug deleted file mode 100644 index 91300305..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/head/site_verification.pug +++ /dev/null @@ -1,3 +0,0 @@ -if theme.site_verification - each item in theme.site_verification - meta(name=item.name content=item.content) \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/header/index.pug b/node_modules/hexo-theme-butterfly/layout/includes/header/index.pug deleted file mode 100644 index c2683149..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/header/index.pug +++ /dev/null @@ -1,52 +0,0 @@ -if !theme.disable_top_img && page.top_img !== false - if is_post() - - var top_img = page.top_img || page.cover || theme.default_top_img - else if is_page() - - var top_img = page.top_img || theme.default_top_img - else if is_tag() - - var top_img = theme.tag_per_img && theme.tag_per_img[page.tag] - - top_img = top_img ? top_img : (theme.tag_img !== false ? theme.tag_img || theme.default_top_img : false) - else if is_category() - - var top_img = theme.category_per_img && theme.category_per_img[page.category] - - top_img = top_img ? top_img : (theme.category_img !== false ? theme.category_img || theme.default_top_img : false) - else if is_home() - - var top_img = theme.index_img !== false ? theme.index_img || theme.default_top_img : false - else if is_archive() - - var top_img = theme.archive_img !== false ? theme.archive_img || theme.default_top_img : false - else - - var top_img = page.top_img || theme.default_top_img - - if top_img !== false - - var imgSource = top_img && isImgOrUrl(top_img) ? `background-image: url('${url_for(top_img)}')` : `background: ${top_img}` - - var bg_img = top_img ? imgSource : '' - - var site_title = page.title || page.tag || page.category || config.title - - var isHomeClass = is_home() ? 'full_page' : 'not-home-page' - - is_post() ? isHomeClass = 'post-bg' : isHomeClass - else - - var isHomeClass = 'not-top-img' -else - - var top_img = false - - var isHomeClass = 'not-top-img' - -- const isFixedClass = theme.nav.fixed ? ' fixed' : '' - -header#page-header(class=`${isHomeClass+isFixedClass}` style=bg_img) - !=partial('includes/header/nav', {}, {cache: true}) - if top_img !== false - if is_post() - include ./post-info.pug - else if is_home() - #site-info - h1#site-title=site_title - if theme.subtitle.enable - - var loadSubJs = true - #site-subtitle - span#subtitle - if(theme.social) - #site_social_icons - !=partial('includes/header/social', {}, {cache: true}) - #scroll-down - i.fas.fa-angle-down.scroll-down-effects - else - #page-site-info - h1#site-title=site_title \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/header/menu_item.pug b/node_modules/hexo-theme-butterfly/layout/includes/header/menu_item.pug deleted file mode 100644 index 3351ef97..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/header/menu_item.pug +++ /dev/null @@ -1,27 +0,0 @@ -if theme.menu - .menus_items - each value, label in theme.menu - if typeof value !== 'object' - .menus_item - - const valueArray = value.split('||') - a.site-page(href=url_for(trim(valueArray[0]))) - if valueArray[1] - i.fa-fw(class=trim(valueArray[1])) - span=' '+label - else - .menus_item - - const labelArray = label.split('||') - - const hideClass = labelArray[2] && trim(labelArray[2]) === 'hide' ? 'hide' : '' - a.site-page.group(class=`${hideClass}` href='javascript:void(0);') - if labelArray[1] - i.fa-fw(class=trim(labelArray[1])) - span=' '+ trim(labelArray[0]) - i.fas.fa-chevron-down - ul.menus_item_child - each val,lab in value - - const valArray = val.split('||') - li - a.site-page.child(href=url_for(trim(valArray[0]))) - if valArray[1] - i.fa-fw(class=trim(valArray[1])) - span=' '+ lab \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/header/nav.pug b/node_modules/hexo-theme-butterfly/layout/includes/header/nav.pug deleted file mode 100644 index a305d52f..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/header/nav.pug +++ /dev/null @@ -1,21 +0,0 @@ -nav#nav - span#blog-info - a(href=url_for('/') title=config.title) - if theme.nav.logo - img.site-icon(src=url_for(theme.nav.logo)) - if theme.nav.display_title - span.site-name=config.title - - #menus - if (theme.algolia_search.enable || theme.local_search.enable || theme.docsearch.enable) - #search-button - a.site-page.social-icon.search(href="javascript:void(0);") - i.fas.fa-search.fa-fw - span=' '+_p('search.title') - !=partial('includes/header/menu_item', {}, {cache: true}) - - #toggle-menu - a.site-page(href="javascript:void(0);") - i.fas.fa-bars.fa-fw - - diff --git a/node_modules/hexo-theme-butterfly/layout/includes/header/post-info.pug b/node_modules/hexo-theme-butterfly/layout/includes/header/post-info.pug deleted file mode 100644 index 620b639b..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/header/post-info.pug +++ /dev/null @@ -1,146 +0,0 @@ -- let comments = theme.comments -#post-info - h1.post-title= page.title || _p('no_title') - if theme.post_edit.enable - a.post-edit-link(href=theme.post_edit.url + page.source title=_p('post.edit') target="_blank") - i.fas.fa-pencil-alt - - #post-meta - .meta-firstline - if (theme.post_meta.post.date_type) - span.post-meta-date - if (theme.post_meta.post.date_type === 'both') - i.far.fa-calendar-alt.fa-fw.post-meta-icon - span.post-meta-label= _p('post.created') - time.post-meta-date-created(datetime=date_xml(page.date) title=_p('post.created') + ' ' + full_date(page.date))=date(page.date, config.date_format) - span.post-meta-separator | - i.fas.fa-history.fa-fw.post-meta-icon - span.post-meta-label= _p('post.updated') - time.post-meta-date-updated(datetime=date_xml(page.updated) title=_p('post.updated') + ' ' + full_date(page.updated))=date(page.updated, config.date_format) - else - - let data_type_update = theme.post_meta.post.date_type === 'updated' - - let date_type = data_type_update ? 'updated' : 'date' - - let date_icon = data_type_update ? 'fas fa-history' :'far fa-calendar-alt' - - let date_title = data_type_update ? _p('post.updated') : _p('post.created') - i.fa-fw.post-meta-icon(class=date_icon) - span.post-meta-label= date_title - time(datetime=date_xml(page[date_type]) title=date_title + ' ' + full_date(page[date_type]))=date(page[date_type], config.date_format) - if (theme.post_meta.post.categories && page.categories.data.length > 0) - span.post-meta-categories - if (theme.post_meta.post.date_type) - span.post-meta-separator | - - each item, index in page.categories.data - i.fas.fa-inbox.fa-fw.post-meta-icon - a(href=url_for(item.path)).post-meta-categories #[=item.name] - if (index < page.categories.data.length - 1) - i.fas.fa-angle-right.post-meta-separator - - .meta-secondline - - let postWordcount = theme.wordcount.enable && (theme.wordcount.post_wordcount || theme.wordcount.min2read) - if (postWordcount) - span.post-meta-separator | - span.post-meta-wordcount - if theme.wordcount.post_wordcount - i.far.fa-file-word.fa-fw.post-meta-icon - span.post-meta-label= _p('post.wordcount') + ':' - span.word-count= wordcount(page.content) - if theme.wordcount.min2read - span.post-meta-separator | - if theme.wordcount.min2read - i.far.fa-clock.fa-fw.post-meta-icon - span.post-meta-label= _p('post.min2read') + ':' - span= min2read(page.content, {cn: 350, en: 160}) + _p('post.min2read_unit') - - //- for pv and count - mixin pvBlock(parent_id,parent_class,parent_title) - span.post-meta-separator | - span(class=parent_class id=parent_id data-flag-title=page.title) - i.far.fa-eye.fa-fw.post-meta-icon - span.post-meta-label=_p('post.page_pv') + ':' - if block - block - - - const commentUse = comments.use - if page.comments !== false && commentUse && !comments.lazyload - if commentUse[0] === 'Valine' && theme.valine.visitor - +pvBlock(url_for(page.path),'leancloud_visitors',page.title) - span.leancloud-visitors-count - i.fa-solid.fa-spinner.fa-spin - else if commentUse[0] === 'Waline' && theme.waline.pageview - +pvBlock('','','') - span.waline-pageview-count(data-path=url_for(page.path)) - i.fa-solid.fa-spinner.fa-spin - else if commentUse[0] === 'Twikoo' && theme.twikoo.visitor - +pvBlock('','','') - span#twikoo_visitors - i.fa-solid.fa-spinner.fa-spin - else if commentUse[0] === 'Artalk' && theme.artalk.visitor - +pvBlock('','','') - span#ArtalkPV - i.fa-solid.fa-spinner.fa-spin - else if theme.busuanzi.page_pv - +pvBlock('','post-meta-pv-cv','') - span#busuanzi_value_page_pv - i.fa-solid.fa-spinner.fa-spin - else if theme.busuanzi.page_pv - +pvBlock('','post-meta-pv-cv','') - span#busuanzi_value_page_pv - i.fa-solid.fa-spinner.fa-spin - - if comments.count && !comments.lazyload && page.comments !== false && comments.use - - var whichCount = comments.use[0] - - mixin countBlock - span.post-meta-separator | - span.post-meta-commentcount - i.far.fa-comments.fa-fw.post-meta-icon - span.post-meta-label= _p('post.comments') + ':' - if block - block - - case whichCount - when 'Disqus' - +countBlock - span.disqus-comment-count - a(href=full_url_for(page.path) + '#disqus_thread') - i.fa-solid.fa-spinner.fa-spin - when 'Disqusjs' - +countBlock - a(href=full_url_for(page.path) + '#disqusjs') - span.disqus-comment-count(data-disqus-url=full_url_for(page.path)) - i.fa-solid.fa-spinner.fa-spin - when 'Valine' - +countBlock - a(href=url_for(page.path) + '#post-comment' itemprop="discussionUrl") - span.valine-comment-count(data-xid=url_for(page.path) itemprop="commentCount") - i.fa-solid.fa-spinner.fa-spin - when 'Waline' - +countBlock - a(href=url_for(page.path) + '#post-comment') - span.waline-comment-count(data-path=url_for(page.path)) - i.fa-solid.fa-spinner.fa-spin - when 'Gitalk' - +countBlock - a(href=url_for(page.path) + '#post-comment') - span.gitalk-comment-count - i.fa-solid.fa-spinner.fa-spin - when 'Twikoo' - +countBlock - a(href=url_for(page.path) + '#post-comment') - span#twikoo-count - i.fa-solid.fa-spinner.fa-spin - when 'Facebook Comments' - +countBlock - a(href=url_for(page.path) + '#post-comment') - span.fb-comments-count(data-href=urlNoIndex()) - when 'Remark42' - +countBlock - a(href=url_for(page.path) + '#post-comment') - span.remark42__counter(data-url=urlNoIndex()) - i.fa-solid.fa-spinner.fa-spin - when 'Artalk' - +countBlock - a(href=url_for(page.path) + '#post-comment') - span.artalk-count - i.fa-solid.fa-spinner.fa-spin \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/header/social.pug b/node_modules/hexo-theme-butterfly/layout/includes/header/social.pug deleted file mode 100644 index 37fe5afd..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/header/social.pug +++ /dev/null @@ -1,4 +0,0 @@ -each url, icon in theme.social - a.social-icon(href=url_for(trim(url.split('||')[0])) target="_blank" - title=url.split('||')[1] === undefined ? '' : trim(url.split('||')[1])) - i(class=icon style=url.split('||')[2] === undefined ? '' : `color: ${trim(url.split('||')[2]).replace(/[\'\"]/g, '')};`) \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/layout.pug b/node_modules/hexo-theme-butterfly/layout/includes/layout.pug deleted file mode 100644 index 22e8bccc..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/layout.pug +++ /dev/null @@ -1,47 +0,0 @@ -- var htmlClassHideAside = theme.aside.enable && theme.aside.hide ? 'hide-aside' : '' -- page.aside = is_archive() ? theme.aside.display.archive: is_category() ? theme.aside.display.category : is_tag() ? theme.aside.display.tag : page.aside -- var hideAside = !theme.aside.enable || page.aside === false ? 'hide-aside' : '' -- var pageType = is_post() ? 'post' : 'page' - -doctype html -html(lang=config.language data-theme=theme.display_mode class=htmlClassHideAside) - head - include ./head.pug - body - if theme.preloader.enable - !=partial('includes/loading/index', {}, {cache: true}) - - if theme.background - #web_bg - - !=partial('includes/sidebar', {}, {cache: true}) - - if page.type !== '404' - #body-wrap(class=pageType) - include ./header/index.pug - - main#content-inner.layout(class=hideAside) - if body - div!= body - else - block content - if theme.aside.enable && page.aside !== false - include widget/index.pug - - - var footerBg = theme.footer_bg - if (footerBg) - if (footerBg === true) - - var footer_bg = bg_img - else - - var footer_bg = isImgOrUrl(theme.footer_bg) ? `background-image: url('${url_for(footerBg)}')` : `background: ${footerBg}` - else - - var footer_bg = '' - - footer#footer(style=footer_bg) - !=partial('includes/footer', {}, {cache: true}) - - else - include ./404.pug - - include ./rightside.pug - include ./additional-js.pug \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/loading/fullpage-loading.pug b/node_modules/hexo-theme-butterfly/layout/includes/loading/fullpage-loading.pug deleted file mode 100644 index a3f6651f..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/loading/fullpage-loading.pug +++ /dev/null @@ -1,33 +0,0 @@ -#loading-box - .loading-left-bg - .loading-right-bg - .spinner-box - .configure-border-1 - .configure-core - .configure-border-2 - .configure-core - .loading-word= _p('loading') - -script. - (()=>{ - const $loadingBox = document.getElementById('loading-box') - const $body = document.body - const preloader = { - endLoading: () => { - $body.style.overflow = '' - $loadingBox.classList.add('loaded') - }, - initLoading: () => { - $body.style.overflow = 'hidden' - $loadingBox.classList.remove('loaded') - } - } - - preloader.initLoading() - window.addEventListener('load',() => { preloader.endLoading() }) - - if (!{theme.pjax && theme.pjax.enable}) { - document.addEventListener('pjax:send', () => { preloader.initLoading() }) - document.addEventListener('pjax:complete', () => { preloader.endLoading() }) - } - })() \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/loading/index.pug b/node_modules/hexo-theme-butterfly/layout/includes/loading/index.pug deleted file mode 100644 index 4901a3e1..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/loading/index.pug +++ /dev/null @@ -1,4 +0,0 @@ -if theme.preloader.source === 1 - include ./fullpage-loading.pug -else - include ./pace.pug \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/loading/pace.pug b/node_modules/hexo-theme-butterfly/layout/includes/loading/pace.pug deleted file mode 100644 index 4faa2dd2..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/loading/pace.pug +++ /dev/null @@ -1,11 +0,0 @@ -script. - window.paceOptions = { - restartOnPushState: false - } - - document.addEventListener('pjax:send', () => { - Pace.restart() - }) - -link(rel="stylesheet", href=url_for(theme.preloader.pace_css_url || theme.asset.pace_default_css)) -script(src=url_for(theme.asset.pace_js)) \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/mixins/article-sort.pug b/node_modules/hexo-theme-butterfly/layout/includes/mixins/article-sort.pug deleted file mode 100644 index 5a32528b..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/mixins/article-sort.pug +++ /dev/null @@ -1,23 +0,0 @@ -mixin articleSort(posts) - .article-sort - - var year - - posts.each(function (article) { - - let tempYear = date(article.date, 'YYYY') - - let no_cover = article.cover === false || !theme.cover.archives_enable ? 'no-article-cover' : '' - - let title = article.title || _p('no_title') - if tempYear !== year - - year = tempYear - .article-sort-item.year= year - .article-sort-item(class=no_cover) - if article.cover && theme.cover.archives_enable - a.article-sort-item-img(href=url_for(article.path) title=title) - if article.cover_type === 'img' - img(src=url_for(article.cover) alt=title onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'`) - else - div(style=`background: ${article.cover}`) - .article-sort-item-info - .article-sort-item-time - i.far.fa-calendar-alt - time.post-meta-date-created(datetime=date_xml(article.date) title=_p('post.created') + ' ' + full_date(article.date))= date(article.date, config.date_format) - a.article-sort-item-title(href=url_for(article.path) title=title)= title - - }) \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/mixins/post-ui.pug b/node_modules/hexo-theme-butterfly/layout/includes/mixins/post-ui.pug deleted file mode 100644 index c6bca50a..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/mixins/post-ui.pug +++ /dev/null @@ -1,135 +0,0 @@ -mixin postUI(posts) - each article , index in page.posts.data - .recent-post-item - - - let link = article.link || article.path - let title = article.title || _p('no_title') - const position = theme.cover.position - let leftOrRight = position === 'both' - ? index%2 == 0 ? 'left' : 'right' - : position === 'left' ? 'left' : 'right' - let post_cover = article.cover - let no_cover = article.cover === false || !theme.cover.index_enable ? 'no-cover' : '' - - - if post_cover && theme.cover.index_enable - .post_cover(class=leftOrRight) - a(href=url_for(link) title=title) - if article.cover_type === 'img' - img.post-bg(src=url_for(post_cover) onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'` alt=title) - else - div.post-bg(style=`background: ${post_cover}`) - .recent-post-info(class=no_cover) - a.article-title(href=url_for(link) title=title)= title - .article-meta-wrap - if (is_home() && (article.top || article.sticky > 0)) - span.article-meta - i.fas.fa-thumbtack.sticky - span.sticky= _p('sticky') - span.article-meta-separator | - if (theme.post_meta.page.date_type) - span.post-meta-date - if (theme.post_meta.page.date_type === 'both') - i.far.fa-calendar-alt - span.article-meta-label=_p('post.created') - time.post-meta-date-created(datetime=date_xml(article.date) title=_p('post.created') + ' ' + full_date(article.date))=date(article.date, config.date_format) - span.article-meta-separator | - i.fas.fa-history - span.article-meta-label=_p('post.updated') - time.post-meta-date-updated(datetime=date_xml(article.updated) title=_p('post.updated') + ' ' + full_date(article.updated))=date(article.updated, config.date_format) - else - - let data_type_updated = theme.post_meta.page.date_type === 'updated' - - let date_type = data_type_updated ? 'updated' : 'date' - - let date_icon = data_type_updated ? 'fas fa-history' :'far fa-calendar-alt' - - let date_title = data_type_updated ? _p('post.updated') : _p('post.created') - i(class=date_icon) - span.article-meta-label=date_title - time(datetime=date_xml(article[date_type]) title=date_title + ' ' + full_date(article[date_type]))=date(article[date_type], config.date_format) - if (theme.post_meta.page.categories && article.categories.data.length > 0) - span.article-meta - span.article-meta-separator | - i.fas.fa-inbox - each item, index in article.categories.data - a(href=url_for(item.path)).article-meta__categories #[=item.name] - if (index < article.categories.data.length - 1) - i.fas.fa-angle-right.article-meta-link - if (theme.post_meta.page.tags && article.tags.data.length > 0) - span.article-meta.tags - span.article-meta-separator | - i.fas.fa-tag - each item, index in article.tags.data - a(href=url_for(item.path)).article-meta__tags #[=item.name] - if (index < article.tags.data.length - 1) - span.article-meta-link #[='•'] - - mixin countBlockInIndex - - needLoadCountJs = true - span.article-meta - span.article-meta-separator | - i.fas.fa-comments - if block - block - span.article-meta-label= ' ' + _p('card_post_count') - - if theme.comments.card_post_count && theme.comments.use - case theme.comments.use[0] - when 'Disqus' - +countBlockInIndex - a(href=full_url_for(link) + '#disqus_thread') - i.fa-solid.fa-spinner.fa-spin - when 'Disqusjs' - +countBlockInIndex - a(href=full_url_for(link) + '#disqusjs') - span.disqus-comment-count(data-disqus-url=full_url_for(link)) - i.fa-solid.fa-spinner.fa-spin - when 'Valine' - +countBlockInIndex - a(href=url_for(link) + '#post-comment') - span.valine-comment-count(data-xid=url_for(link)) - i.fa-solid.fa-spinner.fa-spin - when 'Waline' - +countBlockInIndex - a(href=url_for(link) + '#post-comment') - span.waline-comment-count(data-path=url_for(link)) - i.fa-solid.fa-spinner.fa-spin - when 'Twikoo' - +countBlockInIndex - a.twikoo-count(href=url_for(link) + '#post-comment') - i.fa-solid.fa-spinner.fa-spin - when 'Facebook Comments' - +countBlockInIndex - a(href=url_for(link) + '#post-comment') - span.fb-comments-count(data-href=urlNoIndex(article.permalink)) - when 'Remark42' - +countBlockInIndex - a(href=url_for(link) + '#post-comment') - span.remark42__counter(data-url=urlNoIndex(article.permalink)) - i.fa-solid.fa-spinner.fa-spin - when 'Artalk' - +countBlockInIndex - a(href=url_for(link) + '#post-comment') - span.artalk-count(data-page-key=url_for(link)) - i.fa-solid.fa-spinner.fa-spin - - //- Display the article introduction on homepage - case theme.index_post_content.method - when false - - break - when 1 - .content!= article.description - when 2 - if article.description - .content!= article.description - else - - const content = strip_html(article.content) - - let expert = content.substring(0, theme.index_post_content.length) - - content.length > theme.index_post_content.length ? expert += ' ...' : '' - .content!= expert - default - - const content = strip_html(article.content) - - let expert = content.substring(0, theme.index_post_content.length) - - content.length > theme.index_post_content.length ? expert += ' ...' : '' - .content!= expert - - if theme.ad && theme.ad.index - if (index + 1) % 3 == 0 - .recent-post-item.ads-wrap!=theme.ad.index diff --git a/node_modules/hexo-theme-butterfly/layout/includes/page/categories.pug b/node_modules/hexo-theme-butterfly/layout/includes/page/categories.pug deleted file mode 100644 index 79153c8d..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/page/categories.pug +++ /dev/null @@ -1 +0,0 @@ -.category-lists!= list_categories() \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/page/default-page.pug b/node_modules/hexo-theme-butterfly/layout/includes/page/default-page.pug deleted file mode 100644 index 29b8850f..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/page/default-page.pug +++ /dev/null @@ -1,2 +0,0 @@ -#article-container - != page.content \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/page/flink.pug b/node_modules/hexo-theme-butterfly/layout/includes/page/flink.pug deleted file mode 100644 index 51c51ed9..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/page/flink.pug +++ /dev/null @@ -1,82 +0,0 @@ -#article-container - .flink - - let { content, random, flink_url } = page - - let pageContent = content - - if flink_url || random - - const linkData = flink_url ? false : site.data.link || false - script. - (()=>{ - const replaceSymbol = (str) => { - return str.replace(/[\p{P}\p{S}]/gu, "-") - } - - let result = "" - const add = (str) => { - for(let i = 0; i < str.length; i++){ - const replaceClassName = replaceSymbol(str[i].class_name) - const className = str[i].class_name ? `

${str[i].class_name}

` : "" - const classDesc = str[i].class_desc ? `` : "" - - let listResult = "" - const lists = str[i].link_list - if (!{random === true}) { - lists.sort(() => Math.random() - 0.5) - } - for(let j = 0; j < lists.length; j++){ - listResult += ` - ` - } - - result += `${className}${classDesc} ` - } - - document.querySelector(".flink").insertAdjacentHTML("afterbegin", result) - window.lazyLoadInstance && window.lazyLoadInstance.update() - } - - const linkData = !{JSON.stringify(linkData)} - if (!{Boolean(flink_url)}) { - fetch("!{url_for(flink_url)}") - .then(response => response.json()) - .then(add) - } else if (linkData) { - add(linkData) - } - })() - - else - if site.data.link - - let result = "" - each i in site.data.link - - let className = i.class_name ? markdown(`## ${i.class_name}`) : "" - - let classDesc = i.class_desc ? `` : "" - - - let listResult = "" - - each j in i.link_list - - - listResult += ` - ` - - - - - result += `${className}${classDesc} ` - - - pageContent = result + pageContent - != pageContent diff --git a/node_modules/hexo-theme-butterfly/layout/includes/page/tags.pug b/node_modules/hexo-theme-butterfly/layout/includes/page/tags.pug deleted file mode 100644 index ec93bd11..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/page/tags.pug +++ /dev/null @@ -1,2 +0,0 @@ -.tag-cloud-list.is-center - !=cloudTags({source: site.tags, orderby: page.orderby || 'random', order: page.order || 1, minfontsize: 1.2, maxfontsize: 2.1, limit: 0, unit: 'em'}) \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/pagination.pug b/node_modules/hexo-theme-butterfly/layout/includes/pagination.pug deleted file mode 100644 index fbb34e7a..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/pagination.pug +++ /dev/null @@ -1,41 +0,0 @@ -- - var options = { - prev_text: '', - next_text: '', - mid_size: 1, - escape: false - } - -if is_post() - - let prev = theme.post_pagination === 1 ? page.prev : page.next - - let next = theme.post_pagination === 1 ? page.next : page.prev - nav#pagination.pagination-post - if(prev) - - var hasPageNext = next ? 'pull-left' : 'pull-full' - .prev-post(class=hasPageNext) - a(href=url_for(prev.path) title=prev.title) - if prev.cover_type === 'img' - img.cover(src=url_for(prev.cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` alt='cover of previous post') - else - .cover(style=`background: ${prev.cover || 'var(--default-bg-color)'}`) - .pagination-info - .label=_p('pagination.prev') - .prev_info=prev.title - - if(next) - - var hasPagePrev = prev ? 'pull-right' : 'pull-full' - .next-post(class=hasPagePrev) - a(href=url_for(next.path) title=next.title) - if next.cover_type === 'img' - img.cover(src=url_for(next.cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` alt='cover of next post') - else - .cover(style=`background: ${next.cover || 'var(--default-bg-color)'}`) - .pagination-info - .label=_p('pagination.next') - .next_info=next.title -else - nav#pagination - .pagination - if is_home() - - options.format = 'page/%d/#content-inner' - !=paginator(options) \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/post/post-copyright.pug b/node_modules/hexo-theme-butterfly/layout/includes/post/post-copyright.pug deleted file mode 100644 index 393107f9..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/post/post-copyright.pug +++ /dev/null @@ -1,17 +0,0 @@ -if theme.post_copyright.enable && page.copyright !== false - - let author = page.copyright_author || config.author - - let authorHref = page.copyright_author_href || theme.post_copyright.author_href || config.url - - let url = page.copyright_url || page.permalink - - let info = page.copyright_info || _p('post.copyright.copyright_content', theme.post_copyright.license_url, theme.post_copyright.license, config.url, config.title) - .post-copyright - .post-copyright__author - span.post-copyright-meta= _p('post.copyright.author') + ": " - span.post-copyright-info - a(href=authorHref)=author - .post-copyright__type - span.post-copyright-meta= _p('post.copyright.link') + ": " - span.post-copyright-info - a(href=url_for(url))= theme.post_copyright.decode ? decodeURI(url) : url - .post-copyright__notice - span.post-copyright-meta= _p('post.copyright.copyright_notice') + ": " - span.post-copyright-info!= info diff --git a/node_modules/hexo-theme-butterfly/layout/includes/post/reward.pug b/node_modules/hexo-theme-butterfly/layout/includes/post/reward.pug deleted file mode 100644 index 3520b706..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/post/reward.pug +++ /dev/null @@ -1,13 +0,0 @@ -.post-reward - .reward-button - i.fas.fa-qrcode - = ' ' + _p('donate') - .reward-main - ul.reward-all - each item in theme.reward.QR_code - - var clickTo = item.link ? item.link : item.img - li.reward-item - a(href=url_for(clickTo) target='_blank') - img.post-qr-code-img(src=url_for(item.img) alt=item.text) - .post-qr-code-desc=item.text - diff --git a/node_modules/hexo-theme-butterfly/layout/includes/rightside.pug b/node_modules/hexo-theme-butterfly/layout/includes/rightside.pug deleted file mode 100644 index adb89402..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/rightside.pug +++ /dev/null @@ -1,61 +0,0 @@ -- const { readmode, translate, darkmode, aside, chat_btn } = theme -mixin rightsideItem(array) - each item in array - case item - when 'readmode' - if is_post() && readmode - button#readmode(type="button" title=_p('rightside.readmode_title')) - i.fas.fa-book-open - when 'translate' - if translate.enable - button#translateLink(type="button" title=_p('rightside.translate_title'))= translate.default - when 'darkmode' - if darkmode.enable && darkmode.button - button#darkmode(type="button" title=_p('rightside.night_mode_title')) - i.fas.fa-adjust - when 'hideAside' - if aside.enable && aside.button && page.aside !== false - button#hide-aside-btn(type="button" title=_p('rightside.aside')) - i.fas.fa-arrows-alt-h - when 'toc' - if showToc - button#mobile-toc-button.close(type="button" title=_p("rightside.toc")) - i.fas.fa-list-ul - when 'chat' - if chat_btn - button#chat-btn(type="button" title=_p("rightside.chat")) - i.fas.fa-sms - when 'comment' - if commentsJsLoad - a#to_comment(href="#post-comment" title=_p("rightside.scroll_to_comment")) - i.fas.fa-comments - -#rightside - - const { enable, hide, show } = theme.rightside_item_order - - const hideArray = enable ? hide && hide.split(',') : ['readmode','translate','darkmode','hideAside'] - - const showArray = enable ? show && show.split(',') : ['toc','chat','comment'] - - - #rightside-config-hide - if hideArray - +rightsideItem(hideArray) - #rightside-config-show - if enable - if hide - button#rightside_config(type="button" title=_p("rightside.setting")) - i.fas.fa-cog.fa-spin - else - if is_post() - if (readmode || translate.enable || (darkmode.enable && darkmode.button)) - button#rightside_config(type="button" title=_p("rightside.setting")) - i.fas.fa-cog.fa-spin - else if translate.enable || (darkmode.enable && darkmode.button) - button#rightside_config(type="button" title=_p("rightside.setting")) - i.fas.fa-cog.fa-spin - - if showArray - +rightsideItem(showArray) - - button#go-up(type="button" title=_p("rightside.back_to_top")) - span.scroll-percent - i.fas.fa-arrow-up \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/sidebar.pug b/node_modules/hexo-theme-butterfly/layout/includes/sidebar.pug deleted file mode 100644 index 23811430..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/sidebar.pug +++ /dev/null @@ -1,18 +0,0 @@ -#sidebar - #menu-mask - #sidebar-menus - .avatar-img.is-center - img(src=url_for(theme.avatar.img) onerror=`onerror=null;src='${theme.error_img.flink}'` alt="avatar") - .sidebar-site-data.site-data.is-center - a(href=url_for(config.archive_dir) + '/') - .headline= _p('aside.articles') - .length-num= site.posts.length - a(href=url_for(config.tag_dir) + '/' ) - .headline= _p('aside.tags') - .length-num= site.tags.length - a(href=url_for(config.category_dir) + '/') - .headline= _p('aside.categories') - .length-num= site.categories.length - - hr.custom-hr - !=partial('includes/header/menu_item', {}, {cache: true}) diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/abcjs/abcjs.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/abcjs/abcjs.pug deleted file mode 100644 index 35900f17..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/abcjs/abcjs.pug +++ /dev/null @@ -1,15 +0,0 @@ -script. - (() => { - function abcjsInit() { - function abcjsFn() { - for (let abcContainer of document.getElementsByClassName("abc-music-sheet")) { - ABCJS.renderAbc(abcContainer, abcContainer.innerHTML, {responsive: 'resize'}) - } - } - - typeof ABCJS === 'object' ? abcjsFn() - : getScript('!{url_for(theme.asset.abcjs_basic_js)}').then(abcjsFn) - } - - window.pjax ? abcjsInit() : document.addEventListener('DOMContentLoaded', abcjsInit) - })() \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/abcjs/index.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/abcjs/index.pug deleted file mode 100644 index 2683faac..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/abcjs/index.pug +++ /dev/null @@ -1,6 +0,0 @@ -if theme.abcjs && theme.abcjs.enable - if theme.abcjs.per_page - if is_post() || is_page() - include ./abcjs.pug - else if page.abcjs - include ./abcjs.pug diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/aplayer.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/aplayer.pug deleted file mode 100644 index 3a3f3ffd..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/aplayer.pug +++ /dev/null @@ -1,3 +0,0 @@ -link(rel='stylesheet' href=url_for(theme.asset.aplayer_css) media="print" onload="this.media='all'") -script(src=url_for(theme.asset.aplayer_js)) -script(src=url_for(theme.asset.meting_js)) \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/artalk.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/artalk.pug deleted file mode 100644 index da23da0e..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/artalk.pug +++ /dev/null @@ -1,35 +0,0 @@ -- const { server, site } = theme.artalk - -script. - (() => { - const getArtalkCount = async() => { - try { - const eleGroup = document.querySelectorAll('#recent-posts .artalk-count') - const keyArray = Array.from(eleGroup).map(i => i.getAttribute('data-page-key')) - - const headerList = { - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'Origin': window.location.origin - }, - body: new URLSearchParams({ - 'site_name': '!{site}', - 'type':'page_comment', - 'page_keys': keyArray - }) - } - - const res = await fetch('!{server}/api/stat', headerList) - const result = await res.json() - - keyArray.forEach((key, index) => { - eleGroup[index].textContent = result.data[key] || 0 - }) - } catch (err) { - console.error(err) - } - } - - window.pjax ? getArtalkCount() : window.addEventListener('load', getArtalkCount) - })() \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/disqus.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/disqus.pug deleted file mode 100644 index 72ee553e..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/disqus.pug +++ /dev/null @@ -1,16 +0,0 @@ -script. - (() => { - const getCount = () => { - if (window.DISQUSWIDGETS === undefined) { - var d = document, s = d.createElement('script'); - s.src = 'https://!{theme.disqus.shortname}.disqus.com/count.js'; - s.id = 'dsq-count-scr'; - (d.head || d.body).appendChild(s); - } else { - DISQUSWIDGETS.getCount({reset: true}); - } - } - - window.pjax ? getCount() : window.addEventListener('load', getCount) - - })() diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/fb.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/fb.pug deleted file mode 100644 index 31fedc8c..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/fb.pug +++ /dev/null @@ -1,18 +0,0 @@ -- const fbSDKVer = 'v16.0' -- const fbSDK = theme.messenger.enable ? `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk/xfbml.customerchat.js#xfbml=1&version=${fbSDKVer}` : `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk.js#xfbml=1&version=${fbSDKVer}` - -script. - (()=>{ - function loadFBComment () { - if (typeof FB === 'object') FB.XFBML.parse(document.getElementById('recent-posts')) - else { - let ele = document.createElement('script') - ele.setAttribute('src','!{fbSDK}') - ele.setAttribute('async', 'true') - ele.setAttribute('defer', 'true') - ele.setAttribute('crossorigin', 'anonymous') - document.body.appendChild(ele) - } - } - window.pjax ? loadFBComment() : window.addEventListener('load', loadFBComment) - })() diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/index.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/index.pug deleted file mode 100644 index 00793189..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/index.pug +++ /dev/null @@ -1,16 +0,0 @@ -case theme.comments.use[0] - when 'Twikoo' - include ./twikoo.pug - when 'Disqus' - when 'Disqusjs' - include ./disqus.pug - when 'Valine' - include ./valine.pug - when 'Waline' - include ./waline.pug - when 'Facebook Comments' - include ./fb.pug - when 'Remark42' - include ./remark42.pug - when 'Artalk' - include ./artalk.pug \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/remark42.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/remark42.pug deleted file mode 100644 index 5fbb8405..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/remark42.pug +++ /dev/null @@ -1,18 +0,0 @@ -- const { host, siteId, option } = theme.remark42 - -script. - (()=>{ - window.remark_config = Object.assign({ - host: '!{host}', - site_id: '!{siteId}', - },!{JSON.stringify(option)}) - - function getCount () { - const s = document.createElement('script') - s.src = remark_config.host + '/web/counter.js' - s.defer = true - document.head.appendChild(s) - } - - window.pjax ? getCount() : window.addEventListener('load', getCount) - })() \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/twikoo.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/twikoo.pug deleted file mode 100644 index 4a24d579..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/twikoo.pug +++ /dev/null @@ -1,37 +0,0 @@ -script. - (() => { - const getCommentUrl = () => { - const eleGroup = document.querySelectorAll('#recent-posts .article-title') - let urlArray = [] - eleGroup.forEach(i=>{ - urlArray.push(i.getAttribute('href')) - }) - return urlArray - } - - const getCount = () => { - const runTwikoo = () => { - twikoo.getCommentsCount({ - envId: '!{theme.twikoo.envId}', - region: '!{theme.twikoo.region}', - urls: getCommentUrl(), - includeReply: false - }).then(function (res) { - document.querySelectorAll('#recent-posts .twikoo-count').forEach((item,index) => { - item.textContent = res[index].count - }) - }).catch(function (err) { - console.log(err) - }) - } - - if (typeof twikoo === 'object') { - runTwikoo() - } else { - getScript('!{url_for(theme.asset.twikoo)}').then(runTwikoo) - } - } - - window.pjax ? getCount() : window.addEventListener('load', getCount) - - })() \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/valine.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/valine.pug deleted file mode 100644 index 0d95697b..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/valine.pug +++ /dev/null @@ -1,20 +0,0 @@ -script. - (() => { - function loadValine () { - function initValine () { - let initData = { - el: '#vcomment', - appId: '#{theme.valine.appId}', - appKey: '#{theme.valine.appKey}', - serverURLs: '#{theme.valine.serverURLs}' - } - - const valine = new Valine(initData) - } - - if (typeof Valine === 'function') initValine() - else getScript('!{url_for(theme.asset.valine)}').then(initValine) - } - - window.pjax ? loadValine() : window.addEventListener('load', loadValine) - })() diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/waline.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/waline.pug deleted file mode 100644 index f76aa1be..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/card-post-count/waline.pug +++ /dev/null @@ -1,20 +0,0 @@ -script. - (() => { - async function loadWaline () { - try { - const eleGroup = document.querySelectorAll('#recent-posts .waline-comment-count') - const keyArray = Array.from(eleGroup).map(i => i.getAttribute('data-path')) - - const res = await fetch(`!{theme.waline.serverURL}/api/comment?type=count&url=${keyArray}`, { method: 'GET' }) - const result = await res.json() - - result.data.forEach((count, index) => { - eleGroup[index].textContent = count - }) - } catch (err) { - console.error(err) - } - } - - window.pjax ? loadWaline() : window.addEventListener('load', loadWaline) - })() diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/chat/chatra.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/chat/chatra.pug deleted file mode 100644 index 37582713..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/chat/chatra.pug +++ /dev/null @@ -1,50 +0,0 @@ -//- https://chatra.io/help/api/ -script. - (() => { - const isChatBtn = !{theme.chat_btn} - const isChatHideShow = !{theme.chat_hide_show} - - if (isChatBtn) { - const close = () => { - Chatra('minimizeWidget') - Chatra('hide') - } - - const open = () => { - Chatra('openChat', true) - Chatra('show') - } - - window.ChatraSetup = { - startHidden: true - } - - window.chatBtnFn = () => { - const isShow = document.getElementById('chatra').classList.contains('chatra--expanded') - isShow ? close() : open() - } - } else if (isChatHideShow) { - window.chatBtn = { - hide: () => { - Chatra('hide') - }, - show: () => { - Chatra('show') - } - } - } - - (function(d, w, c) { - w.ChatraID = '#{theme.chatra.id}' - var s = d.createElement('script') - w[c] = w[c] || function() { - (w[c].q = w[c].q || []).push(arguments) - } - s.async = true - s.src = 'https://call.chatra.io/chatra.js' - if (d.head) d.head.appendChild(s) - })(document, window, 'Chatra') - - })() - - diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/chat/crisp.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/chat/crisp.pug deleted file mode 100644 index 728589dd..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/chat/crisp.pug +++ /dev/null @@ -1,45 +0,0 @@ -script. - (() => { - window.$crisp = []; - window.CRISP_WEBSITE_ID = "!{theme.crisp.website_id}"; - (function () { - d = document; - s = d.createElement("script"); - s.src = "https://client.crisp.chat/l.js"; - s.async = 1; - d.getElementsByTagName("head")[0].appendChild(s); - })(); - $crisp.push(["safe", true]) - - const isChatBtn = !{theme.chat_btn} - const isChatHideShow = !{theme.chat_hide_show} - - if (isChatBtn) { - const open = () => { - $crisp.push(["do", "chat:show"]) - $crisp.push(["do", "chat:open"]) - } - - const close = () => { - $crisp.push(["do", "chat:hide"]) - } - - close() - $crisp.push(["on", "chat:closed", function() { - close() - }]) - - window.chatBtnFn = () => { - $crisp.is("chat:visible") ? close() : open() - } - } else if (isChatHideShow) { - window.chatBtn = { - hide: () => { - $crisp.push(["do", "chat:hide"]) - }, - show: () => { - $crisp.push(["do", "chat:show"]) - } - } - } - })() \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/chat/daovoice.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/chat/daovoice.pug deleted file mode 100644 index 66fc6956..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/chat/daovoice.pug +++ /dev/null @@ -1,40 +0,0 @@ -//- https://guide.daocloud.io/daovoice/javascript-api-5869833.html -script. - (() => { - (function(i,s,o,g,r,a,m){i["DaoVoiceObject"]=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;a.charset="utf-8";m.parentNode.insertBefore(a,m)})(window,document,"script",('https:' == document.location.protocol ? 'https:' : 'http:') + "//widget.daovoice.io/widget/!{theme.daovoice.app_id}.js","daovoice") - - const isChatBtn = !{theme.chat_btn} - const isChatHideShow = !{theme.chat_hide_show} - - daovoice('init', { - app_id: '!{theme.daovoice.app_id}',},{ - launcher: { - disableLauncherIcon: isChatBtn - }, - }); - daovoice('update'); - - if (isChatBtn) { - window.chatBtnFn = () => { - const isShow = document.getElementById('daodream-messenger').classList.contains('daodream-messenger-active') - isShow ? daovoice('hide') : daovoice('show') - } - } else if (isChatHideShow) { - window.chatBtn = { - hide: () => { - daovoice('update', {},{ - launcher: { - disableLauncherIcon: true - } - }) - }, - show: () => { - daovoice('update', {}, { - launcher: { - disableLauncherIcon: false - } - }) - } - } - } - })() \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/chat/index.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/chat/index.pug deleted file mode 100644 index 40eef839..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/chat/index.pug +++ /dev/null @@ -1,10 +0,0 @@ -if theme.chatra && theme.chatra.enable - include ./chatra.pug -else if theme.tidio && theme.tidio.enable - include ./tidio.pug -else if theme.daovoice && theme.daovoice.enable - include ./daovoice.pug -else if theme.crisp && theme.crisp.enable - include ./crisp.pug -else if theme.messenger && theme.messenger.enable - include ./messenger.pug \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/chat/messenger.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/chat/messenger.pug deleted file mode 100644 index 97e842a1..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/chat/messenger.pug +++ /dev/null @@ -1,44 +0,0 @@ -- let { pageID, lang } = theme.messenger -- lang = theme.comments.use && theme.comments.use.includes('Facebook Comments') ? theme.facebook_comments.lang : lang - -#fb-customer-chat.fb-customerchat(page_id=pageID attribution='biz_inbox') - -script. - (() => { - document.getElementById('fb-root') ? '' : document.body.insertAdjacentHTML('afterend', '
') - - window.fbAsyncInit = function() { - FB.init({ - xfbml: true, - version: 'v16.0' - }); - }; - - (function(d, s, id) { - var js, fjs = d.getElementsByTagName(s)[0]; - if (d.getElementById(id)) return; - js = d.createElement(s); js.id = id; - js.src = 'https://connect.facebook.net/!{lang}/sdk/xfbml.customerchat.js'; - fjs.parentNode.insertBefore(js, fjs); - }(document, 'script', 'facebook-jssdk')); - - const isChatBtn = !{theme.chat_btn} - const isChatHideShow = !{theme.chat_hide_show} - - if (isChatBtn) { - window.chatBtnFn = () => { - const isShow = document.querySelector('.fb_customer_chat_bounce_in_v2') - isShow ? FB.CustomerChat.hide() : FB.CustomerChat.show() - } - } else if (isChatHideShow) { - window.chatBtn = { - hide: () => { - FB.CustomerChat.hide() - }, - show: () => { - FB.CustomerChat.show(false) - } - } - } - })() - diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/chat/tidio.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/chat/tidio.pug deleted file mode 100644 index e85ddae4..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/chat/tidio.pug +++ /dev/null @@ -1,45 +0,0 @@ -script(src=`//code.tidio.co/${theme.tidio.public_key}.js` async) -script. - (() => { - const isChatBtn = !{theme.chat_btn} - const isChatHideShow = !{theme.chat_hide_show} - - if (isChatBtn) { - let isShow = false - const close = () => { - window.tidioChatApi.hide() - isShow = false - } - - const open = () => { - window.tidioChatApi.open() - window.tidioChatApi.show() - isShow = true - } - - const onTidioChatApiReady = () => { - window.tidioChatApi.hide() - window.tidioChatApi.on("close", close) - } - if (window.tidioChatApi) { - window.tidioChatApi.on("ready", onTidioChatApiReady) - } else { - document.addEventListener("tidioChat-ready", onTidioChatApiReady) - } - - window.chatBtnFn = () => { - if (!window.tidioChatApi) return - isShow ? close() : open() - } - } else if (isChatHideShow) { - window.chatBtn = { - hide: () => { - window.tidioChatApi && window.tidioChatApi.hide() - }, - show: () => { - window.tidioChatApi && window.tidioChatApi.show() - } - } - } - })() - diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/artalk.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/artalk.pug deleted file mode 100644 index c0f66b96..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/artalk.pug +++ /dev/null @@ -1,50 +0,0 @@ -- const { server, site, option } = theme.artalk - -script. - function loadArtalk () { - function initArtalk () { - window.artalkItem = new Artalk(Object.assign({ - el: '#artalk-wrap', - server: '!{server}', - site: '!{site}', - pageKey: location.pathname, - darkMode: document.documentElement.getAttribute('data-theme') === 'dark', - countEl: '.artalk-count' - },!{JSON.stringify(option)})) - - if (GLOBAL_CONFIG.lightbox === 'null') return - window.artalkItem.use(ctx => { - ctx.on('list-loaded', () => { - ctx.getCommentList().forEach(comment => { - const $content = comment.getRender().$content - btf.loadLightbox($content.querySelectorAll('img:not([atk-emoticon])')) - }) - }) - }) - } - - if (typeof window.artalkItem === 'object') initArtalk() - else { - getCSS('!{theme.asset.artalk_css}').then(()=>{ - getScript('!{theme.asset.artalk_js}').then(initArtalk) - }) - } - } - - function artalkChangeMode (theme) { - const artalkWrap = document.getElementById('artalk-wrap') - if (!(artalkWrap && artalkWrap.children.length)) return - const isDark = theme === 'dark' - window.artalkItem.setDarkMode(isDark) - } - - btf.addModeChange('artalk', artalkChangeMode) - - if ('!{theme.comments.use[0]}' === 'Artalk' || !!{theme.comments.lazyload}) { - if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('artalk-wrap'), loadArtalk) - else loadArtalk() - } else { - function loadOtherComment () { - loadArtalk() - } - } \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/disqus.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/disqus.pug deleted file mode 100644 index cf6cbc03..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/disqus.pug +++ /dev/null @@ -1,49 +0,0 @@ -- let disqusPageTitle = page.title.replace(/'/ig,"\\'") - -script. - function loadDisqus () { - const disqus_config = function () { - this.page.url = '!{ page.permalink }' - this.page.identifier = '!{ url_for(page.path) }' - this.page.title = '!{ disqusPageTitle }' - } - - const disqusReset = () => { - DISQUS.reset({ - reload: true, - config: disqus_config - }) - } - - btf.addModeChange('disqus', disqusReset) - - if (window.DISQUS) disqusReset() - else { - (function() { - var d = document, s = d.createElement('script'); - s.src = 'https://!{theme.disqus.shortname}.disqus.com/embed.js'; - s.setAttribute('data-timestamp', +new Date()); - (d.head || d.body).appendChild(s); - })(); - } - } - - if ('!{theme.comments.use[0]}' === 'Disqus' || !!{theme.comments.lazyload}) { - if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('disqus_thread'), loadDisqus) - else loadDisqus() - } else { - function loadOtherComment () { - loadDisqus() - } - } - -if is_post() && !theme.comments.lazyload && theme.comments.count && theme.comments.use[0] === 'Disqus' - script. - if (window.DISQUSWIDGETS === undefined) { - var d = document, s = d.createElement('script'); - s.src = 'https://!{theme.disqus.shortname}.disqus.com/count.js'; - s.id = 'dsq-count-scr'; - (d.head || d.body).appendChild(s); - } else { - DISQUSWIDGETS.getCount({reset: true}); - } diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/disqusjs.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/disqusjs.pug deleted file mode 100644 index 06cff6f5..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/disqusjs.pug +++ /dev/null @@ -1,57 +0,0 @@ -- let disqusjsPageTitle = page.title.replace(/'/ig,"\\'") - -script. - function loadDisqusjs () { - function initDisqusjs () { - window.disqusjs = null - disqusjs = new DisqusJS(Object.assign({ - shortname: '!{theme.disqusjs.shortname}', - identifier: '!{ url_for(page.path) }', - url: '!{ page.permalink }', - title: '!{ disqusjsPageTitle }', - apikey: '!{theme.disqusjs.apikey}', - },!{JSON.stringify(theme.disqusjs.option)})) - - disqusjs.render(document.getElementById('disqusjs')) - } - - const themeChange = () => { - const ele = document.getElementById('disqus_thread') - if(!ele) return - disqusjs.destroy() - initDisqusjs() - } - - - btf.addModeChange('disqusjs', themeChange) - - if (window.disqusJsLoad) initDisqusjs() - else { - getCSS('!{url_for(theme.asset.disqusjs_css)}') - getScript('!{url_for(theme.asset.disqusjs)}').then(initDisqusjs) - window.disqusJsLoad = true - } - } - - if ('!{theme.comments.use[0]}' === 'Disqusjs' || !!{theme.comments.lazyload}) { - if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('disqusjs'), loadDisqusjs) - else loadDisqusjs() - } - else { - function loadOtherComment () { - loadDisqusjs() - } - } - - -if is_post() && !theme.comments.lazyload && theme.comments.count && theme.comments.use[0] === 'Disqusjs' - script. - if (window.DISQUSWIDGETS === undefined) { - var d = document, s = d.createElement('script'); - s.src = 'https://!{theme.disqus.shortname}.disqus.com/count.js'; - s.id = 'dsq-count-scr'; - (d.head || d.body).appendChild(s); - } else { - DISQUSWIDGETS.getCount({reset: true}); - } - diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/facebook_comments.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/facebook_comments.pug deleted file mode 100644 index 7c13e3ba..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/facebook_comments.pug +++ /dev/null @@ -1,46 +0,0 @@ -- const fbSDKVer = 'v16.0' -- const fbSDK = theme.messenger.enable ? `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk/xfbml.customerchat.js#xfbml=1&version=${fbSDKVer}` : `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk.js#xfbml=1&version=${fbSDKVer}` - -script. - function loadFBComment () { - document.getElementById('fb-root') ? '' : document.body.insertAdjacentHTML('afterend', '
') - - const themeNow = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light' - const $fbComment = document.getElementsByClassName('fb-comments')[0] - $fbComment.setAttribute('data-colorscheme',themeNow) - $fbComment.setAttribute('data-href', '!{urlNoIndex(page.permalink)}') - - if (typeof FB === 'object') { - FB.XFBML.parse(document.getElementsByClassName('post-meta-commentcount')[0]) - FB.XFBML.parse(document.getElementById('post-comment')) - } - else { - let ele = document.createElement('script') - ele.setAttribute('src','!{fbSDK}') - ele.setAttribute('async', 'true') - ele.setAttribute('defer', 'true') - ele.setAttribute('crossorigin', 'anonymous') - ele.setAttribute('id', 'facebook-jssdk') - document.getElementById('fb-root').insertAdjacentElement('afterbegin',ele) - } - } - - function fbModeChange (theme) { - const $fbComment = document.getElementsByClassName('fb-comments')[0] - if ($fbComment && typeof FB === 'object') { - $fbComment.setAttribute('data-colorscheme',theme) - FB.XFBML.parse(document.getElementById('post-comment')) - } - } - - btf.addModeChange('facebook_comments', fbModeChange) - - if ('!{theme.comments.use[0]}' === 'Facebook Comments' || !!{theme.comments.lazyload}) { - if (!{theme.comments.lazyload}) btf.loadComment(document.querySelector('#post-comment .fb-comments'), loadFBComment) - else loadFBComment() - } else { - function loadOtherComment () { - loadFBComment() - } - } - diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/giscus.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/giscus.pug deleted file mode 100644 index f739df89..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/giscus.pug +++ /dev/null @@ -1,53 +0,0 @@ -- const { repo, repo_id, category_id, theme:themes, option } = theme.giscus -- const giscusUrl = theme.asset.giscus || 'https://giscus.app/client.js' -- const giscusOriginUrl = new URL(giscusUrl).origin - -script. - function getGiscusTheme (theme) { - return theme === 'dark' ? '!{themes.dark}' : '!{themes.light}' - } - - function loadGiscus () { - const config = Object.assign({ - src: '!{giscusUrl}', - 'data-repo': '!{repo}', - 'data-repo-id': '!{repo_id}', - 'data-category-id': '!{category_id}', - 'data-mapping': 'pathname', - 'data-theme': getGiscusTheme(document.documentElement.getAttribute('data-theme')), - 'data-reactions-enabled': '1', - crossorigin: 'anonymous', - async: true - },!{JSON.stringify(option)}) - - let ele = document.createElement('script') - for (let key in config) { - ele.setAttribute(key, config[key]) - } - document.getElementById('giscus-wrap').insertAdjacentElement('afterbegin',ele) - } - - function changeGiscusTheme (theme) { - function sendMessage(message) { - const iframe = document.querySelector('iframe.giscus-frame') - if (!iframe) return - iframe.contentWindow.postMessage({ giscus: message }, '!{giscusOriginUrl}') - } - - sendMessage({ - setConfig: { - theme: getGiscusTheme(theme) - } - }); - } - - btf.addModeChange('giscus', changeGiscusTheme) - - if ('!{theme.comments.use[0]}' === 'Giscus' || !!{theme.comments.lazyload}) { - if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('giscus-wrap'), loadGiscus) - else loadGiscus() - } else { - function loadOtherComment () { - loadGiscus() - } - } diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/gitalk.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/gitalk.pug deleted file mode 100644 index 0f378544..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/gitalk.pug +++ /dev/null @@ -1,41 +0,0 @@ -script. - function loadGitalk () { - function initGitalk () { - var gitalk = new Gitalk(Object.assign({ - clientID: '!{theme.gitalk.client_id}', - clientSecret: '!{theme.gitalk.client_secret}', - repo: '!{theme.gitalk.repo}', - owner: '!{theme.gitalk.owner}', - admin: ['!{theme.gitalk.admin}'], - id: '!{md5(page.path)}', - updateCountCallback: commentCount - },!{JSON.stringify(theme.gitalk.option)})) - - gitalk.render('gitalk-container') - } - - if (typeof Gitalk === 'function') initGitalk() - else { - getCSS('!{url_for(theme.asset.gitalk_css)}') - getScript('!{url_for(theme.asset.gitalk)}').then(initGitalk) - } - } - - function commentCount(n){ - let isCommentCount = document.querySelector('#post-meta .gitalk-comment-count') - if (isCommentCount) { - isCommentCount.textContent= n - } - } - - if ('!{theme.comments.use[0]}' === 'Gitalk' || !!{theme.comments.lazyload}) { - if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('gitalk-container'), loadGitalk) - else loadGitalk() - } else { - function loadOtherComment () { - loadGitalk() - } - } - - - diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/index.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/index.pug deleted file mode 100644 index 2e130328..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/index.pug +++ /dev/null @@ -1,46 +0,0 @@ -- let defaultComment = theme.comments.use[0] -hr.custom-hr -#post-comment - .comment-head - .comment-headline - i.fas.fa-comments.fa-fw - span= ' ' + _p('comment') - - if theme.comments.use.length > 1 - #comment-switch - span.first-comment=defaultComment - span.switch-btn - span.second-comment=theme.comments.use[1] - - - .comment-wrap - each name in theme.comments.use - div - case name - when 'Disqus' - #disqus_thread - when 'Valine' - #vcomment.vcomment - when 'Disqusjs' - #disqusjs - when 'Livere' - #lv-container(data-id="city" data-uid=theme.livere.uid) - when 'Gitalk' - #gitalk-container - when 'Utterances' - #utterances-wrap - when 'Twikoo' - #twikoo-wrap - when 'Waline' - #waline-wrap - when 'Giscus' - #giscus-wrap - when 'Facebook Comments' - .fb-comments(data-colorscheme = theme.display_mode === 'dark' ? 'dark' : 'light' - data-numposts= theme.facebook_comments.pageSize || 10 - data-order-by= theme.facebook_comments.order_by || 'social' - data-width="100%") - when 'Remark42' - #remark42 - when 'Artalk' - #artalk-wrap diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/js.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/js.pug deleted file mode 100644 index baa62235..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/js.pug +++ /dev/null @@ -1,26 +0,0 @@ -each name in theme.comments.use - case name - when 'Valine' - !=partial('includes/third-party/comments/valine', {}, {cache: true}) - when 'Disqus' - include ./disqus.pug - when 'Disqusjs' - include ./disqusjs.pug - when 'Livere' - !=partial('includes/third-party/comments/livere', {}, {cache: true}) - when 'Gitalk' - include ./gitalk.pug - when 'Utterances' - !=partial('includes/third-party/comments/utterances', {}, {cache: true}) - when 'Twikoo' - !=partial('includes/third-party/comments/twikoo', {}, {cache: true}) - when 'Waline' - !=partial('includes/third-party/comments/waline', {}, {cache: true}) - when 'Giscus' - !=partial('includes/third-party/comments/giscus', {}, {cache: true}) - when 'Facebook Comments' - include ./facebook_comments.pug - when 'Remark42' - !=partial('includes/third-party/comments/remark42', {}, {cache: true}) - when 'Artalk' - !=partial('includes/third-party/comments/artalk', {}, {cache: true}) \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/livere.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/livere.pug deleted file mode 100644 index 45bcda43..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/livere.pug +++ /dev/null @@ -1,26 +0,0 @@ -script. - function loadLivere () { - if (typeof LivereTower === 'object') { - window.LivereTower.init() - } - else { - (function(d, s) { - var j, e = d.getElementsByTagName(s)[0]; - if (typeof LivereTower === 'function') { return; } - j = d.createElement(s); - j.src = 'https://cdn-city.livere.com/js/embed.dist.js'; - j.async = true; - e.parentNode.insertBefore(j, e); - })(document, 'script'); - } - } - - if ('!{theme.comments.use[0]}' === 'Livere' || !!{theme.comments.lazyload}) { - if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('lv-container'), loadLivere) - else loadLivere() - } - else { - function loadOtherComment () { - loadLivere() - } - } \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/remark42.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/remark42.pug deleted file mode 100644 index a95307e3..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/remark42.pug +++ /dev/null @@ -1,68 +0,0 @@ -- const { host, siteId, option } = theme.remark42 -script. - var remark_config = Object.assign({ - host: '!{host}', - site_id: '!{siteId}', - components: ['embed'], - theme: document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light' - },!{JSON.stringify(option)}) - - function addRemark42(){ - for (let i = 0; i < remark_config.components.length; i++) { - const s = document.createElement('script') - s.src = remark_config.host + '/web/' + remark_config.components[i] + '.js' - s.defer = true - document.head.appendChild(s) - } - } - - function initRemark42() { - if (window.REMARK42) { - if (this.remark42Instance) { - this.remark42Instance.destroy() - } - - this.remark42Instance = window.REMARK42.createInstance({ - ...remark_config - }) - } - } - - function getCount () { - const ele = document.querySelector('.remark42__counter') - if (ele) { - const s = document.createElement('script') - s.src = remark_config.host + '/web/counter.js' - s.defer = true - document.head.appendChild(s) - } - } - - function loadRemark42 () { - if (window.REMARK42) { - this.initRemark42() - getCount() - } else { - addRemark42() - window.addEventListener('REMARK42::ready', () => { - this.initRemark42() - getCount() - }) - } - } - - function remarkChangeMode (theme) { - if (!window.REMARK42) return - window.REMARK42.changeTheme(theme) - } - - btf.addModeChange('remark42', remarkChangeMode) - - if ('!{theme.comments.use[0]}' === 'Remark42' || !!{theme.comments.lazyload}) { - if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('remark42'), loadRemark42) - else loadRemark42() - } else { - function loadOtherComment () { - loadRemark42() - } - } diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/twikoo.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/twikoo.pug deleted file mode 100644 index 9d004776..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/twikoo.pug +++ /dev/null @@ -1,53 +0,0 @@ -- const { envId, region, option } = theme.twikoo -- const { use, lazyload, count } = theme.comments - -script. - (()=>{ - const init = () => { - twikoo.init(Object.assign({ - el: '#twikoo-wrap', - envId: '!{envId}', - region: '!{region}', - onCommentLoaded: function () { - btf.loadLightbox(document.querySelectorAll('#twikoo .tk-content img:not(.tk-owo-emotion)')) - } - }, !{JSON.stringify(option)})) - } - - const getCount = () => { - const countELement = document.getElementById('twikoo-count') - if(!countELement) return - twikoo.getCommentsCount({ - envId: '!{envId}', - region: '!{region}', - urls: [window.location.pathname], - includeReply: false - }).then(function (res) { - countELement.textContent = res[0].count - }).catch(function (err) { - console.error(err); - }); - } - - const runFn = () => { - init() - !{count ? 'GLOBAL_CONFIG_SITE.isPost && getCount()' : ''} - } - - const loadTwikoo = () => { - if (typeof twikoo === 'object') { - setTimeout(runFn,0) - return - } - getScript('!{url_for(theme.asset.twikoo)}').then(runFn) - } - - if ('!{use[0]}' === 'Twikoo' || !!{lazyload}) { - if (!{lazyload}) btf.loadComment(document.getElementById('twikoo-wrap'), loadTwikoo) - else loadTwikoo() - } else { - window.loadOtherComment = () => { - loadTwikoo() - } - } - })() \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/utterances.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/utterances.pug deleted file mode 100644 index 73b7e2a8..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/utterances.pug +++ /dev/null @@ -1,36 +0,0 @@ -script. - function loadUtterances () { - let ele = document.createElement('script') - ele.setAttribute('id', 'utterances_comment') - ele.setAttribute('src', 'https://utteranc.es/client.js') - ele.setAttribute('repo', '!{theme.utterances.repo}') - ele.setAttribute('issue-term', '!{theme.utterances.issue_term}') - let nowTheme = document.documentElement.getAttribute('data-theme') === 'dark' ? '#{theme.utterances.dark_theme}' : '#{theme.utterances.light_theme}' - ele.setAttribute('theme', nowTheme) - ele.setAttribute('crossorigin', 'anonymous') - ele.setAttribute('async', 'true') - document.getElementById('utterances-wrap').insertAdjacentElement('afterbegin',ele) - } - - function utterancesTheme (theme) { - const iframe = document.querySelector('.utterances-frame') - if (iframe) { - const theme = theme === 'dark' ? '#{theme.utterances.dark_theme}' : '#{theme.utterances.light_theme}' - const message = { - type: 'set-theme', - theme: theme - }; - iframe.contentWindow.postMessage(message, 'https://utteranc.es'); - } - } - - btf.addModeChange('utterances', utterancesTheme) - - if ('!{theme.comments.use[0]}' === 'Utterances' || !!{theme.comments.lazyload}) { - if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('utterances-wrap'), loadUtterances) - else loadUtterances() - } else { - function loadOtherComment () { - loadUtterances() - } - } diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/valine.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/valine.pug deleted file mode 100644 index c304baa5..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/valine.pug +++ /dev/null @@ -1,33 +0,0 @@ -- let emojiMaps = '""' -if site.data.valine - - emojiMaps = JSON.stringify(site.data.valine) - -script. - function loadValine () { - function initValine () { - const valine = new Valine(Object.assign({ - el: '#vcomment', - appId: '#{theme.valine.appId}', - appKey: '#{theme.valine.appKey}', - avatar: '#{theme.valine.avatar}', - serverURLs: '#{theme.valine.serverURLs}', - emojiMaps: !{emojiMaps}, - path: window.location.pathname, - visitor: #{theme.valine.visitor} - }, !{JSON.stringify(theme.valine.option)})) - } - - if (typeof Valine === 'function') initValine() - else getScript('!{url_for(theme.asset.valine)}').then(initValine) - } - - if ('!{theme.comments.use[0]}' === 'Valine' || !!{theme.comments.lazyload}) { - if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('vcomment'),loadValine) - else setTimeout(loadValine, 0) - } else { - function loadOtherComment () { - loadValine() - } - } - - diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/waline.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/waline.pug deleted file mode 100644 index 680695ea..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/comments/waline.pug +++ /dev/null @@ -1,34 +0,0 @@ -- const { serverURL, option, pageview } = theme.waline -- const { lazyload, count, use } = theme.comments - -script. - function loadWaline () { - function initWaline () { - const waline = Waline.init(Object.assign({ - el: '#waline-wrap', - serverURL: '!{serverURL}', - pageview: !{lazyload ? false : pageview}, - dark: 'html[data-theme="dark"]', - path: window.location.pathname, - comment: !{lazyload ? false : count}, - }, !{JSON.stringify(option)})) - } - - if (typeof Waline === 'object') initWaline() - else { - getCSS('!{url_for(theme.asset.waline_css)}').then(() => { - getScript('!{url_for(theme.asset.waline_js)}').then(initWaline) - }) - } - } - - if ('!{use[0]}' === 'Waline' || !!{lazyload}) { - if (!{lazyload}) btf.loadComment(document.getElementById('waline-wrap'),loadWaline) - else setTimeout(loadWaline, 0) - } else { - function loadOtherComment () { - loadWaline() - } - } - - diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/effect.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/effect.pug deleted file mode 100644 index fe3a802f..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/effect.pug +++ /dev/null @@ -1,35 +0,0 @@ -if theme.fireworks && theme.fireworks.enable - canvas.fireworks(mobile=`${theme.fireworks.mobile}`) - script(src=url_for(theme.asset.fireworks)) - -if (theme.canvas_ribbon && theme.canvas_ribbon.enable) - script(defer id="ribbon" src=url_for(theme.asset.canvas_ribbon) size=theme.canvas_ribbon.size - alpha=theme.canvas_ribbon.alpha zIndex=theme.canvas_ribbon.zIndex mobile=`${theme.canvas_ribbon.mobile}` data-click=`${theme.canvas_ribbon.click_to_change}`) - -if (theme.canvas_fluttering_ribbon && theme.canvas_fluttering_ribbon.enable) - script(defer id="fluttering_ribbon" mobile=`${theme.canvas_fluttering_ribbon.mobile}` src=url_for(theme.asset.canvas_fluttering_ribbon)) - -if (theme.canvas_nest && theme.canvas_nest.enable) - script#canvas_nest(defer color=theme.canvas_nest.color opacity=theme.canvas_nest.opacity zIndex=theme.canvas_nest.zIndex count=theme.canvas_nest.count mobile=`${theme.canvas_nest.mobile}` src=url_for(theme.asset.canvas_nest)) - -if theme.activate_power_mode.enable - script(src=url_for(theme.asset.activate_power_mode)) - script. - POWERMODE.colorful = !{theme.activate_power_mode.colorful}; - POWERMODE.shake = !{theme.activate_power_mode.shake}; - POWERMODE.mobile = !{theme.activate_power_mode.mobile}; - document.body.addEventListener('input', POWERMODE); - -//- 鼠標特效 -if theme.click_heart && theme.click_heart.enable - script#click-heart(src=url_for(theme.asset.click_heart) async mobile=`${theme.click_heart.mobile}`) - -if theme.ClickShowText && theme.ClickShowText.enable - script#click-show-text( - src= url_for(theme.asset.ClickShowText) - data-mobile= `${theme.ClickShowText.mobile}` - data-text= theme.ClickShowText.text.join(",") - data-fontsize= theme.ClickShowText.fontSize - data-random= `${theme.ClickShowText.random}` - async - ) \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/math/index.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/math/index.pug deleted file mode 100644 index 9ff86bad..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/math/index.pug +++ /dev/null @@ -1,18 +0,0 @@ -if theme.mathjax && theme.mathjax.enable - if theme.mathjax.per_page - if is_post() || is_page() - include ./mathjax.pug - else - if page.mathjax - include ./mathjax.pug - -if theme.katex && theme.katex.enable - if theme.katex.per_page - if is_post() || is_page() - include ./katex.pug - else - if page.katex - include ./katex.pug - -if theme.mermaid.enable - include ./mermaid.pug \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/math/katex.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/math/katex.pug deleted file mode 100644 index 864fa30b..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/math/katex.pug +++ /dev/null @@ -1,9 +0,0 @@ -link(rel="stylesheet" type="text/css" href=url_for(theme.asset.katex)) -script(src=url_for(theme.asset.katex_copytex)) -script. - (() => { - document.querySelectorAll('#article-container span.katex-display').forEach(item => { - btf.wrap(item, 'div', { class: 'katex-wrap'}) - }) - })() - \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/math/mathjax.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/math/mathjax.pug deleted file mode 100644 index 1b098a64..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/math/mathjax.pug +++ /dev/null @@ -1,38 +0,0 @@ -//- Mathjax 3 -script. - if (!window.MathJax) { - window.MathJax = { - tex: { - inlineMath: [['$', '$'], ['\\(', '\\)']], - tags: 'ams' - }, - chtml: { - scale: 1.1 - }, - options: { - renderActions: { - findScript: [10, doc => { - for (const node of document.querySelectorAll('script[type^="math/tex"]')) { - const display = !!node.type.match(/; *mode=display/) - const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display) - const text = document.createTextNode('') - node.parentNode.replaceChild(text, node) - math.start = {node: text, delim: '', n: 0} - math.end = {node: text, delim: '', n: 0} - doc.math.push(math) - } - }, ''] - } - } - } - - const script = document.createElement('script') - script.src = '!{url_for(theme.asset.mathjax)}' - script.id = 'MathJax-script' - script.async = true - document.head.appendChild(script) - } else { - MathJax.startup.document.state(0) - MathJax.texReset() - MathJax.typesetPromise() - } \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/math/mermaid.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/math/mermaid.pug deleted file mode 100644 index 6a44621a..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/math/mermaid.pug +++ /dev/null @@ -1,38 +0,0 @@ -script. - (() => { - const $mermaid = document.querySelectorAll('#article-container .mermaid-wrap') - if ($mermaid.length === 0) return - const runMermaid = () => { - window.loadMermaid = true - const theme = document.documentElement.getAttribute('data-theme') === 'dark' ? '!{theme.mermaid.theme.dark}' : '!{theme.mermaid.theme.light}' - - Array.from($mermaid).forEach((item, index) => { - const mermaidSrc = item.firstElementChild - const mermaidThemeConfig = '%%{init:{ \'theme\':\'' + theme + '\'}}%%\n' - const mermaidID = 'mermaid-' + index - const mermaidDefinition = mermaidThemeConfig + mermaidSrc.textContent - - const renderFn = mermaid.render(mermaidID, mermaidDefinition) - - const renderV10 = () => { - renderFn.then(({svg}) => { - mermaidSrc.insertAdjacentHTML('afterend', svg) - }) - } - - const renderV9 = svg => { - mermaidSrc.insertAdjacentHTML('afterend', svg) - } - - typeof renderFn === 'string' ? renderV9(renderFn) : renderV10() - }) - } - - const loadMermaid = () => { - window.loadMermaid ? runMermaid() : getScript('!{url_for(theme.asset.mermaid)}').then(runMermaid) - } - - btf.addModeChange('mermaid', runMermaid) - - window.pjax ? loadMermaid() : document.addEventListener('DOMContentLoaded', loadMermaid) - })() \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/artalk.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/artalk.pug deleted file mode 100644 index a6269098..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/artalk.pug +++ /dev/null @@ -1,110 +0,0 @@ -- const { server, site, option } = theme.artalk -- const avatarCdn = option !== null && option.gravatar && option.gravatar.mirror -- const avatarDefault = option !== null && option.gravatar && (option.gravatar.params || option.gravatar.default) - -script. - window.addEventListener('load', () => { - const changeContent = (content) => { - if (content === '') return content - - content = content.replace(/]+>/ig, '[!{_p("aside.card_newest_comments.image")}]') // replace image link - content = content.replace(/]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi, '[!{_p("aside.card_newest_comments.link")}]') // replace url - content = content.replace(/
.*?<\/pre>/gi, '[!{_p("aside.card_newest_comments.code")}]') // replace code
-      content = content.replace(/<[^>]+>/g,"") // remove html tag
-
-      if (content.length > 150) {
-        content = content.substring(0,150) + '...'
-      }
-      return content
-    }
-
-    const generateHtml = array => {
-      let result = ''
-
-      if (array.length) {
-        for (let i = 0; i < array.length; i++) {
-          result += '
' - - if (!{theme.newest_comments.avatar}) { - const name = '!{theme.lazyload.enable ? "data-lazy-src" : "src"}' - result += `${array[i].nick}` - } - - result += `
- ${array[i].content} -
${array[i].nick} /
-
` - } - } else { - result += '!{_p("aside.card_newest_comments.zero")}' - } - - let $dom = document.querySelector('#card-newest-comments .aside-list') - $dom.innerHTML= result - window.lazyLoadInstance && window.lazyLoadInstance.update() - window.pjax && window.pjax.refresh($dom) - } - - const getSetting = async () => { - try { - const res = await fetch('!{server}/api/conf', { method: 'GET' }) - return await res.json() - } catch (e) { - console.log(e) - } - } - - const headerList = { - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'Origin': window.location.origin - }, - body: new URLSearchParams({ - 'site_name': '!{site}', - 'limit': '!{theme.newest_comments.limit}', - 'type':'latest_comments' - }) - } - - const getComment = async () => { - try { - const res = await fetch('!{server}/api/stat', headerList) - const result = await res.json() - const avatarStr = await getSetting() - const { mirror, params, default:defaults } = avatarStr.data.frontend_conf.gravatar - const avatarCdn = !{avatarCdn} || mirror - let avatarDefault = !{avatarDefault} || params || defaults - avatarDefault = avatarDefault.startsWith('d=') ? avatarDefault : `d=${avatarDefault}` - const artalk = result.data.map(function (e) { - return { - 'avatar': `${avatarCdn}${e.email_encrypted}?${avatarDefault}`, - 'content': changeContent(e.content_marked), - 'nick': e.nick, - 'url': e.page_url, - 'date': e.date, - } - }) - saveToLocal.set('artalk-newest-comments', JSON.stringify(artalk), !{theme.newest_comments.storage}/(60*24)) - generateHtml(artalk) - } catch (e) { - console.log(e) - const $dom = document.querySelector('#card-newest-comments .aside-list') - $dom.innerHTML= "!{_p('aside.card_newest_comments.error')}" - } - } - - const newestCommentInit = () => { - if (document.querySelector('#card-newest-comments .aside-list')) { - const data = saveToLocal.get('artalk-newest-comments') - if (data) { - generateHtml(JSON.parse(data)) - } else { - getComment() - } - } - } - - newestCommentInit() - document.addEventListener('pjax:complete', newestCommentInit) - }) diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/disqus-comment.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/disqus-comment.pug deleted file mode 100644 index c729c50f..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/disqus-comment.pug +++ /dev/null @@ -1,82 +0,0 @@ -script. - window.addEventListener('load', () => { - const changeContent = (content) => { - if (content === '') return content - - content = content.replace(/]+>/ig, '[!{_p("aside.card_newest_comments.image")}]') // replace image link - content = content.replace(/]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi, '[!{_p("aside.card_newest_comments.link")}]') // replace url - content = content.replace(/.*?<\/code>/gi, '[!{_p("aside.card_newest_comments.code")}]') // replace code - content = content.replace(/<[^>]+>/g,"") // remove html tag - - if (content.length > 150) { - content = content.substring(0,150) + '...' - } - return content - } - - const getComment = () => { - fetch('https://disqus.com/api/3.0/forums/listPosts.json?forum=!{forum}&related=thread&limit=!{theme.newest_comments.limit}&api_key=!{apiKey}') - .then(response => response.json()) - .then(data => { - const disqusArray = data.response.map(item => { - return { - 'avatar': item.author.avatar.cache, - 'content': changeContent(item.message), - 'nick': item.author.name, - 'url': item.url, - 'date': item.createdAt - } - }) - - saveToLocal.set('disqus-newest-comments', JSON.stringify(disqusArray), !{theme.newest_comments.storage}/(60*24)) - generateHtml(disqusArray) - }).catch(e => { - const $dom = document.querySelector('#card-newest-comments .aside-list') - $dom.textContent= "!{_p('aside.card_newest_comments.error')}" - }) - } - - const generateHtml = array => { - let result = '' - - if (array.length) { - for (let i = 0; i < array.length; i++) { - result += '
' - - if (!{theme.newest_comments.avatar}) { - const name = '!{theme.lazyload.enable ? "data-lazy-src" : "src"}' - result += `${array[i].nick}` - } - - result += `
- ${array[i].content} -
${array[i].nick}
-
` - } - } else { - result += '!{_p("aside.card_newest_comments.zero")}' - } - - let $dom = document.querySelector('#card-newest-comments .aside-list') - $dom.innerHTML= result - window.lazyLoadInstance && window.lazyLoadInstance.update() - window.pjax && window.pjax.refresh($dom) - } - - const newestCommentInit = () => { - if (document.querySelector('#card-newest-comments .aside-list')) { - const data = saveToLocal.get('disqus-newest-comments') - if (data) { - generateHtml(JSON.parse(data)) - } else { - getComment() - } - } - } - - newestCommentInit() - document.addEventListener('pjax:complete', newestCommentInit) - }) - - - diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/github-issues.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/github-issues.pug deleted file mode 100644 index 85a05a24..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/github-issues.pug +++ /dev/null @@ -1,109 +0,0 @@ -script. - window.addEventListener('load', () => { - const changeContent = (content) => { - if (content === '') return content - - content = content.replace(/]+>/ig, '[!{_p("aside.card_newest_comments.image")}]') // replace image link - content = content.replace(/]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi, '[!{_p("aside.card_newest_comments.link")}]') // replace url - content = content.replace(/
.*?<\/pre>/gi, '[!{_p("aside.card_newest_comments.code")}]') // replace code
-      content = content.replace(/<[^>]+>/g,"") // remove html tag
-
-      if (content.length > 150) {
-        content = content.substring(0,150) + '...'
-      }
-      return content
-    }
-
-    const findTrueUrl = (array) => {
-      Promise.all(array.map(item =>
-        fetch(item.url).then(resp => resp.json()).then(data => {
-          const urlArray = data.body.match(/(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?/ig)
-          if (data.user.login === 'utterances-bot') {
-            return urlArray.pop()
-          } else {
-            return urlArray.shift()
-          }
-        })
-      )).then(res => {
-          array = array.map((i,index)=> {
-            return {
-              ...i,
-              url: res[index]
-            }
-          })
-
-          saveToLocal.set('github-newest-comments', JSON.stringify(array), !{theme.newest_comments.storage}/(60*24))
-          generateHtml(array)
-      });
-    }
-
-    const getComment = () => {
-      fetch('https://api.github.com/repos/!{userRepo}/issues/comments?sort=updated&direction=desc&per_page=!{theme.newest_comments.limit}&page=1',{
-        "headers": {
-          Accept: 'application/vnd.github.v3.html+json'
-        }
-      })
-        .then(response => response.json())
-        .then(data => {
-          const githubArray = data.map(item => {
-            return {
-              'avatar': item.user.avatar_url,
-              'content': changeContent(item.body_html),
-              'nick': item.user.login,
-              'url': item.issue_url,
-              'date': item.updated_at,
-              'githubUrl': item.html_url
-            }
-          })
-          findTrueUrl(githubArray)
-        }).catch(e => {
-          const $dom = document.querySelector('#card-newest-comments .aside-list')
-          $dom.textContent= "!{_p('aside.card_newest_comments.error')}"
-        })
-    }
-
-    const generateHtml = array => {
-      let result = ''
-
-      if (array.length) {
-        for (let i = 0; i < array.length; i++) {
-          result += '
' - - if (!{theme.newest_comments.avatar}) { - const name = '!{theme.lazyload.enable ? "data-lazy-src" : "src"}' - result += `${array[i].nick}` - } - - result += `
- ${array[i].content} -
${array[i].nick} /
-
` - } - } else { - result += '!{_p("aside.card_newest_comments.zero")}' - } - - let $dom = document.querySelector('#card-newest-comments .aside-list') - $dom.innerHTML= result - window.lazyLoadInstance && window.lazyLoadInstance.update() - window.pjax && window.pjax.refresh($dom) - } - - const newestCommentInit = () => { - if (document.querySelector('#card-newest-comments .aside-list')) { - const data = saveToLocal.get('github-newest-comments') - if (data) { - generateHtml(JSON.parse(data)) - } else { - getComment() - } - } - } - - newestCommentInit() - document.addEventListener('pjax:complete', newestCommentInit) - }) - - - - diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/index.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/index.pug deleted file mode 100644 index 246bdbcb..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/index.pug +++ /dev/null @@ -1,30 +0,0 @@ -- let { use } = theme.comments - -if use - - let forum,apiKey,userRepo - case use[0] - when 'Valine' - include ./valine.pug - when 'Waline' - include ./waline.pug - when 'Twikoo' - include ./twikoo-comment.pug - when 'Disqus' - - forum = theme.disqus.shortname - - apiKey = theme.disqus.apikey - include ./disqus-comment.pug - when 'Disqusjs' - - forum = theme.disqusjs.shortname - - apiKey = theme.disqusjs.apikey - include ./disqus-comment.pug - when 'Gitalk' - - let { repo,owner } = theme.gitalk - - userRepo = owner + '/' + repo - include ./github-issues.pug - when 'Utterances' - - userRepo = theme.utterances.repo - include ./github-issues.pug - when 'Remark42' - include ./remark42.pug - when 'Artalk' - include ./artalk.pug \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/remark42.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/remark42.pug deleted file mode 100644 index c4a04852..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/remark42.pug +++ /dev/null @@ -1,80 +0,0 @@ -- const { host, siteId } = theme.remark42 - -script. - window.addEventListener('load', () => { - const changeContent = (content) => { - if (content === '') return content - - content = content.replace(/]+>/ig, '[!{_p("aside.card_newest_comments.image")}]') // replace image link - content = content.replace(/]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi, '[!{_p("aside.card_newest_comments.link")}]') // replace url - content = content.replace(/
.*?<\/pre>/gi, '[!{_p("aside.card_newest_comments.code")}]') // replace code
-      content = content.replace(/<[^>]+>/g,"") // remove html tag
-
-      if (content.length > 150) {
-        content = content.substring(0,150) + '...'
-      }
-      return content
-    }
-
-    const generateHtml = array => {
-      let result = ''
-
-      if (array.length) {
-        for (let i = 0; i < array.length; i++) {
-          result += '
' - - if (!{theme.newest_comments.avatar}) { - const name = '!{theme.lazyload.enable ? "data-lazy-src" : "src"}' - result += `${array[i].nick}` - } - - result += `
- ${array[i].content} -
${array[i].nick} /
-
` - } - } else { - result += '!{_p("aside.card_newest_comments.zero")}' - } - - let $dom = document.querySelector('#card-newest-comments .aside-list') - $dom.innerHTML= result - window.lazyLoadInstance && window.lazyLoadInstance.update() - window.pjax && window.pjax.refresh($dom) - } - - const getComment = () => { - fetch('!{host}/api/v1/last/!{theme.newest_comments.limit}?site=!{siteId}') - .then(response => response.json()) - .then(data => { - const remark42 = data.map(function (e) { - return { - 'avatar': e.user.picture, - 'content': changeContent(e.text), - 'nick': e.user.name, - 'url': e.locator.url, - 'date': e.time, - } - }) - saveToLocal.set('remark42-newest-comments', JSON.stringify(remark42), !{theme.newest_comments.storage}/(60*24)) - generateHtml(remark42) - }).catch(e => { - const $dom = document.querySelector('#card-newest-comments .aside-list') - $dom.textContent= "!{_p('aside.card_newest_comments.error')}" - }) - } - - const newestCommentInit = () => { - if (document.querySelector('#card-newest-comments .aside-list')) { - const data = saveToLocal.get('remark42-newest-comments') - if (data) { - generateHtml(JSON.parse(data)) - } else { - getComment() - } - } - } - - newestCommentInit() - document.addEventListener('pjax:complete', newestCommentInit) - }) diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/twikoo-comment.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/twikoo-comment.pug deleted file mode 100644 index 4e4a2be9..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/twikoo-comment.pug +++ /dev/null @@ -1,93 +0,0 @@ -script. - window.addEventListener('load', () => { - const changeContent = (content) => { - if (content === '') return content - - content = content.replace(/]+>/ig, '[!{_p("aside.card_newest_comments.image")}]') // replace image link - content = content.replace(/]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi, '[!{_p("aside.card_newest_comments.link")}]') // replace url - content = content.replace(/
.*?<\/pre>/gi, '[!{_p("aside.card_newest_comments.code")}]') // replace code
-      content = content.replace(/<[^>]+>/g,"") // remove html tag
-
-      if (content.length > 150) {
-        content = content.substring(0,150) + '...'
-      }
-      return content
-    }
-
-    const getComment = () => {
-      const runTwikoo = () => {
-        twikoo.getRecentComments({
-          envId: '!{theme.twikoo.envId}',
-          region: '!{theme.twikoo.region}',
-          pageSize: !{theme.newest_comments.limit},
-          includeReply: true
-        }).then(function (res) {
-          const twikooArray = res.map(e => {
-            return {
-              'content': changeContent(e.comment),
-              'avatar': e.avatar,
-              'nick': e.nick,
-              'url': e.url + '#' + e.id,
-              'date': new Date(e.created).toISOString()
-            }
-          })
-
-          saveToLocal.set('twikoo-newest-comments', JSON.stringify(twikooArray), !{theme.newest_comments.storage}/(60*24))
-          generateHtml(twikooArray)
-        }).catch(function (err) {
-          const $dom = document.querySelector('#card-newest-comments .aside-list')
-          $dom.textContent= "!{_p('aside.card_newest_comments.error')}"
-        })
-      }
-
-      if (typeof twikoo === 'object') {
-        runTwikoo()
-      } else {
-        getScript('!{url_for(theme.asset.twikoo)}').then(runTwikoo)
-      }
-    }
-
-    const generateHtml = array => {
-      let result = ''
-
-      if (array.length) {
-        for (let i = 0; i < array.length; i++) {
-          result += '
' - - if (!{theme.newest_comments.avatar}) { - const name = '!{theme.lazyload.enable ? "data-lazy-src" : "src"}' - result += `${array[i].nick}` - } - - result += `
- ${array[i].content} -
${array[i].nick} /
-
` - } - } else { - result += '!{_p("aside.card_newest_comments.zero")}' - } - - let $dom = document.querySelector('#card-newest-comments .aside-list') - $dom.innerHTML= result - window.lazyLoadInstance && window.lazyLoadInstance.update() - window.pjax && window.pjax.refresh($dom) - } - - const newestCommentInit = () => { - if (document.querySelector('#card-newest-comments .aside-list')) { - const data = saveToLocal.get('twikoo-newest-comments') - if (data) { - generateHtml(JSON.parse(data)) - } else { - getComment() - } - } - } - - newestCommentInit() - document.addEventListener('pjax:complete', newestCommentInit) - }) - - - diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/valine.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/valine.pug deleted file mode 100644 index c1e4f76f..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/valine.pug +++ /dev/null @@ -1,99 +0,0 @@ -- let default_avatar = theme.valine.avatar - -script(src=url_for(theme.asset.blueimp_md5)) -script. - window.addEventListener('load', () => { - const changeContent = (content) => { - if (content === '') return content - - content = content.replace(/]+>/ig, '[!{_p("aside.card_newest_comments.image")}]') // replace image link - content = content.replace(/]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi, '[!{_p("aside.card_newest_comments.link")}]') // replace url - content = content.replace(/
.*?<\/pre>/gi, '[!{_p("aside.card_newest_comments.code")}]') // replace code
-      content = content.replace(/<[^>]+>/g,"") // remove html tag
-
-      if (content.length > 150) {
-        content = content.substring(0,150) + '...'
-      }
-      return content
-    }
-
-    const getIcon = (icon, mail) => {
-      if (icon) return icon
-      let defaultIcon = '!{ default_avatar ? `?d=${default_avatar}` : ''}'
-      let iconUrl = `https://gravatar.loli.net/avatar/${md5(mail.toLowerCase()) + defaultIcon}`
-      return iconUrl
-    }
-
-    const generateHtml = array => {
-      let result = ''
-
-      if (array.length) {
-        for (let i = 0; i < array.length; i++) {
-          result += '
' - - if (!{theme.newest_comments.avatar}) { - const name = '!{theme.lazyload.enable ? "data-lazy-src" : "src"}' - result += `${array[i].nick}` - } - - result += `
- ${array[i].content} -
${array[i].nick} /
-
` - } - } else { - result += '!{_p("aside.card_newest_comments.zero")}' - } - - let $dom = document.querySelector('#card-newest-comments .aside-list') - $dom.innerHTML= result - window.lazyLoadInstance && window.lazyLoadInstance.update() - window.pjax && window.pjax.refresh($dom) - } - - const getComment = () => { - const serverURL = '!{theme.valine.serverURLs || `https://${theme.valine.appId.substring(0,8)}.api.lncldglobal.com` }' - - var settings = { - "method": "GET", - "headers": { - "X-LC-Id": '!{theme.valine.appId}', - "X-LC-Key": '!{theme.valine.appKey}', - "Content-Type": "application/json" - }, - } - - fetch(`${serverURL}/1.1/classes/Comment?limit=!{theme.newest_comments.limit}&order=-createdAt`,settings) - .then(response => response.json()) - .then(data => { - const valineArray = data.results.map(function (e) { - return { - 'avatar': getIcon(e.QQAvatar, e.mail), - 'content': changeContent(e.comment), - 'nick': e.nick, - 'url': e.url + '#' + e.objectId, - 'date': e.updatedAt, - } - }) - saveToLocal.set('valine-newest-comments', JSON.stringify(valineArray), !{theme.newest_comments.storage}/(60*24)) - generateHtml(valineArray) - }).catch(e => { - const $dom = document.querySelector('#card-newest-comments .aside-list') - $dom.textContent= "!{_p('aside.card_newest_comments.error')}" - }) - } - - const newestCommentInit = () => { - if (document.querySelector('#card-newest-comments .aside-list')) { - const data = saveToLocal.get('valine-newest-comments') - if (data) { - generateHtml(JSON.parse(data)) - } else { - getComment() - } - } - } - - newestCommentInit() - document.addEventListener('pjax:complete', newestCommentInit) - }) diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/waline.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/waline.pug deleted file mode 100644 index 9bcb0e69..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/newest-comments/waline.pug +++ /dev/null @@ -1,79 +0,0 @@ -script. - window.addEventListener('load', () => { - const changeContent = content => { - if (content === '') return content - - content = content.replace(/]+>/ig, '[!{_p("aside.card_newest_comments.image")}]') // replace image link - content = content.replace(/]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi, '[!{_p("aside.card_newest_comments.link")}]') // replace url - content = content.replace(/
.*?<\/pre>/gi, '[!{_p("aside.card_newest_comments.code")}]') // replace code
-      content = content.replace(/<[^>]+>/g,"") // remove html tag
-
-      if (content.length > 150) {
-        content = content.substring(0,150) + '...'
-      }
-      return content
-    }
-
-    const generateHtml = array => {
-      let result = ''
-
-      if (array.length) {
-        for (let i = 0; i < array.length; i++) {
-          result += '
' - - if (!{theme.newest_comments.avatar}) { - const name = '!{theme.lazyload.enable ? "data-lazy-src" : "src"}' - result += `${array[i].nick}` - } - - result += `
- ${array[i].content} -
${array[i].nick} /
-
` - } - } else { - result += '!{_p("aside.card_newest_comments.zero")}' - } - - let $dom = document.querySelector('#card-newest-comments .aside-list') - $dom.innerHTML= result - window.lazyLoadInstance && window.lazyLoadInstance.update() - window.pjax && window.pjax.refresh($dom) - } - - const getComment = async () => { - try { - const res = await fetch('!{theme.waline.serverURL}/api/comment?type=recent&count=!{theme.newest_comments.limit}', { method: 'GET' }) - const result = await res.json() - const walineArray = result.data.map(e => { - return { - 'content': changeContent(e.comment), - 'avatar': e.avatar, - 'nick': e.nick, - 'url': e.url + '#' + e.objectId, - 'date': e.time || e.insertedAt - } - }) - saveToLocal.set('waline-newest-comments', JSON.stringify(walineArray), !{theme.newest_comments.storage}/(60*24)) - generateHtml(walineArray) - } catch (err) { - console.error(err) - const $dom = document.querySelector('#card-newest-comments .aside-list') - $dom.textContent= "!{_p('aside.card_newest_comments.error')}" - } - } - - const newestCommentInit = () => { - if (document.querySelector('#card-newest-comments .aside-list')) { - const data = saveToLocal.get('waline-newest-comments') - if (data) { - generateHtml(JSON.parse(data)) - } else { - getComment() - } - } - } - - newestCommentInit() - document.addEventListener('pjax:complete', newestCommentInit) - }) diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/pangu.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/pangu.pug deleted file mode 100644 index 8cd083e4..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/pangu.pug +++ /dev/null @@ -1,20 +0,0 @@ -script. - function panguFn () { - if (typeof pangu === 'object') pangu.autoSpacingPage() - else { - getScript('!{url_for(theme.asset.pangu)}') - .then(() => { - pangu.autoSpacingPage() - }) - } - } - - function panguInit () { - if (!{theme.pangu.field === 'post'}){ - GLOBAL_CONFIG_SITE.isPost && panguFn() - } else { - panguFn() - } - } - - document.addEventListener('DOMContentLoaded', panguInit) diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/pjax.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/pjax.pug deleted file mode 100644 index a3c38e77..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/pjax.pug +++ /dev/null @@ -1,83 +0,0 @@ -- var pjaxExclude = 'a:not([target="_blank"])' -if theme.pjax.exclude - each val in theme.pjax.exclude - - pjaxExclude = pjaxExclude + `:not([href="${val}"])` - -- let pjaxSelectors = ['head > title','#config-diff','#body-wrap','#rightside-config-hide','#rightside-config-show','.js-pjax'] - -- let choose = theme.comments.use -if choose - if theme.Open_Graph_meta.enable && (choose.includes('Livere') || choose.includes('Utterances') || choose.includes('Giscus')) - - pjaxSelectors.unshift('meta[property="og:image"]', 'meta[property="og:title"]', 'meta[property="og:url"]') - if choose.includes('Utterances') || choose.includes('Giscus') - - pjaxSelectors.unshift('link[rel="canonical"]') - -script(src=url_for(theme.asset.pjax)) -script. - let pjaxSelectors = !{JSON.stringify(pjaxSelectors)} - - var pjax = new Pjax({ - elements: '!{pjaxExclude}', - selectors: pjaxSelectors, - cacheBust: false, - analytics: !{theme.google_analytics ? true : false}, - scrollRestoration: false - }) - - document.addEventListener('pjax:send', function () { - - // removeEventListener scroll - window.tocScrollFn && window.removeEventListener('scroll', window.tocScrollFn) - window.scrollCollect && window.removeEventListener('scroll', scrollCollect) - - document.getElementById('rightside').style.cssText = "opacity: ''; transform: ''" - - if (window.aplayers) { - for (let i = 0; i < window.aplayers.length; i++) { - if (!window.aplayers[i].options.fixed) { - window.aplayers[i].destroy() - } - } - } - - typeof typed === 'object' && typed.destroy() - - //reset readmode - const $bodyClassList = document.body.classList - $bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode') - - typeof disqusjs === 'object' && disqusjs.destroy() - }) - - document.addEventListener('pjax:complete', function () { - window.refreshFn() - - document.querySelectorAll('script[data-pjax]').forEach(item => { - const newScript = document.createElement('script') - const content = item.text || item.textContent || item.innerHTML || "" - Array.from(item.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value)) - newScript.appendChild(document.createTextNode(content)) - item.parentNode.replaceChild(newScript, item) - }) - - GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update() - - typeof panguInit === 'function' && panguInit() - - // google analytics - typeof gtag === 'function' && gtag('config', '!{theme.google_analytics}', {'page_path': window.location.pathname}); - - // baidu analytics - typeof _hmt === 'object' && _hmt.push(['_trackPageview',window.location.pathname]); - - typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting() - - // prismjs - typeof Prism === 'object' && Prism.highlightAll() - }) - - document.addEventListener('pjax:error', (e) => { - if (e.request.status === 404) { - pjax.loadUrl('/404.html') - } - }) diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/prismjs.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/prismjs.pug deleted file mode 100644 index fee21493..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/prismjs.pug +++ /dev/null @@ -1,5 +0,0 @@ -if config.prismjs && config.prismjs.enable && !config.prismjs.preprocess - script(src=url_for(theme.asset.prismjs_js)) - script(src=url_for(theme.asset.prismjs_autoloader)) - if config.prismjs.line_number - script(src=url_for(theme.asset.prismjs_lineNumber_js)) diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/search/algolia.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/search/algolia.pug deleted file mode 100644 index 1e7ecbc8..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/search/algolia.pug +++ /dev/null @@ -1,22 +0,0 @@ -#algolia-search - .search-dialog - nav.search-nav - span.search-dialog-title= _p('search.title') - button.search-close-button - i.fas.fa-times - - .search-wrap - #algolia-search-input - hr - #algolia-search-results - #algolia-hits - #algolia-pagination - #algolia-info - .algolia-stats - .algolia-poweredBy - - #search-mask - - script(src=url_for(theme.asset.algolia_search)) - script(src=url_for(theme.asset.instantsearch)) - script(src=url_for(theme.asset.algolia_js)) \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/search/docsearch.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/search/docsearch.pug deleted file mode 100644 index 652f1c6a..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/search/docsearch.pug +++ /dev/null @@ -1,27 +0,0 @@ -- const { appId, apiKey, indexName, option } = theme.docsearch - -.docsearch-wrap - #docsearch(style="display:none") - link(rel="stylesheet" href=url_for(theme.asset.docsearch_css)) - script(src=url_for(theme.asset.docsearch_js)) - script. - (() => { - docsearch(Object.assign({ - appId: '!{appId}', - apiKey: '!{apiKey}', - indexName: '!{indexName}', - container: '#docsearch', - }, !{JSON.stringify(option)})) - - - const searchClickFn = () => { - document.querySelector('#search-button > .search').addEventListener('click', () => { - document.querySelector('.DocSearch-Button').click() - }) - } - - searchClickFn() - window.addEventListener('pjax:complete', searchClickFn) - })() - - diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/search/index.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/search/index.pug deleted file mode 100644 index c09d0cea..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/search/index.pug +++ /dev/null @@ -1,6 +0,0 @@ -if theme.algolia_search.enable - include ./algolia.pug -else if theme.local_search.enable - include ./local-search.pug -else if theme.docsearch.enable - include ./docsearch.pug \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/search/local-search.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/search/local-search.pug deleted file mode 100644 index 7b222cd8..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/search/local-search.pug +++ /dev/null @@ -1,22 +0,0 @@ -#local-search - .search-dialog - nav.search-nav - span.search-dialog-title= _p('search.title') - span#loading-status - button.search-close-button - i.fas.fa-times - - #loading-database.is-center - i.fas.fa-spinner.fa-pulse - span= ' ' + _p("search.load_data") - - .search-wrap - #local-search-input - .local-search-box - input(placeholder=_p("search.local_search.input_placeholder") type="text").local-search-box--input - hr - #local-search-results.no-result - #local-search-stats-wrap - #search-mask - - script(src=url_for(theme.asset.local_search)) \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/share/add-this.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/share/add-this.pug deleted file mode 100644 index 68f95884..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/share/add-this.pug +++ /dev/null @@ -1,2 +0,0 @@ -.addthis_inline_share_toolbox -script(src=`//s7.addthis.com/js/300/addthis_widget.js#pubid=${theme.addThis.pubid}` async) \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/share/addtoany.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/share/addtoany.pug deleted file mode 100644 index e6633cbe..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/share/addtoany.pug +++ /dev/null @@ -1,10 +0,0 @@ -.addtoany - .a2a_kit.a2a_kit_size_32.a2a_default_style - - let addtoanyItem = theme.addtoany.item.split(',') - each name in addtoanyItem - a(class="a2a_button_" + name) - - a.a2a_dd(href="https://www.addtoany.com/share") -script(async src='https://static.addtoany.com/menu/page.js') - - diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/share/index.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/share/index.pug deleted file mode 100644 index 667964f9..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/share/index.pug +++ /dev/null @@ -1,7 +0,0 @@ -.post_share - if theme.addThis.enable - !=partial('includes/third-party/share/add-this', {}, {cache: true}) - else if theme.sharejs.enable - include ./share-js.pug - else if theme.addtoany.enable - !=partial('includes/third-party/share/addtoany', {}, {cache: true}) diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/share/share-js.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/share/share-js.pug deleted file mode 100644 index cb103c8b..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/share/share-js.pug +++ /dev/null @@ -1,4 +0,0 @@ -- const coverVal = page.cover_type === 'img' ? page.cover : theme.avatar.img -.social-share(data-image=url_for(coverVal) data-sites= theme.sharejs.sites) -link(rel='stylesheet' href=url_for(theme.asset.sharejs_css) media="print" onload="this.media='all'") -script(src=url_for(theme.asset.sharejs) defer) \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/third-party/subtitle.pug b/node_modules/hexo-theme-butterfly/layout/includes/third-party/subtitle.pug deleted file mode 100644 index 2689bf9c..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/third-party/subtitle.pug +++ /dev/null @@ -1,92 +0,0 @@ -- const { effect,source,sub,typed_option } = theme.subtitle -- let subContent = sub || new Array() - -script. - window.typedJSFn = { - init: (str) => { - window.typed = new Typed('#subtitle', Object.assign({ - strings: str, - startDelay: 300, - typeSpeed: 150, - loop: true, - backSpeed: 50, - }, !{JSON.stringify(typed_option)})) - }, - run: (subtitleType) => { - if (!{effect}) { - if (typeof Typed === 'function') { - subtitleType() - } else { - getScript('!{url_for(theme.asset.typed)}').then(subtitleType) - } - } else { - subtitleType() - } - } - } - -case source - when 1 - script. - function subtitleType () { - fetch('https://v1.hitokoto.cn') - .then(response => response.json()) - .then(data => { - if (!{effect}) { - const from = '出自 ' + data.from - const sub = !{JSON.stringify(subContent)} - sub.unshift(data.hitokoto, from) - typedJSFn.init(sub) - } else { - document.getElementById('subtitle').textContent = data.hitokoto - } - }) - } - typedJSFn.run(subtitleType) - - when 2 - script. - function subtitleType () { - getScript('https://yijuzhan.com/api/word.php?m=js').then(() => { - const con = str[0] - if (!{effect}) { - const from = '出自 ' + str[1] - const sub = !{JSON.stringify(subContent)} - sub.unshift(con, from) - typedJSFn.init(sub) - } else { - document.getElementById('subtitle').textContent = con - } - }) - } - typedJSFn.run(subtitleType) - - when 3 - script. - function subtitleType () { - getScript('https://sdk.jinrishici.com/v2/browser/jinrishici.js').then(() => { - jinrishici.load(result =>{ - if (!{effect}) { - const sub = !{JSON.stringify(subContent)} - const content = result.data.content - sub.unshift(content) - typedJSFn.init(sub) - } else { - document.getElementById('subtitle').textContent = result.data.content - } - }) - }) - } - typedJSFn.run(subtitleType) - - default - - subContent = subContent.length ? subContent : new Array(config.subtitle) - script. - function subtitleType () { - if (!{effect}) { - typedJSFn.init(!{JSON.stringify(subContent)}) - } else { - document.getElementById("subtitle").textContent = !{JSON.stringify(subContent[0])} - } - } - typedJSFn.run(subtitleType) \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/widget/card_ad.pug b/node_modules/hexo-theme-butterfly/layout/includes/widget/card_ad.pug deleted file mode 100644 index d088f0e8..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/widget/card_ad.pug +++ /dev/null @@ -1,3 +0,0 @@ -if theme.ad && theme.ad.aside - .card-widget.ads-wrap - != theme.ad.aside diff --git a/node_modules/hexo-theme-butterfly/layout/includes/widget/card_announcement.pug b/node_modules/hexo-theme-butterfly/layout/includes/widget/card_announcement.pug deleted file mode 100644 index a96d06d2..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/widget/card_announcement.pug +++ /dev/null @@ -1,6 +0,0 @@ -if theme.aside.card_announcement.enable - .card-widget.card-announcement - .item-headline - i.fas.fa-bullhorn.fa-shake - span= _p('aside.card_announcement') - .announcement_content!= theme.aside.card_announcement.content \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/widget/card_archives.pug b/node_modules/hexo-theme-butterfly/layout/includes/widget/card_archives.pug deleted file mode 100644 index 0fcd17ac..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/widget/card_archives.pug +++ /dev/null @@ -1,7 +0,0 @@ -if theme.aside.card_archives.enable - .card-widget.card-archives - - let type = theme.aside.card_archives.type || 'monthly' - - let format = theme.aside.card_archives.format || 'MMMM YYYY' - - let order = theme.aside.card_archives.order || -1 - - let limit = theme.aside.card_archives.limit === 0 ? 0 : theme.aside.card_archives.limit || 8 - != aside_archives({ type:type, format: format, order: order, limit: limit }) diff --git a/node_modules/hexo-theme-butterfly/layout/includes/widget/card_author.pug b/node_modules/hexo-theme-butterfly/layout/includes/widget/card_author.pug deleted file mode 100644 index 8ccc020f..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/widget/card_author.pug +++ /dev/null @@ -1,27 +0,0 @@ -if theme.aside.card_author.enable - .card-widget.card-info - .is-center - .avatar-img - img(src=url_for(theme.avatar.img) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt="avatar") - .author-info__name= config.author - .author-info__description!= theme.aside.card_author.description || config.description - - .card-info-data.site-data.is-center - a(href=url_for(config.archive_dir) + '/') - .headline= _p('aside.articles') - .length-num= site.posts.length - a(href=url_for(config.tag_dir) + '/') - .headline= _p('aside.tags') - .length-num= site.tags.length - a(href=url_for(config.category_dir) + '/') - .headline= _p('aside.categories') - .length-num= site.categories.length - - if theme.aside.card_author.button.enable - a#card-info-btn(href=theme.aside.card_author.button.link) - i(class=theme.aside.card_author.button.icon) - span=theme.aside.card_author.button.text - - if(theme.social) - .card-info-social-icons.is-center - !=partial('includes/header/social', {}, {cache: true}) diff --git a/node_modules/hexo-theme-butterfly/layout/includes/widget/card_bottom_self.pug b/node_modules/hexo-theme-butterfly/layout/includes/widget/card_bottom_self.pug deleted file mode 100644 index 31ce298a..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/widget/card_bottom_self.pug +++ /dev/null @@ -1,9 +0,0 @@ -if site.data.widget && site.data.widget.bottom - each item in site.data.widget.bottom - .card-widget(class=item.class_name id=item.id_name style=item.order ? `order: ${item.order}` : '') - .item-headline - i(class=item.icon) - span=item.name - .item-content - !=item.html - diff --git a/node_modules/hexo-theme-butterfly/layout/includes/widget/card_categories.pug b/node_modules/hexo-theme-butterfly/layout/includes/widget/card_categories.pug deleted file mode 100644 index 770d035e..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/widget/card_categories.pug +++ /dev/null @@ -1,4 +0,0 @@ -if theme.aside.card_categories.enable - if site.categories.length - .card-widget.card-categories - !=aside_categories({ limit: theme.aside.card_categories.limit === 0 ? 0 : theme.aside.card_categories.limit || 8 , expand: theme.aside.card_categories.expand }) diff --git a/node_modules/hexo-theme-butterfly/layout/includes/widget/card_newest_comment.pug b/node_modules/hexo-theme-butterfly/layout/includes/widget/card_newest_comment.pug deleted file mode 100644 index f8e13b39..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/widget/card_newest_comment.pug +++ /dev/null @@ -1,7 +0,0 @@ -if theme.newest_comments.enable && theme.comments.use && !['Livere','Facebook Comments','Giscus'].includes(theme.comments.use[0]) - .card-widget#card-newest-comments - .item-headline - i.fas.fa-comment-dots - span= _p('aside.card_newest_comments.headline') - .aside-list - span= _p('aside.card_newest_comments.loading_text') diff --git a/node_modules/hexo-theme-butterfly/layout/includes/widget/card_post_toc.pug b/node_modules/hexo-theme-butterfly/layout/includes/widget/card_post_toc.pug deleted file mode 100644 index a82e52e5..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/widget/card_post_toc.pug +++ /dev/null @@ -1,15 +0,0 @@ -- let tocNumber = page.toc_number !== undefined ? page.toc_number : theme.toc.number -- let tocExpand = page.toc_expand !== undefined ? page.toc_expand : theme.toc.expand -- let tocExpandClass = tocExpand ? 'is-expand' : '' - -#card-toc.card-widget - .item-headline - i.fas.fa-stream - span= _p('aside.card_toc') - span.toc-percentage - - if (page.encrypt == true) - .toc-content.toc-div-class(class=tocExpandClass style="display:none")!=toc(page.origin, {list_number: tocNumber}) - else - .toc-content(class=tocExpandClass)!=toc(page.content, {list_number: tocNumber}) - \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/widget/card_recent_post.pug b/node_modules/hexo-theme-butterfly/layout/includes/widget/card_recent_post.pug deleted file mode 100644 index a8c46470..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/widget/card_recent_post.pug +++ /dev/null @@ -1,27 +0,0 @@ -if theme.aside.card_recent_post.enable - .card-widget.card-recent-post - .item-headline - i.fas.fa-history - span= _p('aside.card_recent_post') - .aside-list - - let postLimit = theme.aside.card_recent_post.limit === 0 ? site.posts.length : theme.aside.card_recent_post.limit || 5 - - let sort = theme.aside.card_recent_post.sort === 'updated' ? 'updated' : 'date' - - site.posts.sort(sort, -1).limit(postLimit).each(function(article){ - - let link = article.link || article.path - - let title = article.title || _p('no_title') - - let no_cover = article.cover === false || !theme.cover.aside_enable ? 'no-cover' : '' - - let post_cover = article.cover - .aside-list-item(class=no_cover) - if post_cover && theme.cover.aside_enable - a.thumbnail(href=url_for(link) title=title) - if article.cover_type === 'img' - img(src=url_for(post_cover) onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'` alt=title) - else - div(style=`background: ${post_cover}`) - .content - a.title(href=url_for(link) title=title)= title - if theme.aside.card_recent_post.sort === 'updated' - time(datetime=date_xml(article.updated) title=_p('post.updated') + ' ' + full_date(article.updated)) #[=date(article.updated, config.date_format)] - else - time(datetime=date_xml(article.date) title=_p('post.created') + ' ' + full_date(article.date)) #[=date(article.date, config.date_format)] - - }) \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/widget/card_tags.pug b/node_modules/hexo-theme-butterfly/layout/includes/widget/card_tags.pug deleted file mode 100644 index b0aaa97b..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/widget/card_tags.pug +++ /dev/null @@ -1,14 +0,0 @@ -if theme.aside.card_tags.enable - if site.tags.length - .card-widget.card-tags - .item-headline - i.fas.fa-tags - span= _p('aside.card_tags') - - - let { limit, orderby, order } = theme.aside.card_tags - - limit = limit === 0 ? 0 : limit || 40 - - if theme.aside.card_tags.color - .card-tag-cloud!= cloudTags({source: site.tags, orderby: orderby, order: order, minfontsize: 1.15, maxfontsize: 1.45, limit: limit, unit: 'em'}) - else - .card-tag-cloud!= tagcloud({orderby: orderby, order: order, min_font: 1.1, max_font: 1.5, amount: limit , color: true, start_color: '#999', end_color: '#99a9bf', unit: 'em'}) diff --git a/node_modules/hexo-theme-butterfly/layout/includes/widget/card_top_self.pug b/node_modules/hexo-theme-butterfly/layout/includes/widget/card_top_self.pug deleted file mode 100644 index 3cbfca29..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/widget/card_top_self.pug +++ /dev/null @@ -1,8 +0,0 @@ -if site.data.widget && site.data.widget.top - each item in site.data.widget.top - .card-widget(class=item.class_name id=item.id_name) - .item-headline - i(class=item.icon) - span=item.name - .item-content - !=item.html \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/includes/widget/card_webinfo.pug b/node_modules/hexo-theme-butterfly/layout/includes/widget/card_webinfo.pug deleted file mode 100644 index 468ed23c..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/widget/card_webinfo.pug +++ /dev/null @@ -1,35 +0,0 @@ -if theme.aside.card_webinfo.enable - .card-widget.card-webinfo - .item-headline - i.fas.fa-chart-line - span= _p('aside.card_webinfo.headline') - .webinfo - if theme.aside.card_webinfo.post_count - .webinfo-item - .item-name= _p('aside.card_webinfo.article_name') + " :" - .item-count= site.posts.length - if theme.runtimeshow.enable - .webinfo-item - .item-name= _p('aside.card_webinfo.runtime.name') + " :" - .item-count#runtimeshow(data-publishDate=date_xml(theme.runtimeshow.publish_date)) - i.fa-solid.fa-spinner.fa-spin - if theme.wordcount.enable && theme.wordcount.total_wordcount - .webinfo-item - .item-name=_p('aside.card_webinfo.site_wordcount') + " :" - .item-count=totalcount(site) - if theme.busuanzi.site_uv - .webinfo-item - .item-name= _p('aside.card_webinfo.site_uv_name') + " :" - .item-count#busuanzi_value_site_uv - i.fa-solid.fa-spinner.fa-spin - if theme.busuanzi.site_pv - .webinfo-item - .item-name= _p('aside.card_webinfo.site_pv_name') + " :" - .item-count#busuanzi_value_site_pv - i.fa-solid.fa-spinner.fa-spin - if theme.aside.card_webinfo.last_push_date - .webinfo-item - .item-name= _p('aside.card_webinfo.last_push_date.name') + " :" - .item-count#last-push-date(data-lastPushDate=date_xml(Date.now())) - i.fa-solid.fa-spinner.fa-spin - diff --git a/node_modules/hexo-theme-butterfly/layout/includes/widget/index.pug b/node_modules/hexo-theme-butterfly/layout/includes/widget/index.pug deleted file mode 100644 index bdf4fa68..00000000 --- a/node_modules/hexo-theme-butterfly/layout/includes/widget/index.pug +++ /dev/null @@ -1,34 +0,0 @@ -#aside-content.aside-content - //- post - if is_post() - - const tocStyle = page.toc_style_simple - - const tocStyleVal = tocStyle === true || tocStyle === false ? tocStyle : theme.toc.style_simple - if showToc && tocStyleVal - .sticky_layout - include ./card_post_toc.pug - else - !=partial('includes/widget/card_author', {}, {cache: true}) - !=partial('includes/widget/card_announcement', {}, {cache: true}) - !=partial('includes/widget/card_top_self', {}, {cache: true}) - .sticky_layout - if showToc - include ./card_post_toc.pug - !=partial('includes/widget/card_recent_post', {}, {cache: true}) - !=partial('includes/widget/card_ad', {}, {cache: true}) - else - //- page - !=partial('includes/widget/card_author', {}, {cache: true}) - !=partial('includes/widget/card_announcement', {}, {cache: true}) - !=partial('includes/widget/card_top_self', {}, {cache: true}) - - .sticky_layout - if showToc - include ./card_post_toc.pug - !=partial('includes/widget/card_recent_post', {}, {cache: true}) - !=partial('includes/widget/card_ad', {}, {cache: true}) - !=partial('includes/widget/card_newest_comment', {}, {cache: true}) - !=partial('includes/widget/card_categories', {}, {cache: true}) - !=partial('includes/widget/card_tags', {}, {cache: true}) - !=partial('includes/widget/card_archives', {}, {cache: true}) - !=partial('includes/widget/card_webinfo', {}, {cache: true}) - !=partial('includes/widget/card_bottom_self', {}, {cache: true}) \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/index.pug b/node_modules/hexo-theme-butterfly/layout/index.pug deleted file mode 100644 index 651aa4f0..00000000 --- a/node_modules/hexo-theme-butterfly/layout/index.pug +++ /dev/null @@ -1,7 +0,0 @@ -extends includes/layout.pug - -block content - include ./includes/mixins/post-ui.pug - #recent-posts.recent-posts - +postUI - include includes/pagination.pug \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/page.pug b/node_modules/hexo-theme-butterfly/layout/page.pug deleted file mode 100644 index a3f85563..00000000 --- a/node_modules/hexo-theme-butterfly/layout/page.pug +++ /dev/null @@ -1,20 +0,0 @@ -extends includes/layout.pug - -block content - #page - if top_img === false - h1.page-title= page.title - - case page.type - when 'tags' - include includes/page/tags.pug - when 'link' - include includes/page/flink.pug - when 'categories' - include includes/page/categories.pug - default - include includes/page/default-page.pug - - if page.comments !== false && theme.comments && theme.comments.use - - var commentsJsLoad = true - !=partial('includes/third-party/comments/index', {}, {cache: true}) \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/post.pug b/node_modules/hexo-theme-butterfly/layout/post.pug deleted file mode 100644 index e5d7f1a6..00000000 --- a/node_modules/hexo-theme-butterfly/layout/post.pug +++ /dev/null @@ -1,32 +0,0 @@ -extends includes/layout.pug - -block content - #post - if top_img === false - include includes/header/post-info.pug - - article#article-container.post-content!=page.content - include includes/post/post-copyright.pug - .tag_share - if (theme.post_meta.post.tags) - .post-meta__tag-list - each item, index in page.tags.data - a(href=url_for(item.path)).post-meta__tags #[=item.name] - include includes/third-party/share/index.pug - - if theme.reward.enable && theme.reward.QR_code - !=partial('includes/post/reward', {}, {cache: true}) - - //- ad - if theme.ad && theme.ad.post - .ads-wrap!=theme.ad.post - - if theme.post_pagination - include includes/pagination.pug - if theme.related_post && theme.related_post.enable - != related_posts(page,site.posts) - - if page.comments !== false && theme.comments && theme.comments.use - - var commentsJsLoad = true - !=partial('includes/third-party/comments/index', {}, {cache: true}) - \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/layout/tag.pug b/node_modules/hexo-theme-butterfly/layout/tag.pug deleted file mode 100644 index fc0a4814..00000000 --- a/node_modules/hexo-theme-butterfly/layout/tag.pug +++ /dev/null @@ -1,14 +0,0 @@ -extends includes/layout.pug - -block content - if theme.tag_ui == 'index' - include ./includes/mixins/post-ui.pug - #recent-posts.recent-posts - +postUI - include includes/pagination.pug - else - include ./includes/mixins/article-sort.pug - #tag - .article-sort-title= _p('page.tag') + ' - ' + page.tag - +articleSort(page.posts) - include includes/pagination.pug \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/node_modules/.bin/stylus b/node_modules/hexo-theme-butterfly/node_modules/.bin/stylus deleted file mode 100644 index cb2850e2..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/.bin/stylus +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../stylus/bin/stylus" "$@" -else - exec node "$basedir/../stylus/bin/stylus" "$@" -fi diff --git a/node_modules/hexo-theme-butterfly/node_modules/.bin/stylus.cmd b/node_modules/hexo-theme-butterfly/node_modules/.bin/stylus.cmd deleted file mode 100644 index b16efead..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/.bin/stylus.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\stylus\bin\stylus" %* diff --git a/node_modules/hexo-theme-butterfly/node_modules/.bin/stylus.ps1 b/node_modules/hexo-theme-butterfly/node_modules/.bin/stylus.ps1 deleted file mode 100644 index 191cd10a..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/.bin/stylus.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../stylus/bin/stylus" $args - } else { - & "$basedir/node$exe" "$basedir/../stylus/bin/stylus" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../stylus/bin/stylus" $args - } else { - & "node$exe" "$basedir/../stylus/bin/stylus" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/node_modules/hexo-theme-butterfly/node_modules/debug/LICENSE b/node_modules/hexo-theme-butterfly/node_modules/debug/LICENSE deleted file mode 100644 index a7a3b3bf..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/debug/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -(The MIT License) - -Copyright (c) 2014-2017 TJ Holowaychuk -Copyright (c) 2018-2021 Josh Junon - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the 'Software'), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial -portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT -LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/node_modules/hexo-theme-butterfly/node_modules/debug/README.md b/node_modules/hexo-theme-butterfly/node_modules/debug/README.md deleted file mode 100644 index 036f9f2e..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/debug/README.md +++ /dev/null @@ -1,481 +0,0 @@ -# debug -[![Build Status](https://travis-ci.org/debug-js/debug.svg?branch=master)](https://travis-ci.org/debug-js/debug) [![Coverage Status](https://coveralls.io/repos/github/debug-js/debug/badge.svg?branch=master)](https://coveralls.io/github/debug-js/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) -[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) - - - -A tiny JavaScript debugging utility modelled after Node.js core's debugging -technique. Works in Node.js and web browsers. - -## Installation - -```bash -$ npm install debug -``` - -## Usage - -`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. - -Example [_app.js_](./examples/node/app.js): - -```js -var debug = require('debug')('http') - , http = require('http') - , name = 'My App'; - -// fake app - -debug('booting %o', name); - -http.createServer(function(req, res){ - debug(req.method + ' ' + req.url); - res.end('hello\n'); -}).listen(3000, function(){ - debug('listening'); -}); - -// fake worker of some kind - -require('./worker'); -``` - -Example [_worker.js_](./examples/node/worker.js): - -```js -var a = require('debug')('worker:a') - , b = require('debug')('worker:b'); - -function work() { - a('doing lots of uninteresting work'); - setTimeout(work, Math.random() * 1000); -} - -work(); - -function workb() { - b('doing some work'); - setTimeout(workb, Math.random() * 2000); -} - -workb(); -``` - -The `DEBUG` environment variable is then used to enable these based on space or -comma-delimited names. - -Here are some examples: - -screen shot 2017-08-08 at 12 53 04 pm -screen shot 2017-08-08 at 12 53 38 pm -screen shot 2017-08-08 at 12 53 25 pm - -#### Windows command prompt notes - -##### CMD - -On Windows the environment variable is set using the `set` command. - -```cmd -set DEBUG=*,-not_this -``` - -Example: - -```cmd -set DEBUG=* & node app.js -``` - -##### PowerShell (VS Code default) - -PowerShell uses different syntax to set environment variables. - -```cmd -$env:DEBUG = "*,-not_this" -``` - -Example: - -```cmd -$env:DEBUG='app';node app.js -``` - -Then, run the program to be debugged as usual. - -npm script example: -```js - "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", -``` - -## Namespace Colors - -Every debug instance has a color generated for it based on its namespace name. -This helps when visually parsing the debug output to identify which debug instance -a debug line belongs to. - -#### Node.js - -In Node.js, colors are enabled when stderr is a TTY. You also _should_ install -the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, -otherwise debug will only use a small handful of basic colors. - - - -#### Web Browser - -Colors are also enabled on "Web Inspectors" that understand the `%c` formatting -option. These are WebKit web inspectors, Firefox ([since version -31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) -and the Firebug plugin for Firefox (any version). - - - - -## Millisecond diff - -When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. - - - -When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: - - - - -## Conventions - -If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. - -## Wildcards - -The `*` character may be used as a wildcard. Suppose for example your library has -debuggers named "connect:bodyParser", "connect:compress", "connect:session", -instead of listing all three with -`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do -`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. - -You can also exclude specific debuggers by prefixing them with a "-" character. -For example, `DEBUG=*,-connect:*` would include all debuggers except those -starting with "connect:". - -## Environment Variables - -When running through Node.js, you can set a few environment variables that will -change the behavior of the debug logging: - -| Name | Purpose | -|-----------|-------------------------------------------------| -| `DEBUG` | Enables/disables specific debugging namespaces. | -| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | -| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | -| `DEBUG_DEPTH` | Object inspection depth. | -| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | - - -__Note:__ The environment variables beginning with `DEBUG_` end up being -converted into an Options object that gets used with `%o`/`%O` formatters. -See the Node.js documentation for -[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) -for the complete list. - -## Formatters - -Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. -Below are the officially supported formatters: - -| Formatter | Representation | -|-----------|----------------| -| `%O` | Pretty-print an Object on multiple lines. | -| `%o` | Pretty-print an Object all on a single line. | -| `%s` | String. | -| `%d` | Number (both integer and float). | -| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | -| `%%` | Single percent sign ('%'). This does not consume an argument. | - - -### Custom formatters - -You can add custom formatters by extending the `debug.formatters` object. -For example, if you wanted to add support for rendering a Buffer as hex with -`%h`, you could do something like: - -```js -const createDebug = require('debug') -createDebug.formatters.h = (v) => { - return v.toString('hex') -} - -// …elsewhere -const debug = createDebug('foo') -debug('this is hex: %h', new Buffer('hello world')) -// foo this is hex: 68656c6c6f20776f726c6421 +0ms -``` - - -## Browser Support - -You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), -or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), -if you don't want to build it yourself. - -Debug's enable state is currently persisted by `localStorage`. -Consider the situation shown below where you have `worker:a` and `worker:b`, -and wish to debug both. You can enable this using `localStorage.debug`: - -```js -localStorage.debug = 'worker:*' -``` - -And then refresh the page. - -```js -a = debug('worker:a'); -b = debug('worker:b'); - -setInterval(function(){ - a('doing some work'); -}, 1000); - -setInterval(function(){ - b('doing some work'); -}, 1200); -``` - -In Chromium-based web browsers (e.g. Brave, Chrome, and Electron), the JavaScript console will—by default—only show messages logged by `debug` if the "Verbose" log level is _enabled_. - - - -## Output streams - - By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: - -Example [_stdout.js_](./examples/node/stdout.js): - -```js -var debug = require('debug'); -var error = debug('app:error'); - -// by default stderr is used -error('goes to stderr!'); - -var log = debug('app:log'); -// set this namespace to log via console.log -log.log = console.log.bind(console); // don't forget to bind to console! -log('goes to stdout'); -error('still goes to stderr!'); - -// set all output to go via console.info -// overrides all per-namespace log settings -debug.log = console.info.bind(console); -error('now goes to stdout via console.info'); -log('still goes to stdout, but via console.info now'); -``` - -## Extend -You can simply extend debugger -```js -const log = require('debug')('auth'); - -//creates new debug instance with extended namespace -const logSign = log.extend('sign'); -const logLogin = log.extend('login'); - -log('hello'); // auth hello -logSign('hello'); //auth:sign hello -logLogin('hello'); //auth:login hello -``` - -## Set dynamically - -You can also enable debug dynamically by calling the `enable()` method : - -```js -let debug = require('debug'); - -console.log(1, debug.enabled('test')); - -debug.enable('test'); -console.log(2, debug.enabled('test')); - -debug.disable(); -console.log(3, debug.enabled('test')); - -``` - -print : -``` -1 false -2 true -3 false -``` - -Usage : -`enable(namespaces)` -`namespaces` can include modes separated by a colon and wildcards. - -Note that calling `enable()` completely overrides previously set DEBUG variable : - -``` -$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))' -=> false -``` - -`disable()` - -Will disable all namespaces. The functions returns the namespaces currently -enabled (and skipped). This can be useful if you want to disable debugging -temporarily without knowing what was enabled to begin with. - -For example: - -```js -let debug = require('debug'); -debug.enable('foo:*,-foo:bar'); -let namespaces = debug.disable(); -debug.enable(namespaces); -``` - -Note: There is no guarantee that the string will be identical to the initial -enable string, but semantically they will be identical. - -## Checking whether a debug target is enabled - -After you've created a debug instance, you can determine whether or not it is -enabled by checking the `enabled` property: - -```javascript -const debug = require('debug')('http'); - -if (debug.enabled) { - // do stuff... -} -``` - -You can also manually toggle this property to force the debug instance to be -enabled or disabled. - -## Usage in child processes - -Due to the way `debug` detects if the output is a TTY or not, colors are not shown in child processes when `stderr` is piped. A solution is to pass the `DEBUG_COLORS=1` environment variable to the child process. -For example: - -```javascript -worker = fork(WORKER_WRAP_PATH, [workerPath], { - stdio: [ - /* stdin: */ 0, - /* stdout: */ 'pipe', - /* stderr: */ 'pipe', - 'ipc', - ], - env: Object.assign({}, process.env, { - DEBUG_COLORS: 1 // without this settings, colors won't be shown - }), -}); - -worker.stderr.pipe(process.stderr, { end: false }); -``` - - -## Authors - - - TJ Holowaychuk - - Nathan Rajlich - - Andrew Rhyne - - Josh Junon - -## Backers - -Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -## Sponsors - -Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -## License - -(The MIT License) - -Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> -Copyright (c) 2018-2021 Josh Junon - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/hexo-theme-butterfly/node_modules/debug/package.json b/node_modules/hexo-theme-butterfly/node_modules/debug/package.json deleted file mode 100644 index 001978d8..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/debug/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "debug", - "version": "4.3.4", - "repository": { - "type": "git", - "url": "git://github.com/debug-js/debug.git" - }, - "description": "Lightweight debugging utility for Node.js and the browser", - "keywords": [ - "debug", - "log", - "debugger" - ], - "files": [ - "src", - "LICENSE", - "README.md" - ], - "author": "Josh Junon ", - "contributors": [ - "TJ Holowaychuk ", - "Nathan Rajlich (http://n8.io)", - "Andrew Rhyne " - ], - "license": "MIT", - "scripts": { - "lint": "xo", - "test": "npm run test:node && npm run test:browser && npm run lint", - "test:node": "istanbul cover _mocha -- test.js", - "test:browser": "karma start --single-run", - "test:coverage": "cat ./coverage/lcov.info | coveralls" - }, - "dependencies": { - "ms": "2.1.2" - }, - "devDependencies": { - "brfs": "^2.0.1", - "browserify": "^16.2.3", - "coveralls": "^3.0.2", - "istanbul": "^0.4.5", - "karma": "^3.1.4", - "karma-browserify": "^6.0.0", - "karma-chrome-launcher": "^2.2.0", - "karma-mocha": "^1.3.0", - "mocha": "^5.2.0", - "mocha-lcov-reporter": "^1.2.0", - "xo": "^0.23.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - }, - "main": "./src/index.js", - "browser": "./src/browser.js", - "engines": { - "node": ">=6.0" - } -} diff --git a/node_modules/hexo-theme-butterfly/node_modules/debug/src/browser.js b/node_modules/hexo-theme-butterfly/node_modules/debug/src/browser.js deleted file mode 100644 index 686f2b7f..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/debug/src/browser.js +++ /dev/null @@ -1,269 +0,0 @@ -/* eslint-env browser */ - -/** - * This is the web browser implementation of `debug()`. - */ - -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; -exports.storage = localstorage(); -exports.destroy = (() => { - let warned = false; - - return () => { - if (!warned) { - warned = true; - console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); - } - }; -})(); - -/** - * Colors. - */ - -exports.colors = [ - '#0000CC', - '#0000FF', - '#0033CC', - '#0033FF', - '#0066CC', - '#0066FF', - '#0099CC', - '#0099FF', - '#00CC00', - '#00CC33', - '#00CC66', - '#00CC99', - '#00CCCC', - '#00CCFF', - '#3300CC', - '#3300FF', - '#3333CC', - '#3333FF', - '#3366CC', - '#3366FF', - '#3399CC', - '#3399FF', - '#33CC00', - '#33CC33', - '#33CC66', - '#33CC99', - '#33CCCC', - '#33CCFF', - '#6600CC', - '#6600FF', - '#6633CC', - '#6633FF', - '#66CC00', - '#66CC33', - '#9900CC', - '#9900FF', - '#9933CC', - '#9933FF', - '#99CC00', - '#99CC33', - '#CC0000', - '#CC0033', - '#CC0066', - '#CC0099', - '#CC00CC', - '#CC00FF', - '#CC3300', - '#CC3333', - '#CC3366', - '#CC3399', - '#CC33CC', - '#CC33FF', - '#CC6600', - '#CC6633', - '#CC9900', - '#CC9933', - '#CCCC00', - '#CCCC33', - '#FF0000', - '#FF0033', - '#FF0066', - '#FF0099', - '#FF00CC', - '#FF00FF', - '#FF3300', - '#FF3333', - '#FF3366', - '#FF3399', - '#FF33CC', - '#FF33FF', - '#FF6600', - '#FF6633', - '#FF9900', - '#FF9933', - '#FFCC00', - '#FFCC33' -]; - -/** - * Currently only WebKit-based Web Inspectors, Firefox >= v31, - * and the Firebug extension (any Firefox version) are known - * to support "%c" CSS customizations. - * - * TODO: add a `localStorage` variable to explicitly enable/disable colors - */ - -// eslint-disable-next-line complexity -function useColors() { - // NB: In an Electron preload script, document will be defined but not fully - // initialized. Since we know we're in Chrome, we'll just detect this case - // explicitly - if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { - return true; - } - - // Internet Explorer and Edge do not support colors. - if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { - return false; - } - - // Is webkit? http://stackoverflow.com/a/16459606/376773 - // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 - return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || - // Is firebug? http://stackoverflow.com/a/398120/376773 - (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || - // Is firefox >= v31? - // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || - // Double check webkit in userAgent just in case we are in a worker - (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); -} - -/** - * Colorize log arguments if enabled. - * - * @api public - */ - -function formatArgs(args) { - args[0] = (this.useColors ? '%c' : '') + - this.namespace + - (this.useColors ? ' %c' : ' ') + - args[0] + - (this.useColors ? '%c ' : ' ') + - '+' + module.exports.humanize(this.diff); - - if (!this.useColors) { - return; - } - - const c = 'color: ' + this.color; - args.splice(1, 0, c, 'color: inherit'); - - // The final "%c" is somewhat tricky, because there could be other - // arguments passed either before or after the %c, so we need to - // figure out the correct index to insert the CSS into - let index = 0; - let lastC = 0; - args[0].replace(/%[a-zA-Z%]/g, match => { - if (match === '%%') { - return; - } - index++; - if (match === '%c') { - // We only are interested in the *last* %c - // (the user may have provided their own) - lastC = index; - } - }); - - args.splice(lastC, 0, c); -} - -/** - * Invokes `console.debug()` when available. - * No-op when `console.debug` is not a "function". - * If `console.debug` is not available, falls back - * to `console.log`. - * - * @api public - */ -exports.log = console.debug || console.log || (() => {}); - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ -function save(namespaces) { - try { - if (namespaces) { - exports.storage.setItem('debug', namespaces); - } else { - exports.storage.removeItem('debug'); - } - } catch (error) { - // Swallow - // XXX (@Qix-) should we be logging these? - } -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ -function load() { - let r; - try { - r = exports.storage.getItem('debug'); - } catch (error) { - // Swallow - // XXX (@Qix-) should we be logging these? - } - - // If debug isn't set in LS, and we're in Electron, try to load $DEBUG - if (!r && typeof process !== 'undefined' && 'env' in process) { - r = process.env.DEBUG; - } - - return r; -} - -/** - * Localstorage attempts to return the localstorage. - * - * This is necessary because safari throws - * when a user disables cookies/localstorage - * and you attempt to access it. - * - * @return {LocalStorage} - * @api private - */ - -function localstorage() { - try { - // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context - // The Browser also has localStorage in the global context. - return localStorage; - } catch (error) { - // Swallow - // XXX (@Qix-) should we be logging these? - } -} - -module.exports = require('./common')(exports); - -const {formatters} = module.exports; - -/** - * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. - */ - -formatters.j = function (v) { - try { - return JSON.stringify(v); - } catch (error) { - return '[UnexpectedJSONParseError]: ' + error.message; - } -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/debug/src/common.js b/node_modules/hexo-theme-butterfly/node_modules/debug/src/common.js deleted file mode 100644 index 9b2b0c57..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/debug/src/common.js +++ /dev/null @@ -1,274 +0,0 @@ - -/** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - */ - -function setup(env) { - createDebug.debug = createDebug; - createDebug.default = createDebug; - createDebug.coerce = coerce; - createDebug.disable = disable; - createDebug.enable = enable; - createDebug.enabled = enabled; - createDebug.humanize = require('ms'); - createDebug.destroy = destroy; - - Object.keys(env).forEach(key => { - createDebug[key] = env[key]; - }); - - /** - * The currently active debug mode names, and names to skip. - */ - - createDebug.names = []; - createDebug.skips = []; - - /** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". - */ - createDebug.formatters = {}; - - /** - * Selects a color for a debug namespace - * @param {String} namespace The namespace string for the debug instance to be colored - * @return {Number|String} An ANSI color code for the given namespace - * @api private - */ - function selectColor(namespace) { - let hash = 0; - - for (let i = 0; i < namespace.length; i++) { - hash = ((hash << 5) - hash) + namespace.charCodeAt(i); - hash |= 0; // Convert to 32bit integer - } - - return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; - } - createDebug.selectColor = selectColor; - - /** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ - function createDebug(namespace) { - let prevTime; - let enableOverride = null; - let namespacesCache; - let enabledCache; - - function debug(...args) { - // Disabled? - if (!debug.enabled) { - return; - } - - const self = debug; - - // Set `diff` timestamp - const curr = Number(new Date()); - const ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; - - args[0] = createDebug.coerce(args[0]); - - if (typeof args[0] !== 'string') { - // Anything else let's inspect with %O - args.unshift('%O'); - } - - // Apply any `formatters` transformations - let index = 0; - args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { - // If we encounter an escaped % then don't increase the array index - if (match === '%%') { - return '%'; - } - index++; - const formatter = createDebug.formatters[format]; - if (typeof formatter === 'function') { - const val = args[index]; - match = formatter.call(self, val); - - // Now we need to remove `args[index]` since it's inlined in the `format` - args.splice(index, 1); - index--; - } - return match; - }); - - // Apply env-specific formatting (colors, etc.) - createDebug.formatArgs.call(self, args); - - const logFn = self.log || createDebug.log; - logFn.apply(self, args); - } - - debug.namespace = namespace; - debug.useColors = createDebug.useColors(); - debug.color = createDebug.selectColor(namespace); - debug.extend = extend; - debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. - - Object.defineProperty(debug, 'enabled', { - enumerable: true, - configurable: false, - get: () => { - if (enableOverride !== null) { - return enableOverride; - } - if (namespacesCache !== createDebug.namespaces) { - namespacesCache = createDebug.namespaces; - enabledCache = createDebug.enabled(namespace); - } - - return enabledCache; - }, - set: v => { - enableOverride = v; - } - }); - - // Env-specific initialization logic for debug instances - if (typeof createDebug.init === 'function') { - createDebug.init(debug); - } - - return debug; - } - - function extend(namespace, delimiter) { - const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); - newDebug.log = this.log; - return newDebug; - } - - /** - * Enables a debug mode by namespaces. This can include modes - * separated by a colon and wildcards. - * - * @param {String} namespaces - * @api public - */ - function enable(namespaces) { - createDebug.save(namespaces); - createDebug.namespaces = namespaces; - - createDebug.names = []; - createDebug.skips = []; - - let i; - const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); - const len = split.length; - - for (i = 0; i < len; i++) { - if (!split[i]) { - // ignore empty strings - continue; - } - - namespaces = split[i].replace(/\*/g, '.*?'); - - if (namespaces[0] === '-') { - createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$')); - } else { - createDebug.names.push(new RegExp('^' + namespaces + '$')); - } - } - } - - /** - * Disable debug output. - * - * @return {String} namespaces - * @api public - */ - function disable() { - const namespaces = [ - ...createDebug.names.map(toNamespace), - ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) - ].join(','); - createDebug.enable(''); - return namespaces; - } - - /** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ - function enabled(name) { - if (name[name.length - 1] === '*') { - return true; - } - - let i; - let len; - - for (i = 0, len = createDebug.skips.length; i < len; i++) { - if (createDebug.skips[i].test(name)) { - return false; - } - } - - for (i = 0, len = createDebug.names.length; i < len; i++) { - if (createDebug.names[i].test(name)) { - return true; - } - } - - return false; - } - - /** - * Convert regexp to namespace - * - * @param {RegExp} regxep - * @return {String} namespace - * @api private - */ - function toNamespace(regexp) { - return regexp.toString() - .substring(2, regexp.toString().length - 2) - .replace(/\.\*\?$/, '*'); - } - - /** - * Coerce `val`. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - function coerce(val) { - if (val instanceof Error) { - return val.stack || val.message; - } - return val; - } - - /** - * XXX DO NOT USE. This is a temporary stub function. - * XXX It WILL be removed in the next major release. - */ - function destroy() { - console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); - } - - createDebug.enable(createDebug.load()); - - return createDebug; -} - -module.exports = setup; diff --git a/node_modules/hexo-theme-butterfly/node_modules/debug/src/index.js b/node_modules/hexo-theme-butterfly/node_modules/debug/src/index.js deleted file mode 100644 index da32839c..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/debug/src/index.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Detect Electron renderer / nwjs process, which is node, but we should - * treat as a browser. - */ - -if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { - module.exports = require('./browser.js'); -} else { - module.exports = require('./node.js'); -} diff --git a/node_modules/hexo-theme-butterfly/node_modules/debug/src/node.js b/node_modules/hexo-theme-butterfly/node_modules/debug/src/node.js deleted file mode 100644 index eed1f0ee..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/debug/src/node.js +++ /dev/null @@ -1,263 +0,0 @@ -/** - * Module dependencies. - */ - -const tty = require('tty'); -const util = require('util'); - -/** - * This is the Node.js implementation of `debug()`. - */ - -exports.init = init; -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; -exports.destroy = util.deprecate( - () => {}, - 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' -); - -/** - * Colors. - */ - -exports.colors = [6, 2, 3, 4, 5, 1]; - -try { - // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) - // eslint-disable-next-line import/no-extraneous-dependencies - const supportsColor = require('supports-color'); - - if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { - exports.colors = [ - 20, - 21, - 26, - 27, - 32, - 33, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 56, - 57, - 62, - 63, - 68, - 69, - 74, - 75, - 76, - 77, - 78, - 79, - 80, - 81, - 92, - 93, - 98, - 99, - 112, - 113, - 128, - 129, - 134, - 135, - 148, - 149, - 160, - 161, - 162, - 163, - 164, - 165, - 166, - 167, - 168, - 169, - 170, - 171, - 172, - 173, - 178, - 179, - 184, - 185, - 196, - 197, - 198, - 199, - 200, - 201, - 202, - 203, - 204, - 205, - 206, - 207, - 208, - 209, - 214, - 215, - 220, - 221 - ]; - } -} catch (error) { - // Swallow - we only care if `supports-color` is available; it doesn't have to be. -} - -/** - * Build up the default `inspectOpts` object from the environment variables. - * - * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js - */ - -exports.inspectOpts = Object.keys(process.env).filter(key => { - return /^debug_/i.test(key); -}).reduce((obj, key) => { - // Camel-case - const prop = key - .substring(6) - .toLowerCase() - .replace(/_([a-z])/g, (_, k) => { - return k.toUpperCase(); - }); - - // Coerce string value into JS value - let val = process.env[key]; - if (/^(yes|on|true|enabled)$/i.test(val)) { - val = true; - } else if (/^(no|off|false|disabled)$/i.test(val)) { - val = false; - } else if (val === 'null') { - val = null; - } else { - val = Number(val); - } - - obj[prop] = val; - return obj; -}, {}); - -/** - * Is stdout a TTY? Colored output is enabled when `true`. - */ - -function useColors() { - return 'colors' in exports.inspectOpts ? - Boolean(exports.inspectOpts.colors) : - tty.isatty(process.stderr.fd); -} - -/** - * Adds ANSI color escape codes if enabled. - * - * @api public - */ - -function formatArgs(args) { - const {namespace: name, useColors} = this; - - if (useColors) { - const c = this.color; - const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); - const prefix = ` ${colorCode};1m${name} \u001B[0m`; - - args[0] = prefix + args[0].split('\n').join('\n' + prefix); - args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); - } else { - args[0] = getDate() + name + ' ' + args[0]; - } -} - -function getDate() { - if (exports.inspectOpts.hideDate) { - return ''; - } - return new Date().toISOString() + ' '; -} - -/** - * Invokes `util.format()` with the specified arguments and writes to stderr. - */ - -function log(...args) { - return process.stderr.write(util.format(...args) + '\n'); -} - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ -function save(namespaces) { - if (namespaces) { - process.env.DEBUG = namespaces; - } else { - // If you set a process.env field to null or undefined, it gets cast to the - // string 'null' or 'undefined'. Just delete instead. - delete process.env.DEBUG; - } -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - -function load() { - return process.env.DEBUG; -} - -/** - * Init logic for `debug` instances. - * - * Create a new `inspectOpts` object in case `useColors` is set - * differently for a particular `debug` instance. - */ - -function init(debug) { - debug.inspectOpts = {}; - - const keys = Object.keys(exports.inspectOpts); - for (let i = 0; i < keys.length; i++) { - debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; - } -} - -module.exports = require('./common')(exports); - -const {formatters} = module.exports; - -/** - * Map %o to `util.inspect()`, all on a single line. - */ - -formatters.o = function (v) { - this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts) - .split('\n') - .map(str => str.trim()) - .join(' '); -}; - -/** - * Map %O to `util.inspect()`, allowing multiple lines if needed. - */ - -formatters.O = function (v) { - this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts); -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/hexo-renderer-stylus/LICENSE b/node_modules/hexo-theme-butterfly/node_modules/hexo-renderer-stylus/LICENSE deleted file mode 100644 index 1cd7bda4..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/hexo-renderer-stylus/LICENSE +++ /dev/null @@ -1,7 +0,0 @@ -Copyright (c) 2014 Tommy Chen - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/node_modules/hexo-renderer-stylus/README.md b/node_modules/hexo-theme-butterfly/node_modules/hexo-renderer-stylus/README.md deleted file mode 100644 index 475a1b14..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/hexo-renderer-stylus/README.md +++ /dev/null @@ -1,98 +0,0 @@ -# hexo-renderer-stylus - -[![Build Status](https://github.com/hexojs/hexo-renderer-stylus/workflows/Tester/badge.svg)](https://github.com/hexojs/hexo-renderer-stylus/actions/workflows/tester.yml) -[![NPM version](https://badge.fury.io/js/hexo-renderer-stylus.svg)](https://www.npmjs.com/package/hexo-renderer-stylus) -[![Coverage Status](https://img.shields.io/coveralls/hexojs/hexo-renderer-stylus.svg)](https://coveralls.io/r/hexojs/hexo-renderer-stylus?branch=master) - -Add support for [Stylus] with [nib] and other plugins. - -## Install - -Prerequisites: -- Hexo 3: >= 0.2 -- Hexo 2: 0.1.x - -``` bash -$ npm install hexo-renderer-stylus --save -``` - -## Options - -You can configure this plugin in `_config.yml`. - -``` yaml -stylus: - compress: false - sourcemaps: - comment: true - inline: true - sourceRoot: '' - basePath: . - plugins: 'nib' -``` - -- **compress** - Compress generated CSS (default: `false`) -- **sourcemaps** - - **comment** - Adds a comment with the `sourceMappingURL` to the generated CSS (default: `true`) - - **inline** - Inlines the sourcemap with full source text in base64 format (default: `false`) - - **sourceRoot** - `sourceRoot` property of the generated sourcemap - - **basePath** - Base path from which sourcemap and all sources are relative (default: `.`) -- **plugins** - Stylus plugin(s) (default: `nib`) - -## Setting Stylus variables - -It is possible to set variables that can be used in Stylus. -The purpose of setting variable is to avoid direct modification of the Stylus code, -and thus to make themes more generic - -For example, instead of hardcoding: -```stylus -div - color #FFCC44 -``` - -You can refer to a variable: -```stylus -div - color convert(hexo-config("moody_red")) -``` - -And in your **theme's** configuration, you can define this variable: -```yml -moody_red: "#8B0001" -``` - -(The "convert" function above is here to convert the string into an actual stylus color) - -You can also use the theme_config variable in the main `_config.yml`: -```yml -theme_config: - moody_red: "#8B0001" -``` - -[Stylus]: https://stylus-lang.com/ -[nib]: https://stylus.github.io/nib/ - -## Extensibility - -This plugin provide a filter `stylus:renderer` to allows you extend it. When there's something you cannot do in Stylus, define it in JavaScript! - -For example, to define some global variable: - -```js -hexo.extend.filter.register('stylus:renderer', function(style) { - style - // we may define a global variable by passing a `Node` - .define('has-canvas', require('stylus').nodes.false); - // stylus also casts JavaScript values to their Stylus equivalents when possible - .define('families', ['Helvetica Neue', 'Helvetica', 'sans-serif']) - // also allows you to provide a JavaScript-defined function to Stylus - .define('get-list', function(){ - return ['foo', 'bar', 'baz']; - }); -}) -``` - -Save the file in "scripts/" folder and run Hexo as usual. - -Notice: for more JavaScript api, refer to stylus's [documentation](https://stylus-lang.com/docs/js.html). diff --git a/node_modules/hexo-theme-butterfly/node_modules/hexo-renderer-stylus/index.js b/node_modules/hexo-theme-butterfly/node_modules/hexo-renderer-stylus/index.js deleted file mode 100644 index a407eab8..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/hexo-renderer-stylus/index.js +++ /dev/null @@ -1,7 +0,0 @@ -/* global hexo */ -'use strict'; - -const renderer = require('./lib/renderer'); - -hexo.extend.renderer.register('styl', 'css', renderer); -hexo.extend.renderer.register('stylus', 'css', renderer); diff --git a/node_modules/hexo-theme-butterfly/node_modules/hexo-renderer-stylus/lib/renderer.js b/node_modules/hexo-theme-butterfly/node_modules/hexo-renderer-stylus/lib/renderer.js deleted file mode 100644 index b989018e..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/hexo-renderer-stylus/lib/renderer.js +++ /dev/null @@ -1,64 +0,0 @@ -'use strict'; - -const stylus = require('stylus'); - -function getProperty(obj, name) { - name = name.replace(/\[(\w+)\]/g, '.$1').replace(/^\./, ''); - - const split = name.split('.'); - let key = split.shift(); - - if (!Object.prototype.hasOwnProperty.call(obj, key)) return ''; - - let result = obj[key]; - const len = split.length; - - if (!len) return result || ''; - if (typeof result !== 'object') return ''; - - for (let i = 0; i < len; i++) { - key = split[i]; - if (!Object.prototype.hasOwnProperty.call(result, key)) return ''; - - result = result[split[i]]; - if (typeof result !== 'object') return result; - } - - return result; -} - -function applyPlugins(stylusConfig, plugins) { - plugins.forEach(plugin => { - const factoryFn = require(plugin.trim()); - stylusConfig.use(factoryFn()); - }); -} - -function stylusFn(data, options, callback) { - const config = this.config.stylus || {}; - const self = this; - const plugins = ['nib'].concat(config.plugins || []); - - function defineConfig(style) { - style.define('hexo-config', data => { - return getProperty(self.theme.config, data.val); - }); - } - - const stylusConfig = stylus(data.text); - - applyPlugins(stylusConfig, plugins); - - stylusConfig - .use(defineConfig) - .use(style => this.execFilterSync('stylus:renderer', style, {context: this})) - .set('filename', data.path) - .set('sourcemap', config.sourcemaps) - .set('compress', config.compress) - .set('include css', true) - .render(callback); -} - -stylusFn.disableNunjucks = true; - -module.exports = stylusFn; diff --git a/node_modules/hexo-theme-butterfly/node_modules/hexo-renderer-stylus/package.json b/node_modules/hexo-theme-butterfly/node_modules/hexo-renderer-stylus/package.json deleted file mode 100644 index d2fa82d8..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/hexo-renderer-stylus/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "hexo-renderer-stylus", - "version": "3.0.0", - "description": "Stylus renderer plugin for Hexo", - "main": "index", - "scripts": { - "eslint": "eslint .", - "test": "mocha test/index.js", - "test-cov": "c8 --reporter=lcovonly --reporter=text npm run test" - }, - "directories": { - "lib": "./lib" - }, - "files": [ - "lib", - "index.js" - ], - "repository": "hexojs/hexo-renderer-stylus", - "keywords": [ - "hexo", - "stylus", - "css", - "style", - "stylesheet", - "styl", - "renderer" - ], - "author": "Tommy Chen (https://zespia.tw)", - "license": "MIT", - "dependencies": { - "nib": "^1.2.0", - "stylus": "^0.59.0" - }, - "devDependencies": { - "c8": "^7.13.0", - "chai": "^4.3.7", - "eslint": "^8.40.0", - "eslint-config-hexo": "^5.0.0", - "hexo": "^6.3.0", - "mocha": "^10.2.0" - }, - "engines": { - "node": ">=14" - } -} diff --git a/node_modules/hexo-theme-butterfly/node_modules/ms/index.js b/node_modules/hexo-theme-butterfly/node_modules/ms/index.js deleted file mode 100644 index d56896ba..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/ms/index.js +++ /dev/null @@ -1,162 +0,0 @@ -/** - * Helpers. - */ - -var s = 1000; -var m = s * 60; -var h = m * 60; -var d = h * 24; -var w = d * 7; -var y = d * 365.25; - -/** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} [options] - * @throws {Error} throw an error if val is not a non-empty string or a number - * @return {String|Number} - * @api public - */ - -module.exports = function(val, options) { - options = options || {}; - var type = typeof val; - if (type === 'string' && val.length > 0) { - return parse(val); - } else if (type === 'number' && isFinite(val)) { - return options.long ? fmtLong(val) : fmtShort(val); - } - throw new Error( - 'val is not a non-empty string or a valid number. val=' + - JSON.stringify(val) - ); -}; - -/** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ - -function parse(str) { - str = String(str); - if (str.length > 100) { - return; - } - var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( - str - ); - if (!match) { - return; - } - var n = parseFloat(match[1]); - var type = (match[2] || 'ms').toLowerCase(); - switch (type) { - case 'years': - case 'year': - case 'yrs': - case 'yr': - case 'y': - return n * y; - case 'weeks': - case 'week': - case 'w': - return n * w; - case 'days': - case 'day': - case 'd': - return n * d; - case 'hours': - case 'hour': - case 'hrs': - case 'hr': - case 'h': - return n * h; - case 'minutes': - case 'minute': - case 'mins': - case 'min': - case 'm': - return n * m; - case 'seconds': - case 'second': - case 'secs': - case 'sec': - case 's': - return n * s; - case 'milliseconds': - case 'millisecond': - case 'msecs': - case 'msec': - case 'ms': - return n; - default: - return undefined; - } -} - -/** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function fmtShort(ms) { - var msAbs = Math.abs(ms); - if (msAbs >= d) { - return Math.round(ms / d) + 'd'; - } - if (msAbs >= h) { - return Math.round(ms / h) + 'h'; - } - if (msAbs >= m) { - return Math.round(ms / m) + 'm'; - } - if (msAbs >= s) { - return Math.round(ms / s) + 's'; - } - return ms + 'ms'; -} - -/** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function fmtLong(ms) { - var msAbs = Math.abs(ms); - if (msAbs >= d) { - return plural(ms, msAbs, d, 'day'); - } - if (msAbs >= h) { - return plural(ms, msAbs, h, 'hour'); - } - if (msAbs >= m) { - return plural(ms, msAbs, m, 'minute'); - } - if (msAbs >= s) { - return plural(ms, msAbs, s, 'second'); - } - return ms + ' ms'; -} - -/** - * Pluralization helper. - */ - -function plural(ms, msAbs, n, name) { - var isPlural = msAbs >= n * 1.5; - return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); -} diff --git a/node_modules/hexo-theme-butterfly/node_modules/ms/license.md b/node_modules/hexo-theme-butterfly/node_modules/ms/license.md deleted file mode 100644 index 2485f3ac..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/ms/license.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Zeit, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/hexo-theme-butterfly/node_modules/ms/package.json b/node_modules/hexo-theme-butterfly/node_modules/ms/package.json deleted file mode 100644 index ed3960d3..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/ms/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "ms", - "version": "2.1.2", - "description": "Tiny millisecond conversion utility", - "repository": "zeit/ms", - "main": "./index", - "files": [ - "index.js" - ], - "scripts": { - "precommit": "lint-staged", - "lint": "eslint lib/* bin/*", - "test": "mocha tests.js" - }, - "eslintConfig": { - "extends": "eslint:recommended", - "env": { - "node": true, - "es6": true - } - }, - "lint-staged": { - "*.js": [ - "npm run lint", - "prettier --single-quote --write", - "git add" - ] - }, - "license": "MIT", - "devDependencies": { - "eslint": "4.12.1", - "expect.js": "0.3.1", - "husky": "0.14.3", - "lint-staged": "5.0.0", - "mocha": "4.0.1" - } -} diff --git a/node_modules/hexo-theme-butterfly/node_modules/ms/readme.md b/node_modules/hexo-theme-butterfly/node_modules/ms/readme.md deleted file mode 100644 index 8964411b..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/ms/readme.md +++ /dev/null @@ -1,60 +0,0 @@ -# ms - -[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) -[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit) - -Use this package to easily convert various time formats to milliseconds. - -## Examples - -```js -ms('2 days') // 172800000 -ms('1d') // 86400000 -ms('10h') // 36000000 -ms('2.5 hrs') // 9000000 -ms('2h') // 7200000 -ms('1m') // 60000 -ms('5s') // 5000 -ms('1y') // 31557600000 -ms('100') // 100 -ms('-3 days') // -259200000 -ms('-1h') // -3600000 -ms('-200') // -200 -``` - -### Convert from Milliseconds - -```js -ms(60000) // "1m" -ms(2 * 60000) // "2m" -ms(-3 * 60000) // "-3m" -ms(ms('10 hours')) // "10h" -``` - -### Time Format Written-Out - -```js -ms(60000, { long: true }) // "1 minute" -ms(2 * 60000, { long: true }) // "2 minutes" -ms(-3 * 60000, { long: true }) // "-3 minutes" -ms(ms('10 hours'), { long: true }) // "10 hours" -``` - -## Features - -- Works both in [Node.js](https://nodejs.org) and in the browser -- If a number is supplied to `ms`, a string with a unit is returned -- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) -- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned - -## Related Packages - -- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. - -## Caught a Bug? - -1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device -2. Link the package to the global module directory: `npm link` -3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! - -As always, you can run the tests using: `npm test` diff --git a/node_modules/hexo-theme-butterfly/node_modules/source-map/LICENSE b/node_modules/hexo-theme-butterfly/node_modules/source-map/LICENSE deleted file mode 100644 index 600d3469..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/source-map/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ - -Copyright (c) 2009-2011, Mozilla Foundation and contributors -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -* Neither the names of the Mozilla Foundation nor the names of project - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/hexo-theme-butterfly/node_modules/source-map/README.md b/node_modules/hexo-theme-butterfly/node_modules/source-map/README.md deleted file mode 100644 index 729ccaf0..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/source-map/README.md +++ /dev/null @@ -1,822 +0,0 @@ -# Source Map - -[![Build Status](https://travis-ci.org/mozilla/source-map.png?branch=master)](https://travis-ci.org/mozilla/source-map) - -[![Coverage Status](https://coveralls.io/repos/github/mozilla/source-map/badge.svg)](https://coveralls.io/github/mozilla/source-map) - -[![NPM](https://nodei.co/npm/source-map.png?downloads=true&downloadRank=true)](https://www.npmjs.com/package/source-map) - -This is a library to generate and consume the source map format -[described here][format]. - -[format]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit - -## Use with Node - - $ npm install source-map - -## Use on the Web - - - - --------------------------------------------------------------------------------- - - - - - -## Table of Contents - -- [Examples](#examples) - - [Consuming a source map](#consuming-a-source-map) - - [Generating a source map](#generating-a-source-map) - - [With SourceNode (high level API)](#with-sourcenode-high-level-api) - - [With SourceMapGenerator (low level API)](#with-sourcemapgenerator-low-level-api) -- [API](#api) - - [SourceMapConsumer](#sourcemapconsumer) - - [SourceMapConsumer.initialize(options)](#sourcemapconsumerinitializeoptions) - - [new SourceMapConsumer(rawSourceMap)](#new-sourcemapconsumerrawsourcemap) - - [SourceMapConsumer.with](#sourcemapconsumerwith) - - [SourceMapConsumer.prototype.destroy()](#sourcemapconsumerprototypedestroy) - - [SourceMapConsumer.prototype.computeColumnSpans()](#sourcemapconsumerprototypecomputecolumnspans) - - [SourceMapConsumer.prototype.originalPositionFor(generatedPosition)](#sourcemapconsumerprototypeoriginalpositionforgeneratedposition) - - [SourceMapConsumer.prototype.generatedPositionFor(originalPosition)](#sourcemapconsumerprototypegeneratedpositionfororiginalposition) - - [SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)](#sourcemapconsumerprototypeallgeneratedpositionsfororiginalposition) - - [SourceMapConsumer.prototype.hasContentsOfAllSources()](#sourcemapconsumerprototypehascontentsofallsources) - - [SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])](#sourcemapconsumerprototypesourcecontentforsource-returnnullonmissing) - - [SourceMapConsumer.prototype.eachMapping(callback, context, order)](#sourcemapconsumerprototypeeachmappingcallback-context-order) - - [SourceMapGenerator](#sourcemapgenerator) - - [new SourceMapGenerator([startOfSourceMap])](#new-sourcemapgeneratorstartofsourcemap) - - [SourceMapGenerator.fromSourceMap(sourceMapConsumer)](#sourcemapgeneratorfromsourcemapsourcemapconsumer) - - [SourceMapGenerator.prototype.addMapping(mapping)](#sourcemapgeneratorprototypeaddmappingmapping) - - [SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)](#sourcemapgeneratorprototypesetsourcecontentsourcefile-sourcecontent) - - [SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])](#sourcemapgeneratorprototypeapplysourcemapsourcemapconsumer-sourcefile-sourcemappath) - - [SourceMapGenerator.prototype.toString()](#sourcemapgeneratorprototypetostring) - - [SourceNode](#sourcenode) - - [new SourceNode([line, column, source[, chunk[, name]]])](#new-sourcenodeline-column-source-chunk-name) - - [SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])](#sourcenodefromstringwithsourcemapcode-sourcemapconsumer-relativepath) - - [SourceNode.prototype.add(chunk)](#sourcenodeprototypeaddchunk) - - [SourceNode.prototype.prepend(chunk)](#sourcenodeprototypeprependchunk) - - [SourceNode.prototype.setSourceContent(sourceFile, sourceContent)](#sourcenodeprototypesetsourcecontentsourcefile-sourcecontent) - - [SourceNode.prototype.walk(fn)](#sourcenodeprototypewalkfn) - - [SourceNode.prototype.walkSourceContents(fn)](#sourcenodeprototypewalksourcecontentsfn) - - [SourceNode.prototype.join(sep)](#sourcenodeprototypejoinsep) - - [SourceNode.prototype.replaceRight(pattern, replacement)](#sourcenodeprototypereplacerightpattern-replacement) - - [SourceNode.prototype.toString()](#sourcenodeprototypetostring) - - [SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])](#sourcenodeprototypetostringwithsourcemapstartofsourcemap) - - - -## Examples - -### Consuming a source map - -```js -const rawSourceMap = { - version: 3, - file: 'min.js', - names: ['bar', 'baz', 'n'], - sources: ['one.js', 'two.js'], - sourceRoot: 'http://example.com/www/js/', - mappings: 'CAAC,IAAI,IAAM,SAAUA,GAClB,OAAOC,IAAID;CCDb,IAAI,IAAM,SAAUE,GAClB,OAAOA' -}; - -const whatever = await SourceMapConsumer.with(rawSourceMap, null, consumer => { - - console.log(consumer.sources); - // [ 'http://example.com/www/js/one.js', - // 'http://example.com/www/js/two.js' ] - - console.log(consumer.originalPositionFor({ - line: 2, - column: 28 - })); - // { source: 'http://example.com/www/js/two.js', - // line: 2, - // column: 10, - // name: 'n' } - - console.log(consumer.generatedPositionFor({ - source: 'http://example.com/www/js/two.js', - line: 2, - column: 10 - })); - // { line: 2, column: 28 } - - consumer.eachMapping(function (m) { - // ... - }); - - return computeWhatever(); -}); -``` - -### Generating a source map - -In depth guide: -[**Compiling to JavaScript, and Debugging with Source Maps**](https://hacks.mozilla.org/2013/05/compiling-to-javascript-and-debugging-with-source-maps/) - -#### With SourceNode (high level API) - -```js -function compile(ast) { - switch (ast.type) { - case 'BinaryExpression': - return new SourceNode( - ast.location.line, - ast.location.column, - ast.location.source, - [compile(ast.left), " + ", compile(ast.right)] - ); - case 'Literal': - return new SourceNode( - ast.location.line, - ast.location.column, - ast.location.source, - String(ast.value) - ); - // ... - default: - throw new Error("Bad AST"); - } -} - -var ast = parse("40 + 2", "add.js"); -console.log(compile(ast).toStringWithSourceMap({ - file: 'add.js' -})); -// { code: '40 + 2', -// map: [object SourceMapGenerator] } -``` - -#### With SourceMapGenerator (low level API) - -```js -var map = new SourceMapGenerator({ - file: "source-mapped.js" -}); - -map.addMapping({ - generated: { - line: 10, - column: 35 - }, - source: "foo.js", - original: { - line: 33, - column: 2 - }, - name: "christopher" -}); - -console.log(map.toString()); -// '{"version":3,"file":"source-mapped.js","sources":["foo.js"],"names":["christopher"],"mappings":";;;;;;;;;mCAgCEA"}' -``` - -## API - -Get a reference to the module: - -```js -// Node.js -var sourceMap = require('source-map'); - -// Browser builds -var sourceMap = window.sourceMap; - -// Inside Firefox -const sourceMap = require("devtools/toolkit/sourcemap/source-map.js"); -``` - -### SourceMapConsumer - -A `SourceMapConsumer` instance represents a parsed source map which we can query -for information about the original file positions by giving it a file position -in the generated source. - -#### SourceMapConsumer.initialize(options) - -When using `SourceMapConsumer` outside of node.js, for example on the Web, it -needs to know from what URL to load `lib/mappings.wasm`. You must inform it by -calling `initialize` before constructing any `SourceMapConsumer`s. - -The options object has the following properties: - -* `"lib/mappings.wasm"`: A `String` containing the URL of the - `lib/mappings.wasm` file, or an `ArrayBuffer` with the contents of `lib/mappings.wasm`. - -```js -sourceMap.SourceMapConsumer.initialize({ - "lib/mappings.wasm": "https://example.com/source-map/lib/mappings.wasm" -}); -``` - -#### new SourceMapConsumer(rawSourceMap) - -The only parameter is the raw source map (either as a string which can be -`JSON.parse`'d, or an object). According to the spec, source maps have the -following attributes: - -* `version`: Which version of the source map spec this map is following. - -* `sources`: An array of URLs to the original source files. - -* `names`: An array of identifiers which can be referenced by individual - mappings. - -* `sourceRoot`: Optional. The URL root from which all sources are relative. - -* `sourcesContent`: Optional. An array of contents of the original source files. - -* `mappings`: A string of base64 VLQs which contain the actual mappings. - -* `file`: Optional. The generated filename this source map is associated with. - -The promise of the constructed souce map consumer is returned. - -When the `SourceMapConsumer` will no longer be used anymore, you must call its -`destroy` method. - -```js -const consumer = await new sourceMap.SourceMapConsumer(rawSourceMapJsonData); -doStuffWith(consumer); -consumer.destroy(); -``` - -Alternatively, you can use `SourceMapConsumer.with` to avoid needing to remember -to call `destroy`. - -#### SourceMapConsumer.with - -Construct a new `SourceMapConsumer` from `rawSourceMap` and `sourceMapUrl` -(see the `SourceMapConsumer` constructor for details. Then, invoke the `async -function f(SourceMapConsumer) -> T` with the newly constructed consumer, wait -for `f` to complete, call `destroy` on the consumer, and return `f`'s return -value. - -You must not use the consumer after `f` completes! - -By using `with`, you do not have to remember to manually call `destroy` on -the consumer, since it will be called automatically once `f` completes. - -```js -const xSquared = await SourceMapConsumer.with( - myRawSourceMap, - null, - async function (consumer) { - // Use `consumer` inside here and don't worry about remembering - // to call `destroy`. - - const x = await whatever(consumer); - return x * x; - } -); - -// You may not use that `consumer` anymore out here; it has -// been destroyed. But you can use `xSquared`. -console.log(xSquared); -``` - -#### SourceMapConsumer.prototype.destroy() - -Free this source map consumer's associated wasm data that is manually-managed. - -```js -consumer.destroy(); -``` - -Alternatively, you can use `SourceMapConsumer.with` to avoid needing to remember -to call `destroy`. - -#### SourceMapConsumer.prototype.computeColumnSpans() - -Compute the last column for each generated mapping. The last column is -inclusive. - -```js -// Before: -consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" }) -// [ { line: 2, -// column: 1 }, -// { line: 2, -// column: 10 }, -// { line: 2, -// column: 20 } ] - -consumer.computeColumnSpans(); - -// After: -consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" }) -// [ { line: 2, -// column: 1, -// lastColumn: 9 }, -// { line: 2, -// column: 10, -// lastColumn: 19 }, -// { line: 2, -// column: 20, -// lastColumn: Infinity } ] -``` - -#### SourceMapConsumer.prototype.originalPositionFor(generatedPosition) - -Returns the original source, line, and column information for the generated -source's line and column positions provided. The only argument is an object with -the following properties: - -* `line`: The line number in the generated source. Line numbers in - this library are 1-based (note that the underlying source map - specification uses 0-based line numbers -- this library handles the - translation). - -* `column`: The column number in the generated source. Column numbers - in this library are 0-based. - -* `bias`: Either `SourceMapConsumer.GREATEST_LOWER_BOUND` or - `SourceMapConsumer.LEAST_UPPER_BOUND`. Specifies whether to return the closest - element that is smaller than or greater than the one we are searching for, - respectively, if the exact element cannot be found. Defaults to - `SourceMapConsumer.GREATEST_LOWER_BOUND`. - -and an object is returned with the following properties: - -* `source`: The original source file, or null if this information is not - available. - -* `line`: The line number in the original source, or null if this information is - not available. The line number is 1-based. - -* `column`: The column number in the original source, or null if this - information is not available. The column number is 0-based. - -* `name`: The original identifier, or null if this information is not available. - -```js -consumer.originalPositionFor({ line: 2, column: 10 }) -// { source: 'foo.coffee', -// line: 2, -// column: 2, -// name: null } - -consumer.originalPositionFor({ line: 99999999999999999, column: 999999999999999 }) -// { source: null, -// line: null, -// column: null, -// name: null } -``` - -#### SourceMapConsumer.prototype.generatedPositionFor(originalPosition) - -Returns the generated line and column information for the original source, -line, and column positions provided. The only argument is an object with -the following properties: - -* `source`: The filename of the original source. - -* `line`: The line number in the original source. The line number is - 1-based. - -* `column`: The column number in the original source. The column - number is 0-based. - -and an object is returned with the following properties: - -* `line`: The line number in the generated source, or null. The line - number is 1-based. - -* `column`: The column number in the generated source, or null. The - column number is 0-based. - -```js -consumer.generatedPositionFor({ source: "example.js", line: 2, column: 10 }) -// { line: 1, -// column: 56 } -``` - -#### SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition) - -Returns all generated line and column information for the original source, line, -and column provided. If no column is provided, returns all mappings -corresponding to a either the line we are searching for or the next closest line -that has any mappings. Otherwise, returns all mappings corresponding to the -given line and either the column we are searching for or the next closest column -that has any offsets. - -The only argument is an object with the following properties: - -* `source`: The filename of the original source. - -* `line`: The line number in the original source. The line number is - 1-based. - -* `column`: Optional. The column number in the original source. The - column number is 0-based. - -and an array of objects is returned, each with the following properties: - -* `line`: The line number in the generated source, or null. The line - number is 1-based. - -* `column`: The column number in the generated source, or null. The - column number is 0-based. - -```js -consumer.allGeneratedpositionsfor({ line: 2, source: "foo.coffee" }) -// [ { line: 2, -// column: 1 }, -// { line: 2, -// column: 10 }, -// { line: 2, -// column: 20 } ] -``` - -#### SourceMapConsumer.prototype.hasContentsOfAllSources() - -Return true if we have the embedded source content for every source listed in -the source map, false otherwise. - -In other words, if this method returns `true`, then -`consumer.sourceContentFor(s)` will succeed for every source `s` in -`consumer.sources`. - -```js -// ... -if (consumer.hasContentsOfAllSources()) { - consumerReadyCallback(consumer); -} else { - fetchSources(consumer, consumerReadyCallback); -} -// ... -``` - -#### SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing]) - -Returns the original source content for the source provided. The only -argument is the URL of the original source file. - -If the source content for the given source is not found, then an error is -thrown. Optionally, pass `true` as the second param to have `null` returned -instead. - -```js -consumer.sources -// [ "my-cool-lib.clj" ] - -consumer.sourceContentFor("my-cool-lib.clj") -// "..." - -consumer.sourceContentFor("this is not in the source map"); -// Error: "this is not in the source map" is not in the source map - -consumer.sourceContentFor("this is not in the source map", true); -// null -``` - -#### SourceMapConsumer.prototype.eachMapping(callback, context, order) - -Iterate over each mapping between an original source/line/column and a -generated line/column in this source map. - -* `callback`: The function that is called with each mapping. Mappings have the - form `{ source, generatedLine, generatedColumn, originalLine, originalColumn, - name }` - -* `context`: Optional. If specified, this object will be the value of `this` - every time that `callback` is called. - -* `order`: Either `SourceMapConsumer.GENERATED_ORDER` or - `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to iterate over - the mappings sorted by the generated file's line/column order or the - original's source/line/column order, respectively. Defaults to - `SourceMapConsumer.GENERATED_ORDER`. - -```js -consumer.eachMapping(function (m) { console.log(m); }) -// ... -// { source: 'illmatic.js', -// generatedLine: 1, -// generatedColumn: 0, -// originalLine: 1, -// originalColumn: 0, -// name: null } -// { source: 'illmatic.js', -// generatedLine: 2, -// generatedColumn: 0, -// originalLine: 2, -// originalColumn: 0, -// name: null } -// ... -``` -### SourceMapGenerator - -An instance of the SourceMapGenerator represents a source map which is being -built incrementally. - -#### new SourceMapGenerator([startOfSourceMap]) - -You may pass an object with the following properties: - -* `file`: The filename of the generated source that this source map is - associated with. - -* `sourceRoot`: A root for all relative URLs in this source map. - -* `skipValidation`: Optional. When `true`, disables validation of mappings as - they are added. This can improve performance but should be used with - discretion, as a last resort. Even then, one should avoid using this flag when - running tests, if possible. - -```js -var generator = new sourceMap.SourceMapGenerator({ - file: "my-generated-javascript-file.js", - sourceRoot: "http://example.com/app/js/" -}); -``` - -#### SourceMapGenerator.fromSourceMap(sourceMapConsumer) - -Creates a new `SourceMapGenerator` from an existing `SourceMapConsumer` instance. - -* `sourceMapConsumer` The SourceMap. - -```js -var generator = sourceMap.SourceMapGenerator.fromSourceMap(consumer); -``` - -#### SourceMapGenerator.prototype.addMapping(mapping) - -Add a single mapping from original source line and column to the generated -source's line and column for this source map being created. The mapping object -should have the following properties: - -* `generated`: An object with the generated line and column positions. - -* `original`: An object with the original line and column positions. - -* `source`: The original source file (relative to the sourceRoot). - -* `name`: An optional original token name for this mapping. - -```js -generator.addMapping({ - source: "module-one.scm", - original: { line: 128, column: 0 }, - generated: { line: 3, column: 456 } -}) -``` - -#### SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent) - -Set the source content for an original source file. - -* `sourceFile` the URL of the original source file. - -* `sourceContent` the content of the source file. - -```js -generator.setSourceContent("module-one.scm", - fs.readFileSync("path/to/module-one.scm")) -``` - -#### SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]]) - -Applies a SourceMap for a source file to the SourceMap. -Each mapping to the supplied source file is rewritten using the -supplied SourceMap. Note: The resolution for the resulting mappings -is the minimum of this map and the supplied map. - -* `sourceMapConsumer`: The SourceMap to be applied. - -* `sourceFile`: Optional. The filename of the source file. - If omitted, sourceMapConsumer.file will be used, if it exists. - Otherwise an error will be thrown. - -* `sourceMapPath`: Optional. The dirname of the path to the SourceMap - to be applied. If relative, it is relative to the SourceMap. - - This parameter is needed when the two SourceMaps aren't in the same - directory, and the SourceMap to be applied contains relative source - paths. If so, those relative source paths need to be rewritten - relative to the SourceMap. - - If omitted, it is assumed that both SourceMaps are in the same directory, - thus not needing any rewriting. (Supplying `'.'` has the same effect.) - -#### SourceMapGenerator.prototype.toString() - -Renders the source map being generated to a string. - -```js -generator.toString() -// '{"version":3,"sources":["module-one.scm"],"names":[],"mappings":"...snip...","file":"my-generated-javascript-file.js","sourceRoot":"http://example.com/app/js/"}' -``` - -### SourceNode - -SourceNodes provide a way to abstract over interpolating and/or concatenating -snippets of generated JavaScript source code, while maintaining the line and -column information associated between those snippets and the original source -code. This is useful as the final intermediate representation a compiler might -use before outputting the generated JS and source map. - -#### new SourceNode([line, column, source[, chunk[, name]]]) - -* `line`: The original line number associated with this source node, or null if - it isn't associated with an original line. The line number is 1-based. - -* `column`: The original column number associated with this source node, or null - if it isn't associated with an original column. The column number - is 0-based. - -* `source`: The original source's filename; null if no filename is provided. - -* `chunk`: Optional. Is immediately passed to `SourceNode.prototype.add`, see - below. - -* `name`: Optional. The original identifier. - -```js -var node = new SourceNode(1, 2, "a.cpp", [ - new SourceNode(3, 4, "b.cpp", "extern int status;\n"), - new SourceNode(5, 6, "c.cpp", "std::string* make_string(size_t n);\n"), - new SourceNode(7, 8, "d.cpp", "int main(int argc, char** argv) {}\n"), -]); -``` - -#### SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath]) - -Creates a SourceNode from generated code and a SourceMapConsumer. - -* `code`: The generated code - -* `sourceMapConsumer` The SourceMap for the generated code - -* `relativePath` The optional path that relative sources in `sourceMapConsumer` - should be relative to. - -```js -const consumer = await new SourceMapConsumer(fs.readFileSync("path/to/my-file.js.map", "utf8")); -const node = SourceNode.fromStringWithSourceMap(fs.readFileSync("path/to/my-file.js"), consumer); -``` - -#### SourceNode.prototype.add(chunk) - -Add a chunk of generated JS to this source node. - -* `chunk`: A string snippet of generated JS code, another instance of - `SourceNode`, or an array where each member is one of those things. - -```js -node.add(" + "); -node.add(otherNode); -node.add([leftHandOperandNode, " + ", rightHandOperandNode]); -``` - -#### SourceNode.prototype.prepend(chunk) - -Prepend a chunk of generated JS to this source node. - -* `chunk`: A string snippet of generated JS code, another instance of - `SourceNode`, or an array where each member is one of those things. - -```js -node.prepend("/** Build Id: f783haef86324gf **/\n\n"); -``` - -#### SourceNode.prototype.setSourceContent(sourceFile, sourceContent) - -Set the source content for a source file. This will be added to the -`SourceMap` in the `sourcesContent` field. - -* `sourceFile`: The filename of the source file - -* `sourceContent`: The content of the source file - -```js -node.setSourceContent("module-one.scm", - fs.readFileSync("path/to/module-one.scm")) -``` - -#### SourceNode.prototype.walk(fn) - -Walk over the tree of JS snippets in this node and its children. The walking -function is called once for each snippet of JS and is passed that snippet and -the its original associated source's line/column location. - -* `fn`: The traversal function. - -```js -var node = new SourceNode(1, 2, "a.js", [ - new SourceNode(3, 4, "b.js", "uno"), - "dos", - [ - "tres", - new SourceNode(5, 6, "c.js", "quatro") - ] -]); - -node.walk(function (code, loc) { console.log("WALK:", code, loc); }) -// WALK: uno { source: 'b.js', line: 3, column: 4, name: null } -// WALK: dos { source: 'a.js', line: 1, column: 2, name: null } -// WALK: tres { source: 'a.js', line: 1, column: 2, name: null } -// WALK: quatro { source: 'c.js', line: 5, column: 6, name: null } -``` - -#### SourceNode.prototype.walkSourceContents(fn) - -Walk over the tree of SourceNodes. The walking function is called for each -source file content and is passed the filename and source content. - -* `fn`: The traversal function. - -```js -var a = new SourceNode(1, 2, "a.js", "generated from a"); -a.setSourceContent("a.js", "original a"); -var b = new SourceNode(1, 2, "b.js", "generated from b"); -b.setSourceContent("b.js", "original b"); -var c = new SourceNode(1, 2, "c.js", "generated from c"); -c.setSourceContent("c.js", "original c"); - -var node = new SourceNode(null, null, null, [a, b, c]); -node.walkSourceContents(function (source, contents) { console.log("WALK:", source, ":", contents); }) -// WALK: a.js : original a -// WALK: b.js : original b -// WALK: c.js : original c -``` - -#### SourceNode.prototype.join(sep) - -Like `Array.prototype.join` except for SourceNodes. Inserts the separator -between each of this source node's children. - -* `sep`: The separator. - -```js -var lhs = new SourceNode(1, 2, "a.rs", "my_copy"); -var operand = new SourceNode(3, 4, "a.rs", "="); -var rhs = new SourceNode(5, 6, "a.rs", "orig.clone()"); - -var node = new SourceNode(null, null, null, [ lhs, operand, rhs ]); -var joinedNode = node.join(" "); -``` - -#### SourceNode.prototype.replaceRight(pattern, replacement) - -Call `String.prototype.replace` on the very right-most source snippet. Useful -for trimming white space from the end of a source node, etc. - -* `pattern`: The pattern to replace. - -* `replacement`: The thing to replace the pattern with. - -```js -// Trim trailing white space. -node.replaceRight(/\s*$/, ""); -``` - -#### SourceNode.prototype.toString() - -Return the string representation of this source node. Walks over the tree and -concatenates all the various snippets together to one string. - -```js -var node = new SourceNode(1, 2, "a.js", [ - new SourceNode(3, 4, "b.js", "uno"), - "dos", - [ - "tres", - new SourceNode(5, 6, "c.js", "quatro") - ] -]); - -node.toString() -// 'unodostresquatro' -``` - -#### SourceNode.prototype.toStringWithSourceMap([startOfSourceMap]) - -Returns the string representation of this tree of source nodes, plus a -SourceMapGenerator which contains all the mappings between the generated and -original sources. - -The arguments are the same as those to `new SourceMapGenerator`. - -```js -var node = new SourceNode(1, 2, "a.js", [ - new SourceNode(3, 4, "b.js", "uno"), - "dos", - [ - "tres", - new SourceNode(5, 6, "c.js", "quatro") - ] -]); - -node.toStringWithSourceMap({ file: "my-output-file.js" }) -// { code: 'unodostresquatro', -// map: [object SourceMapGenerator] } -``` diff --git a/node_modules/hexo-theme-butterfly/node_modules/source-map/dist/source-map.js b/node_modules/hexo-theme-butterfly/node_modules/source-map/dist/source-map.js deleted file mode 100644 index b75e98bd..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/source-map/dist/source-map.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("fs"),require("path")):"function"==typeof define&&define.amd?define(["fs","path"],n):"object"==typeof exports?exports.sourceMap=n(require("fs"),require("path")):e.sourceMap=n(e.fs,e.path)}(window,(function(e,n){return function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=5)}([function(e,n){n.getArg=function(e,n,t){if(n in e)return e[n];if(3===arguments.length)return t;throw new Error('"'+n+'" is a required argument.')};const t=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,r=/^data:.+\,.+$/;function o(e){const n=e.match(t);return n?{scheme:n[1],auth:n[2],host:n[3],port:n[4],path:n[5]}:null}function i(e){let n="";return e.scheme&&(n+=e.scheme+":"),n+="//",e.auth&&(n+=e.auth+"@"),e.host&&(n+=e.host),e.port&&(n+=":"+e.port),e.path&&(n+=e.path),n}n.urlParse=o,n.urlGenerate=i;const s=function(e){const n=[];return function(t){for(let e=0;e32&&n.pop(),r}}((function(e){let t=e;const r=o(e);if(r){if(!r.path)return e;t=r.path}const s=n.isAbsolute(t),l=[];let a=0,u=0;for(;;){if(a=u,u=t.indexOf("/",a),-1===u){l.push(t.slice(a));break}for(l.push(t.slice(a,u));u=0;u--){const e=l[u];"."===e?l.splice(u,1):".."===e?c++:c>0&&(""===e?(l.splice(u+1,c),c=0):(l.splice(u,2),c--))}return t=l.join("/"),""===t&&(t=s?"/":"."),r?(r.path=t,i(r)):t}));function l(e,n){""===e&&(e="."),""===n&&(n=".");const t=o(n),l=o(e);if(l&&(e=l.path||"/"),t&&!t.scheme)return l&&(t.scheme=l.scheme),i(t);if(t||n.match(r))return n;if(l&&!l.host&&!l.path)return l.host=n,i(l);const a="/"===n.charAt(0)?n:s(e.replace(/\/+$/,"")+"/"+n);return l?(l.path=a,i(l)):a}n.normalize=s,n.join=l,n.isAbsolute=function(e){return"/"===e.charAt(0)||t.test(e)},n.relative=function(e,n){""===e&&(e="."),e=e.replace(/\/$/,"");let t=0;for(;0!==n.indexOf(e+"/");){const r=e.lastIndexOf("/");if(r<0)return n;if((e=e.slice(0,r)).match(/^([^\/]+:\/)?\/*$/))return n;++t}return Array(t+1).join("../")+n.substr(e.length+1)};const a=!("__proto__"in Object.create(null));function u(e){return e}function c(e){if(!e)return!1;const n=e.length;if(n<9)return!1;if(95!==e.charCodeAt(n-1)||95!==e.charCodeAt(n-2)||111!==e.charCodeAt(n-3)||116!==e.charCodeAt(n-4)||111!==e.charCodeAt(n-5)||114!==e.charCodeAt(n-6)||112!==e.charCodeAt(n-7)||95!==e.charCodeAt(n-8)||95!==e.charCodeAt(n-9))return!1;for(let t=n-10;t>=0;t--)if(36!==e.charCodeAt(t))return!1;return!0}function g(e,n){return e===n?0:null===e?1:null===n?-1:e>n?1:-1}n.toSetString=a?u:function(e){return c(e)?"$"+e:e},n.fromSetString=a?u:function(e){return c(e)?e.slice(1):e},n.compareByOriginalPositions=function(e,n,t){let r=g(e.source,n.source);return 0!==r?r:(r=e.originalLine-n.originalLine,0!==r?r:(r=e.originalColumn-n.originalColumn,0!==r||t?r:(r=e.generatedColumn-n.generatedColumn,0!==r?r:(r=e.generatedLine-n.generatedLine,0!==r?r:g(e.name,n.name)))))},n.compareByGeneratedPositionsDeflated=function(e,n,t){let r=e.generatedLine-n.generatedLine;return 0!==r?r:(r=e.generatedColumn-n.generatedColumn,0!==r||t?r:(r=g(e.source,n.source),0!==r?r:(r=e.originalLine-n.originalLine,0!==r?r:(r=e.originalColumn-n.originalColumn,0!==r?r:g(e.name,n.name)))))},n.compareByGeneratedPositionsInflated=function(e,n){let t=e.generatedLine-n.generatedLine;return 0!==t?t:(t=e.generatedColumn-n.generatedColumn,0!==t?t:(t=g(e.source,n.source),0!==t?t:(t=e.originalLine-n.originalLine,0!==t?t:(t=e.originalColumn-n.originalColumn,0!==t?t:g(e.name,n.name)))))},n.parseSourceMapInput=function(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))},n.computeSourceURL=function(e,n,t){if(n=n||"",e&&("/"!==e[e.length-1]&&"/"!==n[0]&&(e+="/"),n=e+n),t){const e=o(t);if(!e)throw new Error("sourceMapURL could not be parsed");if(e.path){const n=e.path.lastIndexOf("/");n>=0&&(e.path=e.path.substring(0,n+1))}n=l(i(e),n)}return s(n)}},function(e,n,t){const r=t(2),o=t(0),i=t(3).ArraySet,s=t(7).MappingList;class l{constructor(e){e||(e={}),this._file=o.getArg(e,"file",null),this._sourceRoot=o.getArg(e,"sourceRoot",null),this._skipValidation=o.getArg(e,"skipValidation",!1),this._sources=new i,this._names=new i,this._mappings=new s,this._sourcesContents=null}static fromSourceMap(e){const n=e.sourceRoot,t=new l({file:e.file,sourceRoot:n});return e.eachMapping((function(e){const r={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(r.source=e.source,null!=n&&(r.source=o.relative(n,r.source)),r.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(r.name=e.name)),t.addMapping(r)})),e.sources.forEach((function(r){let i=r;null!==n&&(i=o.relative(n,r)),t._sources.has(i)||t._sources.add(i);const s=e.sourceContentFor(r);null!=s&&t.setSourceContent(r,s)})),t}addMapping(e){const n=o.getArg(e,"generated"),t=o.getArg(e,"original",null);let r=o.getArg(e,"source",null),i=o.getArg(e,"name",null);this._skipValidation||this._validateMapping(n,t,r,i),null!=r&&(r=String(r),this._sources.has(r)||this._sources.add(r)),null!=i&&(i=String(i),this._names.has(i)||this._names.add(i)),this._mappings.add({generatedLine:n.line,generatedColumn:n.column,originalLine:null!=t&&t.line,originalColumn:null!=t&&t.column,source:r,name:i})}setSourceContent(e,n){let t=e;null!=this._sourceRoot&&(t=o.relative(this._sourceRoot,t)),null!=n?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[o.toSetString(t)]=n):this._sourcesContents&&(delete this._sourcesContents[o.toSetString(t)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,n,t){let r=n;if(null==n){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');r=e.file}const s=this._sourceRoot;null!=s&&(r=o.relative(s,r));const l=this._mappings.toArray().length>0?new i:this._sources,a=new i;this._mappings.unsortedForEach((function(n){if(n.source===r&&null!=n.originalLine){const r=e.originalPositionFor({line:n.originalLine,column:n.originalColumn});null!=r.source&&(n.source=r.source,null!=t&&(n.source=o.join(t,n.source)),null!=s&&(n.source=o.relative(s,n.source)),n.originalLine=r.line,n.originalColumn=r.column,null!=r.name&&(n.name=r.name))}const i=n.source;null==i||l.has(i)||l.add(i);const u=n.name;null==u||a.has(u)||a.add(u)}),this),this._sources=l,this._names=a,e.sources.forEach((function(n){const r=e.sourceContentFor(n);null!=r&&(null!=t&&(n=o.join(t,n)),null!=s&&(n=o.relative(s,n)),this.setSourceContent(n,r))}),this)}_validateMapping(e,n,t,r){if(n&&"number"!=typeof n.line&&"number"!=typeof n.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!n&&!t&&!r);else if(!(e&&"line"in e&&"column"in e&&n&&"line"in n&&"column"in n&&e.line>0&&e.column>=0&&n.line>0&&n.column>=0&&t))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:t,original:n,name:r}))}_serializeMappings(){let e,n,t,i,s=0,l=1,a=0,u=0,c=0,g=0,p="";const h=this._mappings.toArray();for(let m=0,d=h.length;m0){if(!o.compareByGeneratedPositionsInflated(n,h[m-1]))continue;e+=","}e+=r.encode(n.generatedColumn-s),s=n.generatedColumn,null!=n.source&&(i=this._sources.indexOf(n.source),e+=r.encode(i-g),g=i,e+=r.encode(n.originalLine-1-u),u=n.originalLine-1,e+=r.encode(n.originalColumn-a),a=n.originalColumn,null!=n.name&&(t=this._names.indexOf(n.name),e+=r.encode(t-c),c=t)),p+=e}return p}_generateSourcesContent(e,n){return e.map((function(e){if(!this._sourcesContents)return null;null!=n&&(e=o.relative(n,e));const t=o.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,t)?this._sourcesContents[t]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}}l.prototype._version=3,n.SourceMapGenerator=l},function(e,n,t){const r=t(6);n.encode=function(e){let n,t="",o=function(e){return e<0?1+(-e<<1):0+(e<<1)}(e);do{n=31&o,o>>>=5,o>0&&(n|=32),t+=r.encode(n)}while(o>0);return t}},function(e,n){class t{constructor(){this._array=[],this._set=new Map}static fromArray(e,n){const r=new t;for(let t=0,o=e.length;t=0)return n;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&ee.arrayBuffer());if(n instanceof ArrayBuffer)return Promise.resolve(n);throw new Error("You must provide the string URL or ArrayBuffer contents of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer")},e.exports.initialize=e=>n=e}else{const r=t(10),o=t(11);e.exports=function(){return new Promise((e,t)=>{const i=o.join(n,"mappings.wasm");r.readFile(i,null,(n,r)=>{n?t(n):e(r.buffer)})})},e.exports.initialize=e=>{console.debug("SourceMapConsumer.initialize is a no-op when running in node.js")}}}).call(this,"/")},function(e,n,t){n.SourceMapGenerator=t(1).SourceMapGenerator,n.SourceMapConsumer=t(8).SourceMapConsumer,n.SourceNode=t(13).SourceNode},function(e,n){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");n.encode=function(e){if(0<=e&&et||o==t&&s>=i||r.compareByGeneratedPositionsInflated(e,n)<=0}(this._last,e)?(this._sorted=!1,this._array.push(e)):(this._last=e,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(r.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}}},function(e,n,t){const r=t(0),o=t(9),i=t(3).ArraySet,s=(t(2),t(4)),l=t(12),a=Symbol("smcInternal");class u{constructor(e,n){return e==a?Promise.resolve(this):function(e,n){let t=e;"string"==typeof e&&(t=r.parseSourceMapInput(e));const o=null!=t.sections?new g(t,n):new c(t,n);return Promise.resolve(o)}(e,n)}static initialize(e){s.initialize(e["lib/mappings.wasm"])}static fromSourceMap(e,n){return function(e,n){return c.fromSourceMap(e,n)}(e,n)}static async with(e,n,t){const r=await new u(e,n);try{return await t(r)}finally{r.destroy()}}_parseMappings(e,n){throw new Error("Subclasses must implement _parseMappings")}eachMapping(e,n,t){throw new Error("Subclasses must implement eachMapping")}allGeneratedPositionsFor(e){throw new Error("Subclasses must implement allGeneratedPositionsFor")}destroy(){throw new Error("Subclasses must implement destroy")}}u.prototype._version=3,u.GENERATED_ORDER=1,u.ORIGINAL_ORDER=2,u.GREATEST_LOWER_BOUND=1,u.LEAST_UPPER_BOUND=2,n.SourceMapConsumer=u;class c extends u{constructor(e,n){return super(a).then(t=>{let o=e;"string"==typeof e&&(o=r.parseSourceMapInput(e));const s=r.getArg(o,"version");let a=r.getArg(o,"sources");const u=r.getArg(o,"names",[]);let c=r.getArg(o,"sourceRoot",null);const g=r.getArg(o,"sourcesContent",null),p=r.getArg(o,"mappings"),h=r.getArg(o,"file",null);if(s!=t._version)throw new Error("Unsupported version: "+s);return c&&(c=r.normalize(c)),a=a.map(String).map(r.normalize).map((function(e){return c&&r.isAbsolute(c)&&r.isAbsolute(e)?r.relative(c,e):e})),t._names=i.fromArray(u.map(String),!0),t._sources=i.fromArray(a,!0),t._absoluteSources=t._sources.toArray().map((function(e){return r.computeSourceURL(c,e,n)})),t.sourceRoot=c,t.sourcesContent=g,t._mappings=p,t._sourceMapURL=n,t.file=h,t._computedColumnSpans=!1,t._mappingsPtr=0,t._wasm=null,l().then(e=>(t._wasm=e,t))})}_findSourceIndex(e){let n=e;if(null!=this.sourceRoot&&(n=r.relative(this.sourceRoot,n)),this._sources.has(n))return this._sources.indexOf(n);for(let n=0;n{null!==n.source&&(n.source=this._sources.at(n.source),n.source=r.computeSourceURL(s,n.source,this._sourceMapURL),null!==n.name&&(n.name=this._names.at(n.name))),e.call(o,n)},()=>{switch(i){case u.GENERATED_ORDER:this._wasm.exports.by_generated_location(this._getMappingsPtr());break;case u.ORIGINAL_ORDER:this._wasm.exports.by_original_location(this._getMappingsPtr());break;default:throw new Error("Unknown order of iteration.")}})}allGeneratedPositionsFor(e){let n=r.getArg(e,"source");const t=r.getArg(e,"line"),o=e.column||0;if(n=this._findSourceIndex(n),n<0)return[];if(t<1)throw new Error("Line numbers must be >= 1");if(o<0)throw new Error("Column numbers must be >= 0");const i=[];return this._wasm.withMappingCallback(e=>{let n=e.lastGeneratedColumn;this._computedColumnSpans&&null===n&&(n=1/0),i.push({line:e.generatedLine,column:e.generatedColumn,lastColumn:n})},()=>{this._wasm.exports.all_generated_locations_for(this._getMappingsPtr(),n,t-1,"column"in e,o)}),i}destroy(){0!==this._mappingsPtr&&(this._wasm.exports.free_mappings(this._mappingsPtr),this._mappingsPtr=0)}computeColumnSpans(){this._computedColumnSpans||(this._wasm.exports.compute_column_spans(this._getMappingsPtr()),this._computedColumnSpans=!0)}originalPositionFor(e){const n={generatedLine:r.getArg(e,"line"),generatedColumn:r.getArg(e,"column")};if(n.generatedLine<1)throw new Error("Line numbers must be >= 1");if(n.generatedColumn<0)throw new Error("Column numbers must be >= 0");let t,o=r.getArg(e,"bias",u.GREATEST_LOWER_BOUND);if(null==o&&(o=u.GREATEST_LOWER_BOUND),this._wasm.withMappingCallback(e=>t=e,()=>{this._wasm.exports.original_location_for(this._getMappingsPtr(),n.generatedLine-1,n.generatedColumn,o)}),t&&t.generatedLine===n.generatedLine){let e=r.getArg(t,"source",null);null!==e&&(e=this._sources.at(e),e=r.computeSourceURL(this.sourceRoot,e,this._sourceMapURL));let n=r.getArg(t,"name",null);return null!==n&&(n=this._names.at(n)),{source:e,line:r.getArg(t,"originalLine",null),column:r.getArg(t,"originalColumn",null),name:n}}return{source:null,line:null,column:null,name:null}}hasContentsOfAllSources(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return null==e})))}sourceContentFor(e,n){if(!this.sourcesContent)return null;const t=this._findSourceIndex(e);if(t>=0)return this.sourcesContent[t];let o,i=e;if(null!=this.sourceRoot&&(i=r.relative(this.sourceRoot,i)),null!=this.sourceRoot&&(o=r.urlParse(this.sourceRoot))){const e=i.replace(/^file:\/\//,"");if("file"==o.scheme&&this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];if((!o.path||"/"==o.path)&&this._sources.has("/"+i))return this.sourcesContent[this._sources.indexOf("/"+i)]}if(n)return null;throw new Error('"'+i+'" is not in the SourceMap.')}generatedPositionFor(e){let n=r.getArg(e,"source");if(n=this._findSourceIndex(n),n<0)return{line:null,column:null,lastColumn:null};const t={source:n,originalLine:r.getArg(e,"line"),originalColumn:r.getArg(e,"column")};if(t.originalLine<1)throw new Error("Line numbers must be >= 1");if(t.originalColumn<0)throw new Error("Column numbers must be >= 0");let o,i=r.getArg(e,"bias",u.GREATEST_LOWER_BOUND);if(null==i&&(i=u.GREATEST_LOWER_BOUND),this._wasm.withMappingCallback(e=>o=e,()=>{this._wasm.exports.generated_location_for(this._getMappingsPtr(),t.source,t.originalLine-1,t.originalColumn,i)}),o&&o.source===t.source){let e=o.lastGeneratedColumn;return this._computedColumnSpans&&null===e&&(e=1/0),{line:r.getArg(o,"generatedLine",null),column:r.getArg(o,"generatedColumn",null),lastColumn:e}}return{line:null,column:null,lastColumn:null}}}c.prototype.consumer=u,n.BasicSourceMapConsumer=c;class g extends u{constructor(e,n){return super(a).then(t=>{let o=e;"string"==typeof e&&(o=r.parseSourceMapInput(e));const s=r.getArg(o,"version"),l=r.getArg(o,"sections");if(s!=t._version)throw new Error("Unsupported version: "+s);t._sources=new i,t._names=new i,t.__generatedMappings=null,t.__originalMappings=null,t.__generatedMappingsUnsorted=null,t.__originalMappingsUnsorted=null;let a={line:-1,column:0};return Promise.all(l.map(e=>{if(e.url)throw new Error("Support for url field in sections not implemented.");const t=r.getArg(e,"offset"),o=r.getArg(t,"line"),i=r.getArg(t,"column");if(o({generatedOffset:{generatedLine:o+1,generatedColumn:i+1},consumer:e}))})).then(e=>(t._sections=e,t))})}get _generatedMappings(){return this.__generatedMappings||this._sortGeneratedMappings(),this.__generatedMappings}get _originalMappings(){return this.__originalMappings||this._sortOriginalMappings(),this.__originalMappings}get _generatedMappingsUnsorted(){return this.__generatedMappingsUnsorted||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappingsUnsorted}get _originalMappingsUnsorted(){return this.__originalMappingsUnsorted||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappingsUnsorted}_sortGeneratedMappings(){const e=this._generatedMappingsUnsorted;e.sort(r.compareByGeneratedPositionsDeflated),this.__generatedMappings=e}_sortOriginalMappings(){const e=this._originalMappingsUnsorted;e.sort(r.compareByOriginalPositions),this.__originalMappings=e}get sources(){const e=[];for(let n=0;ni.push(e));for(let e=0;e= 1");if(t.originalColumn<0)throw new Error("Column numbers must be >= 0");const i=[];let s=this._findMapping(t,this._originalMappings,"originalLine","originalColumn",r.compareByOriginalPositions,o.LEAST_UPPER_BOUND);if(s>=0){let t=this._originalMappings[s];if(void 0===e.column){const e=t.originalLine;for(;t&&t.originalLine===e;){let e=t.lastGeneratedColumn;this._computedColumnSpans&&null===e&&(e=1/0),i.push({line:r.getArg(t,"generatedLine",null),column:r.getArg(t,"generatedColumn",null),lastColumn:e}),t=this._originalMappings[++s]}}else{const e=t.originalColumn;for(;t&&t.originalLine===n&&t.originalColumn==e;){let e=t.lastGeneratedColumn;this._computedColumnSpans&&null===e&&(e=1/0),i.push({line:r.getArg(t,"generatedLine",null),column:r.getArg(t,"generatedColumn",null),lastColumn:e}),t=this._originalMappings[++s]}}}return i}destroy(){for(let e=0;e0?r-a>1?e(a,r,o,i,s,l):l==n.LEAST_UPPER_BOUND?r1?e(t,a,o,i,s,l):l==n.LEAST_UPPER_BOUND?a:t<0?-1:t}(-1,t.length,e,t,r,o||n.GREATEST_LOWER_BOUND);if(i<0)return-1;for(;i-1>=0&&0===r(t[i],t[i-1],!0);)--i;return i}},function(n,t){n.exports=e},function(e,t){e.exports=n},function(e,n,t){const r=t(4);function o(){this.generatedLine=0,this.generatedColumn=0,this.lastGeneratedColumn=null,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}let i=null;e.exports=function(){if(i)return i;const e=[];return i=r().then(n=>WebAssembly.instantiate(n,{env:{mapping_callback(n,t,r,i,s,l,a,u,c,g){const p=new o;p.generatedLine=n+1,p.generatedColumn=t,r&&(p.lastGeneratedColumn=i-1),s&&(p.source=l,p.originalLine=a+1,p.originalColumn=u,c&&(p.name=g)),e[e.length-1](p)},start_all_generated_locations_for(){console.time("all_generated_locations_for")},end_all_generated_locations_for(){console.timeEnd("all_generated_locations_for")},start_compute_column_spans(){console.time("compute_column_spans")},end_compute_column_spans(){console.timeEnd("compute_column_spans")},start_generated_location_for(){console.time("generated_location_for")},end_generated_location_for(){console.timeEnd("generated_location_for")},start_original_location_for(){console.time("original_location_for")},end_original_location_for(){console.timeEnd("original_location_for")},start_parse_mappings(){console.time("parse_mappings")},end_parse_mappings(){console.timeEnd("parse_mappings")},start_sort_by_generated_location(){console.time("sort_by_generated_location")},end_sort_by_generated_location(){console.timeEnd("sort_by_generated_location")},start_sort_by_original_location(){console.time("sort_by_original_location")},end_sort_by_original_location(){console.timeEnd("sort_by_original_location")}}})).then(n=>({exports:n.instance.exports,withMappingCallback:(n,t)=>{e.push(n);try{t()}finally{e.pop()}}})).then(null,e=>{throw i=null,e}),i}},function(e,n,t){const r=t(1).SourceMapGenerator,o=t(0),i=/(\r?\n)/,s="$$$isSourceNode$$$";class l{constructor(e,n,t,r,o){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==n?null:n,this.source=null==t?null:t,this.name=null==o?null:o,this[s]=!0,null!=r&&this.add(r)}static fromStringWithSourceMap(e,n,t){const r=new l,s=e.split(i);let a=0;const u=function(){return e()+(e()||"");function e(){return a=0;n--)this.prepend(e[n]);else{if(!e[s]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let n;for(let t=0,r=this.children.length;t0){for(n=[],t=0;t= 0) { - return idx; - } - throw new Error('"' + aStr + '" is not in the set.'); - } - - /** - * What is the element at the given index? - * - * @param Number aIdx - */ - at(aIdx) { - if (aIdx >= 0 && aIdx < this._array.length) { - return this._array[aIdx]; - } - throw new Error("No element indexed by " + aIdx); - } - - /** - * Returns the array representation of this set (which has the proper indices - * indicated by indexOf). Note that this is a copy of the internal array used - * for storing the members so that no one can mess with internal state. - */ - toArray() { - return this._array.slice(); - } -} -exports.ArraySet = ArraySet; diff --git a/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/base64-vlq.js b/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/base64-vlq.js deleted file mode 100644 index 505ffbd4..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/base64-vlq.js +++ /dev/null @@ -1,111 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - * - * Based on the Base 64 VLQ implementation in Closure Compiler: - * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java - * - * Copyright 2011 The Closure Compiler Authors. All rights reserved. - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -const base64 = require("./base64"); - -// A single base 64 digit can contain 6 bits of data. For the base 64 variable -// length quantities we use in the source map spec, the first bit is the sign, -// the next four bits are the actual value, and the 6th bit is the -// continuation bit. The continuation bit tells us whether there are more -// digits in this value following this digit. -// -// Continuation -// | Sign -// | | -// V V -// 101011 - -const VLQ_BASE_SHIFT = 5; - -// binary: 100000 -const VLQ_BASE = 1 << VLQ_BASE_SHIFT; - -// binary: 011111 -const VLQ_BASE_MASK = VLQ_BASE - 1; - -// binary: 100000 -const VLQ_CONTINUATION_BIT = VLQ_BASE; - -/** - * Converts from a two-complement value to a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) - * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) - */ -function toVLQSigned(aValue) { - return aValue < 0 - ? ((-aValue) << 1) + 1 - : (aValue << 1) + 0; -} - -/** - * Converts to a two-complement value from a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 - * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 - */ -// eslint-disable-next-line no-unused-vars -function fromVLQSigned(aValue) { - const isNegative = (aValue & 1) === 1; - const shifted = aValue >> 1; - return isNegative - ? -shifted - : shifted; -} - -/** - * Returns the base 64 VLQ encoded value. - */ -exports.encode = function base64VLQ_encode(aValue) { - let encoded = ""; - let digit; - - let vlq = toVLQSigned(aValue); - - do { - digit = vlq & VLQ_BASE_MASK; - vlq >>>= VLQ_BASE_SHIFT; - if (vlq > 0) { - // There are still more digits in this value, so we must make sure the - // continuation bit is marked. - digit |= VLQ_CONTINUATION_BIT; - } - encoded += base64.encode(digit); - } while (vlq > 0); - - return encoded; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/base64.js b/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/base64.js deleted file mode 100644 index 64e7ac54..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/base64.js +++ /dev/null @@ -1,18 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -const intToCharMap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""); - -/** - * Encode an integer in the range of 0 to 63 to a single base 64 digit. - */ -exports.encode = function(number) { - if (0 <= number && number < intToCharMap.length) { - return intToCharMap[number]; - } - throw new TypeError("Must be between 0 and 63: " + number); -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/binary-search.js b/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/binary-search.js deleted file mode 100644 index ee8f6ebe..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/binary-search.js +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -exports.GREATEST_LOWER_BOUND = 1; -exports.LEAST_UPPER_BOUND = 2; - -/** - * Recursive implementation of binary search. - * - * @param aLow Indices here and lower do not contain the needle. - * @param aHigh Indices here and higher do not contain the needle. - * @param aNeedle The element being searched for. - * @param aHaystack The non-empty array being searched. - * @param aCompare Function which takes two elements and returns -1, 0, or 1. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - */ -function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { - // This function terminates when one of the following is true: - // - // 1. We find the exact element we are looking for. - // - // 2. We did not find the exact element, but we can return the index of - // the next-closest element. - // - // 3. We did not find the exact element, and there is no next-closest - // element than the one we are searching for, so we return -1. - const mid = Math.floor((aHigh - aLow) / 2) + aLow; - const cmp = aCompare(aNeedle, aHaystack[mid], true); - if (cmp === 0) { - // Found the element we are looking for. - return mid; - } else if (cmp > 0) { - // Our needle is greater than aHaystack[mid]. - if (aHigh - mid > 1) { - // The element is in the upper half. - return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); - } - - // The exact needle element was not found in this haystack. Determine if - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return aHigh < aHaystack.length ? aHigh : -1; - } - return mid; - } - - // Our needle is less than aHaystack[mid]. - if (mid - aLow > 1) { - // The element is in the lower half. - return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); - } - - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return mid; - } - return aLow < 0 ? -1 : aLow; -} - -/** - * This is an implementation of binary search which will always try and return - * the index of the closest element if there is no exact hit. This is because - * mappings between original and generated line/col pairs are single points, - * and there is an implicit region between each of them, so a miss just means - * that you aren't on the very start of a region. - * - * @param aNeedle The element you are looking for. - * @param aHaystack The array that is being searched. - * @param aCompare A function which takes the needle and an element in the - * array and returns -1, 0, or 1 depending on whether the needle is less - * than, equal to, or greater than the element, respectively. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. - */ -exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { - if (aHaystack.length === 0) { - return -1; - } - - let index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, - aCompare, aBias || exports.GREATEST_LOWER_BOUND); - if (index < 0) { - return -1; - } - - // We have found either the exact element, or the next-closest element than - // the one we are searching for. However, there may be more than one such - // element. Make sure we always return the smallest of these. - while (index - 1 >= 0) { - if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { - break; - } - --index; - } - - return index; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/mapping-list.js b/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/mapping-list.js deleted file mode 100644 index f63f8f66..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/mapping-list.js +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2014 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -const util = require("./util"); - -/** - * Determine whether mappingB is after mappingA with respect to generated - * position. - */ -function generatedPositionAfter(mappingA, mappingB) { - // Optimized for most common case - const lineA = mappingA.generatedLine; - const lineB = mappingB.generatedLine; - const columnA = mappingA.generatedColumn; - const columnB = mappingB.generatedColumn; - return lineB > lineA || lineB == lineA && columnB >= columnA || - util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; -} - -/** - * A data structure to provide a sorted view of accumulated mappings in a - * performance conscious manner. It trades a negligible overhead in general - * case for a large speedup in case of mappings being added in order. - */ -class MappingList { - constructor() { - this._array = []; - this._sorted = true; - // Serves as infimum - this._last = {generatedLine: -1, generatedColumn: 0}; - } - - /** - * Iterate through internal items. This method takes the same arguments that - * `Array.prototype.forEach` takes. - * - * NOTE: The order of the mappings is NOT guaranteed. - */ - unsortedForEach(aCallback, aThisArg) { - this._array.forEach(aCallback, aThisArg); - } - - /** - * Add the given source mapping. - * - * @param Object aMapping - */ - add(aMapping) { - if (generatedPositionAfter(this._last, aMapping)) { - this._last = aMapping; - this._array.push(aMapping); - } else { - this._sorted = false; - this._array.push(aMapping); - } - } - - /** - * Returns the flat, sorted array of mappings. The mappings are sorted by - * generated position. - * - * WARNING: This method returns internal data without copying, for - * performance. The return value must NOT be mutated, and should be treated as - * an immutable borrow. If you want to take ownership, you must make your own - * copy. - */ - toArray() { - if (!this._sorted) { - this._array.sort(util.compareByGeneratedPositionsInflated); - this._sorted = true; - } - return this._array; - } -} - -exports.MappingList = MappingList; diff --git a/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/mappings.wasm b/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/mappings.wasm deleted file mode 100644 index 3515370723369347c024869dc4dbb3318c45a294..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 48693 zcmeIb3zS{gS?75k_gUxOTeqYtsiZ1N=U&UUWW7qyl4Lv9ks~>Z?Z~m?B!m#DER}7Q zURJ5(N4IU29TNg1pv+_%FJ5h?-6YVcF|z`s=`=AjNl1WB3g6!3)@nQqD~(2@9GA=b zRVoz2N5UODig6eWmH%V3qI7!t^x4@bqM&@_$f@b`4{i&ZTs`Ej296xLaOUjn@%-`h zx%}$XTz++?+o<#G)bw#W8nTY;D(@(NJbf;|IyIMHo#{4m&l(R+&mB26b$;&1^z7`} z*XIeOS|Joto@0zXM)wk z$IhO9St$9JappB)TwUmbmXdMM;-*E*0QU+wioR& zU|nR~^Y-?->fSKOf@H_0a`(StsZ=PJE9HSYzYCS5l+>!#VxhuqRlo9|fq(nk(Wd`U zj2aiCr?Wygiw>?20Ps;Qqp79At%7HQJ|t zX-KPftfG>wJvGy=rSTnweeu3D&cChx3iPOTas7dSLnY3unv(cHf7Y?b_+862#V`eLnrX;1S`Ehz zwRY`59S#B>%`0X)OnnY&)}T`>7H{yv9zUrn&0!&@$t$S*2=p_sLZ0waUDZ^hkq)kp z-CXDJQ%G-Xm@D@qG#p&qWRf#oob z4+0waV;hTR*CCeKG<B+W@7p@D0ny^&{ z@NicE)a!x*9fVn7SD-=?r%GTAe8k{RmBh_eJ&qYzkD`4!UO)MB<;l&)V8O369=JP?+?R^X|O3MWRWNu z2s5S>)xa844u$z;PgkZp`@0O1?dmR4M@~|tiG#g1#c-wtJE7sgZj@a_L`_hF|28lr~`E;>-^4ENX#Eq3oh0i9Gh!}2tpKt591u*XcyDcA*e)wib~_dx`qL$1{2py zg4`+EBJzXsLMm20nibB?IQ`iU?ikaHF%#a95z+v*Nec(+G-w62asuezYJ%{)>y?y= zNt4EN8EBdV6HNHz>^XmN?qP@Gu!CZU+t6?u9;{cvE&8Tr3c}%bAc36l>(goBv2zkD zx;HxUYu2f1D912}Sr*!p5N+*{&kTzwTc&*S+`~Osly(zaKo#Uw@~|#yiYiO8pte*V zi(yEz9@Wi*iI@;LKG&I3T4h!?TbpBF_j;bh(4bB4DUOi_1IE%}fQJqs=+L=#I0g;4 zOu4`a8w60N;OSv#mM~)7($WlEU|1Fbfp)Z2R8ga^=pd8iy25DKw3-kk9a*d=wOWDz znc%qA0sXaNnagbNTELoipUZ}}sD@9++) zZVR|AWxqIIfOn9yeQgo(uT2aCl5lpK}i& zUUq4y6@W<)r8-cB;o9NM!FpMjl{Q$aEkPFnrSS_;11RV+>kfFHC%AIL%J>F1x?naD znXMU5D>JZ-4E;iOlNu1A)WR_w-9s>xg%Q(_Kvy%uzYu2gF$s~z38^U#M<;kZdkt00 zLO5Ma6{3ouGBc_bAX)aJVL(m}BSVaYCuYjUn?d%;A#>Hhjy=piJ(Rt+MnnIkqZt?j zj5_d`WI6kkeVYgV5+f62^N~C_u1Rx%>s^nh>h zp3s3QTLV7S9BLx6E99SufgSl_1M4Oll+`cXjqDWeoJBxz=48x@GR--IWrH#faPs3q zhsgvL)C8KJJc+V0g(3_YVL^+-AI8G)kack;pfwFtP6!1fD7P*ehxSf)8%9!FzZ8Xp zBI3?1Z$X)686b$*5pZO8CinEVD;iZt&9)hS4G#>eGwRUpIn80%LFZn}5&X+KZq(Ch z=oBX)#n~YC5ki5BvavH%OUojj1j|j=946Ip46hn6JkFKp0sESD#p`-7IL!o4%r>! zi}T4t4O&FNn1|2>znSu9{etergcXe4N~y#fL`dENOv<6;FbYFBUSlwE9*$n6R>bhx zYoQs&vc|@hqatK%_8G}>_8BN-pG&d)tWwv+wqXR56oA9pYv2|zcR|z|)HIz3!Yg+p zat;gpDvl5yG0K_*F1E1rup`O`ut( zkOhP@g)EjvvzRvj=BrN| z7^DV1EP0^5A}djUt-K%B@S~b=Q-*a#R_6J2dd?KJA`&NL6&|+TOf@wsj%HP!5kSzi zOyT>wU_=~T>?n$CfQoAnNx1>bvnAZErYndfv+9kYtX;p>SgAU>jWmx1@$f2xD`$Fg zFXTXdSyrRtalzATA|r1ibG6ZLB9~=#8jV38EG3KGWqpPMqGb)c$ z$XsND)MDBg4aGU+J4kA>CXbg3Yt9$oZbbAf*M^g9gaXe{xLJ}IZHL@l)7{}X=v^bp zmQvK+T`e)PB}q2SLtI(WrRv^cwA7%SWJsf|hkz<3*$@R9NfU_^0|^IIY>7f2rBL+2 zyn)T@M1vllKW4#mg5d{&KUBzEHa^*@^eh5o4lIa zb0@y7wMBCZ7L97Yf~Pgmc;mRZV*xp&pJJk97+*8JkOgL&VTBfEOr!t|>+uN&@ClkT z+4H(-CkjJVpiG(&@<_vUK*6gD1p$zS{?PM7G_9Da_Z|`V#1jJ{AhYO~{DC%@U~!}{ zOF@f|P`*eZdzy6yic?QfPJUXUml<#5qD74ym6=#>nC3hsQji6xPZ_fDVk5<_Jmc<`OF--vS?L zbkZ%0V&^4kaS=PAJXps@f*`G<&t>5q^+8(WKUKiVo%I2ygh7D#s(7$2V}!J^n3Ee* zk!Z-Z&dsbj-=e1(tVK;Mt5bU(^qE+NCl#H8Lb7VEsA-1LqBd6%Ly@JktnJub^J(T} zYFeRTh1uYg!4Zzb#r;ls_<>B7IQtJxM~O56hs3n&A$m7b(FDOL&Ne4fezIR0xKM+0 zEm1-0BUeGH?=XUz=ooX&7)<&Z%jyfBq<0k;)VOE$BJ86j94#Q11lwD_;M0&@N;JpPj8ZVI>PN07Bwrm zyILU|4u<9BVrqKaTfJK#@ji%{QztKTTu0}$YuPb<5+V!P*d~l@U1Y??(#YhQo)8g@ zPtmnfA)bgPDy(yQsU`O5@K@+`x*Wi(tOvW0M(UpWo`LEL1De_4ft5I(T_eIvsZ-xx z!C62PcTk8sy7u5LamPY?@ZIGOU|Yx?W)HgD;g?2l#2s|BD0lFDSiY9$4lnB0=8nba zgz+{`Kr!W#IB0PmVL5YA#BIB#%jD>nf!hJ`N(3=k5LQ)bGvqyEi} zGtFDU#X!kOf1>@-RX%2dhho$T^iEouqDEb!dW%?tB8~(M*yEB}z|gD#h?+y4#Kc^o zTMli<8lX6(B^O!)AY|0sC1YR;X}tUQdeH-Q@7S;T_L59EHXunD;L@Hg?!kn zl)jLS!s%D~^dPae{?NTr`qruW+BN5SzoF9CRs(t)uZy<1o9C2%2qT!%m(29Ld8YIs zjg)?DDrj+~PoLxMoGs0T#H{xz{le8s-{4=M^y#SCmYZkm3AuR^T{Ar1%`>HM8q>X7 zp!DNB0GiXsl{v1R(vO@sAWTM%a2=%|8gWg)rSu_@h)6+zNlG81;D{(oE2Y~@Epeh( z`dm55@=D*_kZ(8rl0g9#k-De8hl3591xlZE1lu8i?GD$=@MMs!XC-TkcVr7QNzf;? zrMtNpT2yov?%FgVB*A_UYireHpFwvt#Ql*YOnci}q1LC_PhoSxe%)!iGd@m!H>Qa2 z_eDT2o2kTCBcnf_$vL z*90xbt8}y|uL|fl<)C<8?d5`;YoI}|2@}EdgAd$V#G+~hDf)x(GD4BXC*XM) z-D2JF5Y*6G#D~#4F$&wO&TSDr=e8(twkYaZm2hpV5>vHomYSzWc8A-C)pEp*tKdJH zUtEU;H0@5tiQ@2)Uyi^b-8ek3B^Ux9)i&2y%U?4A<}W*YWUOba5ogD=Hh1=@KSsdX zE--_HaddHcpwjY01_^TZ7$hk;5lm*v3{uoGk zg`~xWiML=gU1hL!SM!obHu63#kyLtyDFa0HZzH6#Z#{Y>=b+^Oj9AAY>lm^OHDMVN z%{#|PJ4i$F-Rw!|b0#Q>$g$H^n`ti5a#{xS@!SZCc>pp#hh7dblP;*Dc#v!wkr6ij zExH$iSkxZKJDJ%~T(rZJ*cXM7j0rzL*1GffDI{W1CJT2Jo${ z1v4-hH0uJ*Pk4B(2vVzt+Xl2;5H?B^|FEv0aBIBD2GME5X=F57Y%fK zz}(6|z%u0vMxHd6ioICf3yS3P)u>DYZk`%NW@MG|qkXUUPlG56D9S2q%ySnvN7|%X z@E9;~67+NTShJy-HHU4kDBlpyd1XKRrnLeFp#mihA+@2uCLaO~+xd1$N^0wUBJ z5PMgk7EVMZr-P`gU9IpiBXXgn1KW!~h=i7NqiAVh1sX@^hz+WbHgP3#W76;t4=9vX zQ8SOHtay%ANEGJrDBsW|gt^IBIy*!G%IBj)YMm8k56v>5I?A4zuN)$e0m0R68v}5N zNaFx_sPvGC)?yd*o$&%!@T1rzrw&ix4g&DbcsXc=;srfvDQ2BXk5So;Y6}Jc_K`dS z_|C?;ZnQlQp-e;o5<(erN%uSl@s$M{pBvLI7eHJ^y|NgxGc`y*U=vGAP7(q~2J+lG zbCLA&6N||gK<_{o9-Pd0JeW@Q=&;y!-*&m)DvSVyw3C+8OIF$ut(RVGp)Cv?!adzE zLRnTikKdO`_LT^j$;B1;br z4YvdpbdF4RtGJ&nF{&5z2D_<= z&gl=_&Y~?b7StjU<7670%jUlmpJR)m@~A36HHME+W}w9eTB&rlDEr43XZ)?{%YSi^ zxSX&QW%sxj1D4FlvdNxjZv&Vp+i=htZ^7lrZd0gNvD^8VXC z{E;Wy$ijQbk<<%>cuWbV8T)I5u>@F_68JNB!ev)hX0qt!0BZq`_rsU_!;iKrPtlUA z4}WTmT`Da(l`~77l&Y3V>K|yy?VDp2!&%<;)Ycnj)~S^IUdSr7$FRtoU`rCC?*1`O zVMc^d(g;A4f|Xso3!N?w5mCezAxxt>=F!@k-(87>O+8H^9@oQdB5!NCrqG_4)l#6e zFbBJ^(!ua9Q*=eo@RTA^_~ih7sAtSstSY=;*xaiJyJ$Lkm_cr?R!!HLmF z+J*h;M?a;2WZ_fzD^M_`mKMSSB&>%L*p@iMp*WOZ3`v}Butli}7IxMq)igO2sqq=E zY!v1*M}VJgM9m(Mt^_A79&RwX2neKov|YKpf9=z4P9Qj_hCW4f`rONQ*#NLIJarU1-@p9%&212s~UQmjp;jV#uPs!EPRMH=zRMw=3Gg^W8HRT-Zah zJmMChF+zR@_>uOg@l)rg%1^{k11+S5kJCbF5j}))n7~1!*dYsHyh+~^X~C%>#MpA> z<#Y!Lv?Yux+1!Bq71oWf4c;%8t^iQgbm&uQ zVNAzziVmxm`2Jr&G$6qi2`>a^(+;V4aPz@gp7dggdJaFrc^`g4C0_^^-H9aEm4~KTC<^zcLhPpV>evnLsdbYw)4YtwoB;8b)~Ox~k>%G|ZpMLlQS=T(-qM0DxZ*J}kFX_>@JX&w#iM z9c2Q^&O_oag$FIMlE*wW7g64V&1u{!M+XHs?IV6zikaz+GcjHFMnNu1`Kb9LYdDOp zSiFl&0U9Dgfj?>!ZV^i{StEo4!kYru(#1=*$B!%WS#tu%fJsyGCr1NLj&|PtN+}%d zIJ_J(lN?0UwIv7GsM%u9qh6~3OBWBCIIV&QaiLDq5+^h7xtZ2r_Q}n-5&SZD)j=R< zD&80U7yL`Z#!wiO;961A>tIkFXci(xgBVsMlH+3MEkGc);ADsz+F*);M!K_cI1_`;P^Sm#OS3v%a(pi# zjz%0$fXP1gZ|y8)VvswI;M{4wK>; zY8%w|EY*qSL8FyWK`^le??R4KK)O)DFwulCl~9jgCB%}~#Q_NI80n72y2DjzP+%lW z6qpo^!$MjGqN>6cRk5Y5L?$W#!J0WDT;+(YHGC0nxBbpsqu`%v>8`!KLMw>zc41w) z{v-^tC@1Ed5f=h{ohRn-tF#8TBsw%k&FJ8my|*-b)HDzI%|mgvq`#s}7!oIJ`^k4z zbjsX!1^?5E-@YrcV>_^}_lBFdSC70vGI;4F;k^~Q~L&cfK zbXwBiFg_w!7*k-}D@v}Ktq9o?2u?9k=v*vCAgR-G8FQCn5}H9*|6v5b02oAqAnVTz zgyoJhe3hk|@>v~;`Caft4gjgr(PhxM?;myqsFczNdCg!+YnHWwAh2wazxOkHB;kYT zZUx3=b#;VZr!%Oibw{bGxm(EaJ(jYd`uDV$Th2t4cpvJ6+eh2PH96bs*(TR%^#*8V z73a9dTTXNzEWqzBH#IqWFK*&DEYNM>A{aP%#%b|EYB*+-qz~v!wqrJcs4N^BQuhtJ z2onvGY6x|Orcx)Z0g#L@ryR?owrL1PqJ%8YDALh|YfYeE2iYq4 z8uXz35lD&7!D^TB_j0=LW+3Qz3-LLqTY{yqe}?U>3sY0dzG2|qD*Ba9zl8UQs))MG%K z1t#u2D70f}IerQCY6;@lnv@EQM|-Zu^;bv3ni6?|Iah-=wkj}4gjQ@$HSmNgp_Xl7 zRDf6-FN9d^@0S%o^F6L}_}Zu*!9$KEdIXPhG<}b2Q}%QWwW(*ukkx>Jhd-Y8_6{fn ze0PzEBkapVK}Sm?hy?N_C4_V?A$*y3zW2AgdF^Y_A=o_3%13)M4rYby#T4pNDkf(= zZGfQ5U8io|Y&Mzn2bMo8v&3ts7vFy%O2o$LMXiCj zVKnq&^(qGvS#3cPjnZ;m;}>WcEsI2{YKj4o?;-nH&R(?@!65AG9mwqW^}Zw(`M;L? zKT1ICDKPI6zPIyYfDseX6?&^Zig9tZXxj^-wvOpI7R7G}Sv$HJ0d5Z;Nx~c-2?=Ub zVImad-wC-L<%mSts(@KK1<8UbS*WFCHKBsHm2!T-NV|6D7=)|k3ewS&4LB)IetU}x z7NrE~-7KyU=oq5oQ;H*e*LgU&WL*=dwCDL(I6~{1-+F#9Rj!lV4I?O*wmN|GuwXN- zFds;YCJ=VxeVU?nl)~(3)P`)YUzA`=G1gj)Nyp)P873Y=&8f4GT`-54E84? ztRzYend56D8JF6<4v_6uz|`_2v9jhO#XhHwQqB>`?SI^E$Y+iO8V^qC0i6VVI)*Dg z2P02I?Le1M=)NOUS`wK!lgs6~zr)bd~cR)ESIS`<)rgZlx^(b5NQ)q#r>EE;(C7>a&ftRS{=-(K<3 z{=(a%@r$L-_WGsxWP8Z`psqO6Y($$yL)i z=8fh+wF+{FOf2OhVcPxj+7L`izH9@(w1TBt#J)F_;|g99^YTz?TO(Ob?Wl*q@x1Nz zL7rxVv+)S_+U6jn*D}u@>1ajJynz?iNr`vR8tKLF2NN%Dw*CMU9hch4kx>d%T7`n3 z&$x;#;tZ|w(Ky}4hK#mynsyzZ(!$BIhM$kpHG(IysLBwRT2=idFmkB~@bm6c025_- z8BW%uvTcXjOSK`PYA>ttHzKaSVcYF2(q@|L!0iwU-d_ysf`pcrBfjer*)j{j(SSn|G<`VU-y!!R1e{JQ$*X6V>#|BB1XxCs-$+=jS@{mRC(8_ho2Vl09w)^-J zI#K4wj_eyzM31Ul???d<=%a%|YcSQ3Q236Mo?MnZW(+srY8VI9A%yAiVWP`@;E79# z0q~uu95rm52wMNtp_7jzc}y+q!Bl-Arn=2)4pDqq>1u@a)^d2O!$qL?8h};OWdg_+ z^l=A$^$z-SP^tHNC^TLcBQJ(RdCZ!zVKL_|FlY=_mUy;H3)u;ngm_Sw^I+nUH0V(1 z-^x=Jy_ybniI|Me`kAb!Gmkn2DHcIWKBPk#%)ThDbx*$^VoRsoLB0iu3N8* zI$|Y&yO8@>EH;HDwE#;LGH(McZQ-%!BeYtg1D~Y>dds76d=i##+SB816eq)c6jM;> zH>cCsD{>0V-ZlrZKM1%|7Eo(Wm${X>g*au{)AC8&uQ0K5gtAy)$EVQuLI^9jIM>9~ zTFbE~Ou3bqqDK8_M}N5+U(rq}a|S+cGF!^_^`JRoPNpgXDm-aqt2(lkIIG&BB7s4y zt~5d^yQ`;p+-*GPU*EI%>&N};_bm3hYGgAot0Eodj-eUrg8~6ciRq|xNc-eq(2xef zPzj_`S&*coAeqootWR=qR{A&TF)MhLkywMMW``Ua#F#xNiy0eJr)ZJp;7ZiA5eG8y zs(HP-CPOV_nNeV<5(^wdi?s2w%kB14?G{^mjNFm}Rv7N(!0^b1CFeqkTh)2y1f-@% zqRbB0hsg--?gIg?xs9;fqt1&5Z@wq*U+ckJ{A({4daVqeTC1+T8`lrBsJToN4zQ=S zL$*2t-#X3?z6ItN3`{P(mR9_YJA;(2q%bMKzi?ZxDzf&;&GP4EV`Xu9W9AmpHCv-; zX?;{_U7z>Y8sW-0j;pw`C1-2c$lO{&FCwb+HW_<0CSA>R-Z=MA(5jYXyy|l6hIIIH z>$-IGa%(M5ja9}m3oL!2R@2x&=X0ZknL>|(oWG^-S*+#^y;c&7h2Wl2}|%!2CnwZzoTp+jx2 zr~n@_^bWC4BOG63gh~th?nWspe$hLM@mB9RavKa+whf@HN6(%P9}5sAzIFImfGEAN zFE*xKL{+f%Y3m+728aLmrXcsYDF|w*ENqobmb;SG%D}4@@x^qByoO?Wz0SE8(`DN0 zDyE}y9*XI(3}7)`rG37lKBYKLF+$D`QTVKAx&tojiTY{ff^%Y-or=XvxD`TJU=c&G z=k=yOz$ryZOjvy`qH6%7Zc7tsnt0Ks$NSJxosLbUdF@5J|20#Wt;6bA z_JfmKDx3UDXTl`ZIi$}JIO{_+-Z7z|lt-=91*Rq^yGpy(a*CI+EAkoE%^s>uctKsgreRk|I#+-mC^i762(it!d7M3nsBU>{DzP2=HcyDrh?YPh}Z za_f4G7OPNvWi1g7^9ie}G!79P;5Gu}3xQ%6><%Rid?^mo87tEz8hcE|IABwZVk9Ys zv5^$b*6MVL1BkmqYlR*Lt<*ef2LY&Dp;?TGjA6P`u#N*}x>{2m5tgHLiQz+w=V4Pe zi8rbXl+6HCd9thZb?dC>0vXZ^CtTO}>lD3MRJd#ztLzPZ?KB-bTxSm-KSL|2VW|{U zs#Hof2@FWZ;FcIkJ8saS`aI-#XSIxN#+e@_TNe_tK-QMSI&=Jdw3pP^0t z;`?$PqZe+53#P6YPJMLs3L@*(2lH73I$QMp&StSqZjJKGPi`hK64=uqQ36zMRQ|tM zrj5qF4R5<`(+1H zGO=~r_8mKSP43>a_vTw}y%hy6%AR2JtWkSPcZkLbKK0Y6JqeG9KC*m#gQZdXhe_H- zM9uT`9DX2M!Ha+3J(H8!7(zQG{$?=Wfo~`1=W4`f;Y&Ca} zCh7H5Gdc3rZqL^6;)1XCaF%j6m!#KG&3MjN+n=>~ah`RhrtnbK=5E$EdMLY&yK@Q> zYtQLWeP6bc2agC+#En>l^FI-{?X?|AI?|c<^;A2fORW0Pxq)r4^f2~!uB;XhOMN|aAaDw`q-drM zXLP$fbQ30}QM*qT8(TP%#oXQNC2cbs+Kt+~y`*iLCb?c(m8S4-L**(5Ix`D!<1ySaPE z)sl8F+rx`Hyriwq_HuX7H(HE@_AB z8_85})Urj|tz@awsO{4llCQ4oIDmcHsG8m&pOIj%MVjO~;`zu+9Hk%^YMg>CkyL9Q zi95nh)R3-jQ&$cQJQ#f`gAnTB`aXf9B~dA$KJ{+Vr>GjWn`M0)wY^Cu<*>)y?M_J6 zXw)X%-7Z(`bj1!=Y1NXWlyOld!*&+q*nRuS5S18uFVzn#y6sjJQVWVQq6)Rn_!WDcs zOz-&8n+m=_rh@N;so*_@Jp&UW(a0QhU zy_hQ)V(45H`=}iSv(059T?AgeE{W;DR#W(DZsqGdBHh+(S&=(~g>Jp3y~sVHo)^RR zBKL?oFKqQ*phsJRq+^HbtkZo^d_a!%Ksv0bcx>+58$gT)y+3%jEh%iJ&g|ujFVdYh zklqjhS|UkvzTy0B+WdRulqh`P;;Saw6o992`q?rC6xdg}wKOLZLWHuaz;`Ejkojm*xH28h zE~YwufCD#1+>(_1gryp0iEaUzqDp5vl6a1vJB+o{7prFV z_{M-Sn;y_uF!X{37|t-cy$a0a!bMY0?dHODQ{TGvap^02o1YUME!6qA1YL{z^2=nJu3|9e* zq!B*Yu+nDF^`SB8L(7JH%iNHNy&ab>>vHKJ!LF9ujJ3Ff-$}fRMRQ%rA~Xlkv#8GL zE#OkICyo~xkj&4q=Rx^l2#{w_w%}TJu-OGWirjP=^v%HJxHE@pA$NM1+DoVgn)y;7L-#5Vp zlkZ{8g_B>vnoE0Flj{Yn`6g#9AG(HSmh(-d9uBGAJ=T`iwXIlQRMOg}z*0P%8}2q{ zJ9{(mPlW1r@49tS_)BReweg;F4hlA-V`iJ?kINCTGl$^0CWn$}4qpW7PFO|>4W5?l)C5?|Gx~6=p z#6TWYm(J4KUl*y+ZLwua1LG~bB^M>3Pvklu35%+DWT|I{V93@@xb6O>EL91VBsPx1 zzDxZ$@=I38$6u1BiVH7sKK_z)wS4>~>9~CSCFx4}_)8QCCO(+*xfc2Oq;Av8nUt)1 zzW1;Fd2QHHdNbVlP+ln7OOsEle<8CyS zZT5*BZPwvoP))WCX<>tDp}7_Zly!s_5q92H2kHqP+nZ`DNC!!zu_cClRn{QP8;@N) z=gfY)#MTrm58*?3Aw$`vSi9+@R1c>ET8{um$<`%o)#ST2pV_Rljh`z;2^k`Afa{pz zX`$Ehipb93MZk@Gr-Dnh;eaDCWQkjG!>%f`OcK=0=rH?XU z?GTIt@?+lz!6_?p_gTb)Gb_kLv`=}7fgvo;l(3MI<9M<~LXsm*_DLmy!4Jy7v}|*I zn*yql`Di^*AlD(i!qWxV#9orX1NZ}%#mtxa>s;l_ttGB!qVB2z9evM$(BO#=tMuYb z2bDX-)*gt~MrH*1aSL1W!lBa$+r?X#~9B zWRYpJQUbO4Qb-l@+$CKp_ubAukuRc<0Et!7A*4@AYp}qQ)+p#G)F=h#wE2|2PF1Bz z@={^p=S!4CDMCSv2=b9x1oRx=2Z4}IUoBvFDS%NZv`XaCgp072$Qj#>%f1+JoJpZ% zo?@?zNLx6h`we@V=Xn+jn>hjLY%?uvU4z$=U>M5+r*}=sAD`I zyBt89ney|si)ItFgIDc>o1mL*Z0RNaW9frR>xgUG)&VCF{VgU@Tt#zEM4KL1*vw5( zUtctRwD7f?pw6%@@){pf6SSptgm^e9kNYM_9h;ysRxt=pCdCPe7S>OnfRmJ>16)#G z{ zj>29sM;YwqC3q2S+K(G~4aRXM@co+A*K`Q8_lt6zqkoPt*UvRL&Q;A3=Bh5raYX3E zac1AeaXmbiPpyyRsP8$>PAFf6uq65AcSfr&7W)#Ob@18iS4(tmSfaC%oR{(A5}lWw zYmLYIBA6d=czn%7XHITt?L{mC120WmZEmm!EK{zT=!{p^o9K)m!z|baT9D|>K@>}L z=JskvZ_Q6XH9;Jd^VTpT;MuSbk-?VJ}XC} za}6kHMxrx+3N=r3=Fga7EG^NQOUrWBBSDLI^D>0OgS9N@l?rz1U7qFK@LA6M1=yM9 zM%>s2rpI59_qFe| z4c4JrI)E3a4Tgw_DA7?KL0XHGTL0b7LpL@V&dk{U#4FoL+Ig@nX00ELoB1kLSARD2 zr2-?Ia@TvbDcO*Ig{8HEC8u_gWV~*e>yH}zeAs567H%d zWp1gQVm?(D8v+Q}P%tMK6LR2%JqHZIcUJ2RrMw@CcdHM+@c|W7fG|x-Ckw=b9R0lp z3h`LQlPr!n)M^R%={VaCh%kxKRhJlDwZv#1jq8lCON{1jl!%-iw=;!?26b8mJLnXi zy>*GvTsn8u>Ar=D(Hzr3oAoC~^Wl3-j9!(wjA-_0zy-=zfh~C>S|3VpS4jjx%IsXX z?wtRSQ&|+Y?;Y^>w7@;`0YY-Z<_RfAF|SWB0-m7NJQ1b;H8R>mP9@vPC6Y3K(ynrH zvS1R=Q=MHa2!f6QHAX|QkdyB|6d3($&rCUZbVYeorDaHiN=3>+yFO0R$&gk8d;X71 zP~u%KN7@c>dW*y#AL-;s=afx|>i{R-H)Haud6T;4l#z0zHABNK zaSqEZv}uD;=rJHPm&CnXITY_Uo$OKVg~Fp)J>BA8FQT&fY-2j0Uj3G+WiIA8cGxa! z3_#@&k}?gcPu8J^7bZ9^%a$?A01%Pqkbyg0YWi;AF8-bJL41@bY533OMS`QuNgise z5K0@F?T>6bv#iX>Nu?M#E+B2u?=4t{Wu6+n!ln4wSL7PmPeRHvy*WN@T1VLxf(c99 zcjg+|U)tFs_ePR9+UA4lQ4a%*mZcB*z6p0OQ6*dk<#&P^2Pd6;BhslT z>xGh}PQ!(fz0qnST0@qooh~Ow(y^A&5;BaYHF!`)(WLD-AKaq4SvIH+2;ymWwoFVs zHi^``vwqs#b(X;dR-`Az*?3GFFUH-N=9xCfgwXa#3{+aGWKGKs*GWM@Sk(`L6EyP< z2x`*JoDr3Mn6_JIP$*+xszJc9dDH*GLLdl(xT?%n3`0oj{6ws7m|7>&W_CJ}Jq(N- zNsH8n+058=rliDhb>J1>HKx^%NE=(yqPR*9>4GUZt+L1z;C&|}f^HG8d+;x?krDH5 z7Jv;U)c%@KTgtWw=FGCc!je?GDcj4%VU~z3iGJzz_ z%E3i)<=GZ3Zm;bvpUB;l#tn9q$W0Jies+*r2pJ9LbdkQc;v`ARoq83iBGUz2xxeJ) zy`etyU36MkaUW;Cz1H_^+LrJLOj^39hV!qNpriu7=uhT>ve3masE^8j6 z?q zWO%SaLQ*%L0SD|YT-H|9G8@2a>X=2aE?40y{B=1>erIWLj1k|LOqhy80 zHQYJqlyp8R(5R5MmZ=yAB#P12Diyviy`q?uOD>vhYLuYenp;@hOs zASPkTi5yFizfRfb_)H*|ElTfUbtTM>O63j|+G?#+xD@xAhv0+>h1>taOgUWb>?CH? z&PAFxL~@JO4O8nxn#+m6sMlOnHihf0g*HapOH<@bf5tXYGLPj7xa4>xD=alvv1_1m z9mz<&HY#Q$JCB}@nvGhdf0rF)%;!6HHp4}=`}KD3g!$wn-k{gp{VzDk;>?ZH+Y4sj z1CwSiZ$2HylXRX7URlrV**>ha;CIx|Ql+|yn%qH8rMfMkXE)2uQZH!ekkq3*%>{M3 zGAC@o(L{vnCv4|M$4ATE;HwE+be+h-@`TlL5mN+VEz8ZPgSai^bm>)DZe57!!dOu{ z9vln7IZj5*$$BRziQP!=N zwJ0K4OS=R3K1?6VasdNCTK2^`cn#g|Ckmgf&FyLmdKen~V?46@ZGfM)z3JX5_?%oVZb5Wcacm7>Xs-HWXUGC)a z?{ALE=^9d28)=Yy&<;&iCb>^ICDc!A$v1rn) zUG7V6BfjR6+Y~aBUrokYp4>*;lrPbAliSE|(!xSXUu5d}Hw!u>AfVItQibi62orx8 z*|@ryu2j<7kcuINzj8Rl?|E{Y&P=P43Mviw8#S$QFEd-)A6C%_q0%3ndk2RR<(t15Brg z?Ld9FM zE#T8Msb6U<(Q3Js-*i^gmiDH6H#-2mM8~0(@5VuwG}Yg9snhY9bSbeteF`#P_4MSs z0Sq35+m<5X-K~1SDt_6?HlOuWN{*~VrIYWrOx}j_-D+Arh(p~6;*{6Gp-i^f`AbfG zgtXd{Z%3e~s=xRQPw+|8cm79`G1 zb*{?)|NCkTq)Fr8=C>c%GND7Bn}SehKvNEZt{GponscDVhR%UmALrm_Qu`>kI_qg(k*|0! zhd`6s59AdeL;k>U4 z*;;O&5ZsLw3v>M&koQLW+XE*YU)3a9%xwE#b7u|KL zae%fD+j}@smFV>BLS*mZRB57vv^MS(=SCBqo?VFQ-5eoJbdc7n9nF?<$LU!#{vGux zj)x{XJ==%SNsfsoIz?+OKExs6L`P_Q&^alv>49UkoMTONa`vjJZK!QjDAIHhoK&LP zsRdKJofD*qj?XTf+U*&uRvn);2;P}(;Ev<73#WD@+sF$J(OR`b*(UBdIcrn<5GO7Z zot*8P+J`tzm+086wRlIijl1JLQ#(|Dht5UP!{PdYYzuE65X|^7FbZ?Q;J_$GHK%tw z)N|o=9Uj%5iRzgWMxQF5sm7Ym3~iU&CU8uX+EMuiM6^aZJeuf~tx4t%4v!`}T5E#2 zBiqg$M{B#-+`$7*)%G#U{T%*GbgFhCHt)}N@qz=kHtFrzBzK&uU5L&1a1J!l0b8rK zjl-XbovM`&wT;7{iB8q_3FN&TJWO=Fwhzbmaz-(!y~p>nmGhm6&d7Gy=TLoXZJSBs z;reEd_9Z$cdlimb9BAyB@NWoN9GCSomOxHs|Dzrv*nPv_mHkh8%$Zr6#|}RJ!0lZ< z032pIU(~}p7a4aIo^_%_v*na8?vW~`^b9uaB+F5d~x3E5jo#9=up180=YY910mvWxB@YQkY#Q@{tbL`^tbn@J_z?(X&{ z95GKgIBW0rx#Bigyv-H2x`N}ZYHr6_6CG#OogHUQY8+>k{MvEW1fjNfcAPcge7xP+ zan=Ninc}qLtO92aaJLX@_v#|U(wRbs_~ zRuvp*tx|BHRmECYaG+IpZCA8(;4_f`=^+PNRdAqH1qWJHaG+HM2U^u9NrSrMK&uK4 zw5s4hs|pUZUQfY+)*1x|S~YtPw5s4hs|pUZ4pVTTRfd8CttvRss)7TpDmc*Eq9AQl zdYuEUD(paOq64j)xw8YUiFPM%;m!`UCfXy=9S2%(rik1fYk6bFfB>id;X(O>0#*EX z7d&ZK*`I|oys}p#Z)EibBH6h1pCgMaofc zk%nyxWQzA_BcfH3)4`o>vZKFjlZ7;1rF38~EulB06El!LV8(`!y3DkqRlf17%wZIbhm_RU&X%vzn%VvFf5%`K!p_%#Nq5r5hy4`;+fm_!I8_WT z9P9`uN0=Ps%54dghn{UzDzHBN(zd_ZQDF1A%`!v}*b-AJpl#;*m+VB;-JkC$=*#`1 zs81qguW=M{X$Enm6L*>0)ZnxGIo%Xs0LtpA1W1?zLIp?4}R zZ#JKl)#WUoIzgLL$tI=XJbS^c{rK#(I}h^~rgsgrzUkQzIA44=L`+=T?_%KVKvNI+ z1mLM`J1cL2I<_S&@^MUtIHkWr%-j`!_CZO8q#L`xoyRf|Zq<&k{v1SS6F8Q+6tBCg z*hBpZAFLyP!biJU{0Sc&;y}H_wJy^;`R%JtXK33HZTLDTGo0?qbB17cR>1j(@N_E1 zQdC*CyRd)7DK|EE@~ki|h&To0I0{|omo)?8EdKbCn1WBI`_OLxsf*5QR@zcx_;}j0 z$YY`$L-6cI!io;T6C$wmFWXBNZnN$&1E<3{M}iKsvH7bc8r$}CNwCiKR@{4N!{$zA zyvvtzGxdArD1Rv!VIx1MAw3S1SIu2&NO9}_0~wvk>90Mz*Iu^zQA2*SdR6d=NlLA* zLpdo6zoWD@ca*lxo$5|~XWi2lIxE8Pi_9I)V*5Uyd-YA7=kR~(Gr3f;qdw`?M*}*C z0@xX6grKdtJHBywW(B7qy`IcZ?s)uh7{KSQ+OYsx7HjRX=s7OuqpJ9bxQpYXysE=! zUe)8ZziKJv>)JXBVtCCPI-F|Ep498M_$%XpAqJqL#6tXyhzvo5mq*%(Qy@OuY(4n_;Or=MB4ZX3@ zYg@K7w~ak7W8EqEG*~~iMX`-*=Oo)#>c=(%2*s9k@dhaF!5%0sq8UJ`%iec*2TF%j zaO?G*u&ll2K0J1s^h6p3=Hgr(z^SqK z=KOdLch;iIsXe$epd9Y35|Y3M$>$fN7^?ceUB-{#SE0o%06sx8MJo<4T+?1j0!%c)bR&K}$H==3q` z`-L#6&(rTJepZx%pb=y*(W=I+ehU25`DySo$dAAn3bI!?%XZ(~ERY_Uojp4nWPd_8 zOL(XH`dJ!ee;FntP2d>fc7k##XE5qC+40=&ptXm`{1dwk1=qR zEM?9Pz}czCj^sdoAxcJuX`Vwg!u2wKmIv9Z{DHFv&(5Bnnwy)RO{X0+^Kr6*j?T{= z-*Wzm^IIO9I)8f0>|;#(q|Ny!_A-rKV_#@L0Vvj6Pkw`6CY;O@(XWW`Dkqu?ClXPh6= z3Lf}IA=z|=aW#zq*o{7v{EuP{0)Xt46Lz1yP)tJD@x@|Ne2JFZ0ic*{KXZ0&dT)B~ zg)`}6C*~ebkKTL#eeXH4KfC?T_uQM^e&E)vM-2m0=>t>8PR`9v9h(;9SBgo+PxVG7 zUP=aU?9O>=F6H5+QWD>|F%7a8N(q0mIeUqMmY=0q!(2#-kY z-=aBve!G;^h5wu<+6;sLd~E6r(@AHik6oBOf8x>UQ%|H*$Ie|iF*}`}zA!iaIOCR+ z`YWJA9FXz@KfY2ZPITC3^$r}&XTRg%@+?vEThd;0X*Gh4dYl#IVZvr8f}|EVMx{3?$g;Zg$h zO8{I1>6K)No{pWJo!&A#eg49!IfL+0HHr3ulTTKYk?W|fe)O}JpX>R#0T`;uu!q4R zeaq>y$F1?J)i;B+`2m0__F?UXfn@T*DVY0sI(IfjnN815%}s-n6Xz~Wr=GNj-o7_| z;KbZ{gnc@le*EF73+Lyij|bTw(ceqJD6ziGM+L^qC!#k}_VOX?m)`EB6+ zB}!rZFyb=;57(0B)G0~y6De{#d-gFw|3WR<<2h~0I!dR~_uO?~`smatrhfc_G-Ha^ zn0ioJ>BL-m;(U61`uyDN*(cQe)mpOQ7-|mCj~;$R6WY7?!kNcrryg0i{-|a%l^%W9 z*)!8eU57wX@6!FOH89e>R8K~8;NVxduouWL*OR*bYA};AU4Y>KQ9Wt)KCh=Ar3y>ePvc&YXtH1yE8Ex9-|Hxpnu}J=-R>ZQZtQ z+xBfcw(Z=uYun_u-P`tTpV+>2`?l@dx9`}#bNjCCliPQ1-?L+4$JQO&c5L6VW5>=N zyLL?O*u7)V&WW8{cW&FcedmsyJ9qBdIk|K9&ON&(c5U6YZP)f)J9h2dwQJYpuHC!# zOioO0o!mCLeR9X-&dFVqlasqA_w1h7y><7t-P?EX*u8W2uHBQnckkY_2N3r#{2sdA zL$f_Rf_axFg_QqLg~Lg>5t31$>|UVY;Y$?j&^;9EG3dj|$VO0@^X4Y5H}kUv))-ET z-@AG9=I^6RYF$CSCA@hRBP@$|4<&T`=tyz`{B%s{=}K%(~pbOS0*<|vq>3GrKpZsROE#-$ERkWxY;Yc6KBq!I6f@_SeaDPb!vW| zyO&ocrS<9A2h*cizLiNx@#@OAsuRZ+*NJ0Eu;C2bW9wj#A?9eRMpjr(DW*EeEGC z(F@~dUd=G8k=`p2e`HD*ze^uh4>YMpq zjQ6w}3MY)eI$2^+>Zu#mp1-g8I{LZj z=L`R=@}Hvrr}&=>--%yC=e)2cc`3U5_!B?;@&A6}eeXZ|(I5WUrSVmN+8Dg^uFYF+ z`{4H-`Q`uZxsU(IC;pqC`=wv|mtXwSSAOfyzWx`5p(X3L?wH(r^R0*8`F+p*2(Lc# zYya{~zxCCxef=+jLcL*c_uhQq;GuVZ==k(=pZJNN`pQ?oR;UlHKXB-M+<*KNKS%X1 ze&x@<{uftxdf?FU>G@}#`yW2{>!1IFKfLlcAO8N2{NN9N?D-d7{Mk?c+%NpvuYdlF zzxma#{qetj$MgT{Uw`SVUpw@!!|(f^4;}fzANkQ=`jub({BL~eH~(;G+4ArG;D7j! z-+67me)`;>{dr?>&6%^~tBySN^gsW_|FmrR>NN-Nc-P_gf8c{3divrofARPK;7_jn z&Hpuf{zvC7{G%WH%9bNHY~J#zU;Ne2|K`{J@XvpI-;X`NW#UKIy!MOVdF`vOz3cD? zzPDT%Y~Hx#um1YX*~wdP+kfEFC%*IAeGgsu@>gE@-9P$Y{*Ujx7G%HMO1>DSN7~Q+ zdEwc&SH_CPp=W-fadYwH&ehB2|2$q%2@CCbps=G*=F=mkax=MSa7p?8N>mshsK%AJ z97l0XjHehUrLZwl+#3&-OT}j8z2&GpQopBgd%P(Q3qz&B+TOyd>+7Yv($j^R>*v2* zeDu zTAly-U30bhf3vbyoPVu2|0~6{wV(LX!0&AsdG6!!Wc8U34$ptKGXL4zb`}OoyDJAP zwbER&I{rZ6d#dvv9vvT8Ry{Z{|3jsJ_F`>$Ve8Knp84Y&%C%x~{+|v#bGrHXx|>RO z73M!)nE&;7EFMJke}=uoQW!Gh2)>R6;v{N@Lxm;9rAvmRk!WQ+UR+gJ8_vWhqt8XZ z8~uLm532tr`orjt!&i&ni2f?QQuv$j|Hgh_S)2T$uy*6kZ+q9_AN}c{{>P$dOS`;K?sbrI%mXavPq@4aqm6 z54HbcF@_w|g>cK}`Da(fTL;GrYpbh^8;Wl)G;W&z`O@0L+QPcZjwGDF^vq;+*+6Cf z`91NmN_Apcu@#RM!+pC8cNW(b;zG4jE$>TjEYzyI;=RR{Qpn#%EzbY&huZI`49x%RhuQ~{fl__x z?#jTfl`)FsnWOjB!e@eaRPI}~=b7@sfmQJxhbH4jW#HML{qT=Jcp;hp!Vi7!xh+5X zyU*V7Gyme*J>{DU(a{?Q4i2m2SUuf2Dm9)GZK>z-BhjfESZ3yR@#d`rcaM z)_8n)bX_>O{3C=OzO^nHxr8Z^|M4iln9}ZhDIVzIxN50Dki(paBwmO!FkS zQf}ji0L7&ZNwj%0YugP;{R)8Uze|)XkYC)89FWz~f2sXm%*A;#{$+M$Lz3*b<(*#= z&TmW_?!ny`=KQlu8MW=s-$BV?np4*g+ zJmNcefwCup_QIxXEUP}VDG5s~f@%5+O+;S8WWD5lWz$=v+5F~3f&S!XJV&~2Gr}GW zKk>#Fdmim|k3O>*?xvRFRxeS?XZi}rLzn&zwU6@XIv#z3+N*F#HYe9z6|n4as?M|C zcM*>*$@tWHBB>S)a8Zc8>FE>4<>ukJ;BaoamPhu=mZbf9gXDpcZ*J+r_bFf`g7w@) L_t8J+(Zv4?U`;jz diff --git a/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/read-wasm.js b/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/read-wasm.js deleted file mode 100644 index 6e066d6d..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/read-wasm.js +++ /dev/null @@ -1,49 +0,0 @@ -/* Determine browser vs node environment by testing the default top level context. Solution courtesy of: https://stackoverflow.com/questions/17575790/environment-detection-node-js-or-browser */ -const isBrowserEnvironment = (function() { - // eslint-disable-next-line no-undef - return (typeof window !== "undefined") && (this === window); -}).call(); - -if (isBrowserEnvironment) { - // Web version of reading a wasm file into an array buffer. - - let mappingsWasm = null; - - module.exports = function readWasm() { - if (typeof mappingsWasm === "string") { - return fetch(mappingsWasm) - .then(response => response.arrayBuffer()); - } - if (mappingsWasm instanceof ArrayBuffer) { - return Promise.resolve(mappingsWasm); - } - throw new Error("You must provide the string URL or ArrayBuffer contents " + - "of lib/mappings.wasm by calling " + - "SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) " + - "before using SourceMapConsumer"); - }; - - module.exports.initialize = input => mappingsWasm = input; -} else { - // Node version of reading a wasm file into an array buffer. - const fs = require("fs"); - const path = require("path"); - - module.exports = function readWasm() { - return new Promise((resolve, reject) => { - const wasmPath = path.join(__dirname, "mappings.wasm"); - fs.readFile(wasmPath, null, (error, data) => { - if (error) { - reject(error); - return; - } - - resolve(data.buffer); - }); - }); - }; - - module.exports.initialize = _ => { - console.debug("SourceMapConsumer.initialize is a no-op when running in node.js"); - }; -} diff --git a/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/source-map-consumer.js b/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/source-map-consumer.js deleted file mode 100644 index c9f35d1e..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/source-map-consumer.js +++ /dev/null @@ -1,1237 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -const util = require("./util"); -const binarySearch = require("./binary-search"); -const ArraySet = require("./array-set").ArraySet; -const base64VLQ = require("./base64-vlq"); // eslint-disable-line no-unused-vars -const readWasm = require("../lib/read-wasm"); -const wasm = require("./wasm"); - -const INTERNAL = Symbol("smcInternal"); - -class SourceMapConsumer { - constructor(aSourceMap, aSourceMapURL) { - // If the constructor was called by super(), just return Promise. - // Yes, this is a hack to retain the pre-existing API of the base-class - // constructor also being an async factory function. - if (aSourceMap == INTERNAL) { - return Promise.resolve(this); - } - - return _factory(aSourceMap, aSourceMapURL); - } - - static initialize(opts) { - readWasm.initialize(opts["lib/mappings.wasm"]); - } - - static fromSourceMap(aSourceMap, aSourceMapURL) { - return _factoryBSM(aSourceMap, aSourceMapURL); - } - - /** - * Construct a new `SourceMapConsumer` from `rawSourceMap` and `sourceMapUrl` - * (see the `SourceMapConsumer` constructor for details. Then, invoke the `async - * function f(SourceMapConsumer) -> T` with the newly constructed consumer, wait - * for `f` to complete, call `destroy` on the consumer, and return `f`'s return - * value. - * - * You must not use the consumer after `f` completes! - * - * By using `with`, you do not have to remember to manually call `destroy` on - * the consumer, since it will be called automatically once `f` completes. - * - * ```js - * const xSquared = await SourceMapConsumer.with( - * myRawSourceMap, - * null, - * async function (consumer) { - * // Use `consumer` inside here and don't worry about remembering - * // to call `destroy`. - * - * const x = await whatever(consumer); - * return x * x; - * } - * ); - * - * // You may not use that `consumer` anymore out here; it has - * // been destroyed. But you can use `xSquared`. - * console.log(xSquared); - * ``` - */ - static async with(rawSourceMap, sourceMapUrl, f) { - const consumer = await new SourceMapConsumer(rawSourceMap, sourceMapUrl); - try { - return await f(consumer); - } finally { - consumer.destroy(); - } - } - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - _parseMappings(aStr, aSourceRoot) { - throw new Error("Subclasses must implement _parseMappings"); - } - - /** - * Iterate over each mapping between an original source/line/column and a - * generated line/column in this source map. - * - * @param Function aCallback - * The function that is called with each mapping. - * @param Object aContext - * Optional. If specified, this object will be the value of `this` every - * time that `aCallback` is called. - * @param aOrder - * Either `SourceMapConsumer.GENERATED_ORDER` or - * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to - * iterate over the mappings sorted by the generated file's line/column - * order or the original's source/line/column order, respectively. Defaults to - * `SourceMapConsumer.GENERATED_ORDER`. - */ - eachMapping(aCallback, aContext, aOrder) { - throw new Error("Subclasses must implement eachMapping"); - } - - /** - * Returns all generated line and column information for the original source, - * line, and column provided. If no column is provided, returns all mappings - * corresponding to a either the line we are searching for or the next - * closest line that has any mappings. Otherwise, returns all mappings - * corresponding to the given line and either the column we are searching for - * or the next closest column that has any offsets. - * - * The only argument is an object with the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. The line number is 1-based. - * - column: Optional. the column number in the original source. - * The column number is 0-based. - * - * and an array of objects is returned, each with the following properties: - * - * - line: The line number in the generated source, or null. The - * line number is 1-based. - * - column: The column number in the generated source, or null. - * The column number is 0-based. - */ - allGeneratedPositionsFor(aArgs) { - throw new Error("Subclasses must implement allGeneratedPositionsFor"); - } - - destroy() { - throw new Error("Subclasses must implement destroy"); - } -} - -/** - * The version of the source mapping spec that we are consuming. - */ -SourceMapConsumer.prototype._version = 3; -SourceMapConsumer.GENERATED_ORDER = 1; -SourceMapConsumer.ORIGINAL_ORDER = 2; - -SourceMapConsumer.GREATEST_LOWER_BOUND = 1; -SourceMapConsumer.LEAST_UPPER_BOUND = 2; - -exports.SourceMapConsumer = SourceMapConsumer; - -/** - * A BasicSourceMapConsumer instance represents a parsed source map which we can - * query for information about the original file positions by giving it a file - * position in the generated source. - * - * The first parameter is the raw source map (either as a JSON string, or - * already parsed to an object). According to the spec, source maps have the - * following attributes: - * - * - version: Which version of the source map spec this map is following. - * - sources: An array of URLs to the original source files. - * - names: An array of identifiers which can be referenced by individual mappings. - * - sourceRoot: Optional. The URL root from which all sources are relative. - * - sourcesContent: Optional. An array of contents of the original source files. - * - mappings: A string of base64 VLQs which contain the actual mappings. - * - file: Optional. The generated file this source map is associated with. - * - * Here is an example source map, taken from the source map spec[0]: - * - * { - * version : 3, - * file: "out.js", - * sourceRoot : "", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AA,AB;;ABCDE;" - * } - * - * The second parameter, if given, is a string whose value is the URL - * at which the source map was found. This URL is used to compute the - * sources array. - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# - */ -class BasicSourceMapConsumer extends SourceMapConsumer { - constructor(aSourceMap, aSourceMapURL) { - return super(INTERNAL).then(that => { - let sourceMap = aSourceMap; - if (typeof aSourceMap === "string") { - sourceMap = util.parseSourceMapInput(aSourceMap); - } - - const version = util.getArg(sourceMap, "version"); - let sources = util.getArg(sourceMap, "sources"); - // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which - // requires the array) to play nice here. - const names = util.getArg(sourceMap, "names", []); - let sourceRoot = util.getArg(sourceMap, "sourceRoot", null); - const sourcesContent = util.getArg(sourceMap, "sourcesContent", null); - const mappings = util.getArg(sourceMap, "mappings"); - const file = util.getArg(sourceMap, "file", null); - - // Once again, Sass deviates from the spec and supplies the version as a - // string rather than a number, so we use loose equality checking here. - if (version != that._version) { - throw new Error("Unsupported version: " + version); - } - - if (sourceRoot) { - sourceRoot = util.normalize(sourceRoot); - } - - sources = sources - .map(String) - // Some source maps produce relative source paths like "./foo.js" instead of - // "foo.js". Normalize these first so that future comparisons will succeed. - // See bugzil.la/1090768. - .map(util.normalize) - // Always ensure that absolute sources are internally stored relative to - // the source root, if the source root is absolute. Not doing this would - // be particularly problematic when the source root is a prefix of the - // source (valid, but why??). See github issue #199 and bugzil.la/1188982. - .map(function(source) { - return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) - ? util.relative(sourceRoot, source) - : source; - }); - - // Pass `true` below to allow duplicate names and sources. While source maps - // are intended to be compressed and deduplicated, the TypeScript compiler - // sometimes generates source maps with duplicates in them. See Github issue - // #72 and bugzil.la/889492. - that._names = ArraySet.fromArray(names.map(String), true); - that._sources = ArraySet.fromArray(sources, true); - - that._absoluteSources = that._sources.toArray().map(function(s) { - return util.computeSourceURL(sourceRoot, s, aSourceMapURL); - }); - - that.sourceRoot = sourceRoot; - that.sourcesContent = sourcesContent; - that._mappings = mappings; - that._sourceMapURL = aSourceMapURL; - that.file = file; - - that._computedColumnSpans = false; - that._mappingsPtr = 0; - that._wasm = null; - - return wasm().then(w => { - that._wasm = w; - return that; - }); - }); - } - - /** - * Utility function to find the index of a source. Returns -1 if not - * found. - */ - _findSourceIndex(aSource) { - let relativeSource = aSource; - if (this.sourceRoot != null) { - relativeSource = util.relative(this.sourceRoot, relativeSource); - } - - if (this._sources.has(relativeSource)) { - return this._sources.indexOf(relativeSource); - } - - // Maybe aSource is an absolute URL as returned by |sources|. In - // this case we can't simply undo the transform. - for (let i = 0; i < this._absoluteSources.length; ++i) { - if (this._absoluteSources[i] == aSource) { - return i; - } - } - - return -1; - } - - /** - * Create a BasicSourceMapConsumer from a SourceMapGenerator. - * - * @param SourceMapGenerator aSourceMap - * The source map that will be consumed. - * @param String aSourceMapURL - * The URL at which the source map can be found (optional) - * @returns BasicSourceMapConsumer - */ - static fromSourceMap(aSourceMap, aSourceMapURL) { - return new BasicSourceMapConsumer(aSourceMap.toString()); - } - - get sources() { - return this._absoluteSources.slice(); - } - - _getMappingsPtr() { - if (this._mappingsPtr === 0) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this._mappingsPtr; - } - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - _parseMappings(aStr, aSourceRoot) { - const size = aStr.length; - - const mappingsBufPtr = this._wasm.exports.allocate_mappings(size); - const mappingsBuf = new Uint8Array(this._wasm.exports.memory.buffer, mappingsBufPtr, size); - for (let i = 0; i < size; i++) { - mappingsBuf[i] = aStr.charCodeAt(i); - } - - const mappingsPtr = this._wasm.exports.parse_mappings(mappingsBufPtr); - - if (!mappingsPtr) { - const error = this._wasm.exports.get_last_error(); - let msg = `Error parsing mappings (code ${error}): `; - - // XXX: keep these error codes in sync with `fitzgen/source-map-mappings`. - switch (error) { - case 1: - msg += "the mappings contained a negative line, column, source index, or name index"; - break; - case 2: - msg += "the mappings contained a number larger than 2**32"; - break; - case 3: - msg += "reached EOF while in the middle of parsing a VLQ"; - break; - case 4: - msg += "invalid base 64 character while parsing a VLQ"; - break; - default: - msg += "unknown error code"; - break; - } - - throw new Error(msg); - } - - this._mappingsPtr = mappingsPtr; - } - - eachMapping(aCallback, aContext, aOrder) { - const context = aContext || null; - const order = aOrder || SourceMapConsumer.GENERATED_ORDER; - const sourceRoot = this.sourceRoot; - - this._wasm.withMappingCallback( - mapping => { - if (mapping.source !== null) { - mapping.source = this._sources.at(mapping.source); - mapping.source = util.computeSourceURL(sourceRoot, mapping.source, this._sourceMapURL); - - if (mapping.name !== null) { - mapping.name = this._names.at(mapping.name); - } - } - - aCallback.call(context, mapping); - }, - () => { - switch (order) { - case SourceMapConsumer.GENERATED_ORDER: - this._wasm.exports.by_generated_location(this._getMappingsPtr()); - break; - case SourceMapConsumer.ORIGINAL_ORDER: - this._wasm.exports.by_original_location(this._getMappingsPtr()); - break; - default: - throw new Error("Unknown order of iteration."); - } - } - ); - } - - allGeneratedPositionsFor(aArgs) { - let source = util.getArg(aArgs, "source"); - const originalLine = util.getArg(aArgs, "line"); - const originalColumn = aArgs.column || 0; - - source = this._findSourceIndex(source); - if (source < 0) { - return []; - } - - if (originalLine < 1) { - throw new Error("Line numbers must be >= 1"); - } - - if (originalColumn < 0) { - throw new Error("Column numbers must be >= 0"); - } - - const mappings = []; - - this._wasm.withMappingCallback( - m => { - let lastColumn = m.lastGeneratedColumn; - if (this._computedColumnSpans && lastColumn === null) { - lastColumn = Infinity; - } - mappings.push({ - line: m.generatedLine, - column: m.generatedColumn, - lastColumn, - }); - }, () => { - this._wasm.exports.all_generated_locations_for( - this._getMappingsPtr(), - source, - originalLine - 1, - "column" in aArgs, - originalColumn - ); - } - ); - - return mappings; - } - - destroy() { - if (this._mappingsPtr !== 0) { - this._wasm.exports.free_mappings(this._mappingsPtr); - this._mappingsPtr = 0; - } - } - - /** - * Compute the last column for each generated mapping. The last column is - * inclusive. - */ - computeColumnSpans() { - if (this._computedColumnSpans) { - return; - } - - this._wasm.exports.compute_column_spans(this._getMappingsPtr()); - this._computedColumnSpans = true; - } - - /** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. The line number - * is 1-based. - * - column: The column number in the generated source. The column - * number is 0-based. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. The - * line number is 1-based. - * - column: The column number in the original source, or null. The - * column number is 0-based. - * - name: The original identifier, or null. - */ - originalPositionFor(aArgs) { - const needle = { - generatedLine: util.getArg(aArgs, "line"), - generatedColumn: util.getArg(aArgs, "column") - }; - - if (needle.generatedLine < 1) { - throw new Error("Line numbers must be >= 1"); - } - - if (needle.generatedColumn < 0) { - throw new Error("Column numbers must be >= 0"); - } - - let bias = util.getArg(aArgs, "bias", SourceMapConsumer.GREATEST_LOWER_BOUND); - if (bias == null) { - bias = SourceMapConsumer.GREATEST_LOWER_BOUND; - } - - let mapping; - this._wasm.withMappingCallback(m => mapping = m, () => { - this._wasm.exports.original_location_for( - this._getMappingsPtr(), - needle.generatedLine - 1, - needle.generatedColumn, - bias - ); - }); - - if (mapping) { - if (mapping.generatedLine === needle.generatedLine) { - let source = util.getArg(mapping, "source", null); - if (source !== null) { - source = this._sources.at(source); - source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL); - } - - let name = util.getArg(mapping, "name", null); - if (name !== null) { - name = this._names.at(name); - } - - return { - source, - line: util.getArg(mapping, "originalLine", null), - column: util.getArg(mapping, "originalColumn", null), - name - }; - } - } - - return { - source: null, - line: null, - column: null, - name: null - }; - } - - /** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ - hasContentsOfAllSources() { - if (!this.sourcesContent) { - return false; - } - return this.sourcesContent.length >= this._sources.size() && - !this.sourcesContent.some(function(sc) { return sc == null; }); - } - - /** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ - sourceContentFor(aSource, nullOnMissing) { - if (!this.sourcesContent) { - return null; - } - - const index = this._findSourceIndex(aSource); - if (index >= 0) { - return this.sourcesContent[index]; - } - - let relativeSource = aSource; - if (this.sourceRoot != null) { - relativeSource = util.relative(this.sourceRoot, relativeSource); - } - - let url; - if (this.sourceRoot != null - && (url = util.urlParse(this.sourceRoot))) { - // XXX: file:// URIs and absolute paths lead to unexpected behavior for - // many users. We can help them out when they expect file:// URIs to - // behave like it would if they were running a local HTTP server. See - // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. - const fileUriAbsPath = relativeSource.replace(/^file:\/\//, ""); - if (url.scheme == "file" - && this._sources.has(fileUriAbsPath)) { - return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]; - } - - if ((!url.path || url.path == "/") - && this._sources.has("/" + relativeSource)) { - return this.sourcesContent[this._sources.indexOf("/" + relativeSource)]; - } - } - - // This function is used recursively from - // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we - // don't want to throw if we can't find the source - we just want to - // return null, so we provide a flag to exit gracefully. - if (nullOnMissing) { - return null; - } - - throw new Error('"' + relativeSource + '" is not in the SourceMap.'); - } - - /** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. The line number - * is 1-based. - * - column: The column number in the original source. The column - * number is 0-based. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. The - * line number is 1-based. - * - column: The column number in the generated source, or null. - * The column number is 0-based. - */ - generatedPositionFor(aArgs) { - let source = util.getArg(aArgs, "source"); - source = this._findSourceIndex(source); - if (source < 0) { - return { - line: null, - column: null, - lastColumn: null - }; - } - - const needle = { - source, - originalLine: util.getArg(aArgs, "line"), - originalColumn: util.getArg(aArgs, "column") - }; - - if (needle.originalLine < 1) { - throw new Error("Line numbers must be >= 1"); - } - - if (needle.originalColumn < 0) { - throw new Error("Column numbers must be >= 0"); - } - - let bias = util.getArg(aArgs, "bias", SourceMapConsumer.GREATEST_LOWER_BOUND); - if (bias == null) { - bias = SourceMapConsumer.GREATEST_LOWER_BOUND; - } - - let mapping; - this._wasm.withMappingCallback(m => mapping = m, () => { - this._wasm.exports.generated_location_for( - this._getMappingsPtr(), - needle.source, - needle.originalLine - 1, - needle.originalColumn, - bias - ); - }); - - if (mapping) { - if (mapping.source === needle.source) { - let lastColumn = mapping.lastGeneratedColumn; - if (this._computedColumnSpans && lastColumn === null) { - lastColumn = Infinity; - } - return { - line: util.getArg(mapping, "generatedLine", null), - column: util.getArg(mapping, "generatedColumn", null), - lastColumn, - }; - } - } - - return { - line: null, - column: null, - lastColumn: null - }; - } -} - -BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; -exports.BasicSourceMapConsumer = BasicSourceMapConsumer; - -/** - * An IndexedSourceMapConsumer instance represents a parsed source map which - * we can query for information. It differs from BasicSourceMapConsumer in - * that it takes "indexed" source maps (i.e. ones with a "sections" field) as - * input. - * - * The first parameter is a raw source map (either as a JSON string, or already - * parsed to an object). According to the spec for indexed source maps, they - * have the following attributes: - * - * - version: Which version of the source map spec this map is following. - * - file: Optional. The generated file this source map is associated with. - * - sections: A list of section definitions. - * - * Each value under the "sections" field has two fields: - * - offset: The offset into the original specified at which this section - * begins to apply, defined as an object with a "line" and "column" - * field. - * - map: A source map definition. This source map could also be indexed, - * but doesn't have to be. - * - * Instead of the "map" field, it's also possible to have a "url" field - * specifying a URL to retrieve a source map from, but that's currently - * unsupported. - * - * Here's an example source map, taken from the source map spec[0], but - * modified to omit a section which uses the "url" field. - * - * { - * version : 3, - * file: "app.js", - * sections: [{ - * offset: {line:100, column:10}, - * map: { - * version : 3, - * file: "section.js", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AAAA,E;;ABCDE;" - * } - * }], - * } - * - * The second parameter, if given, is a string whose value is the URL - * at which the source map was found. This URL is used to compute the - * sources array. - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt - */ -class IndexedSourceMapConsumer extends SourceMapConsumer { - constructor(aSourceMap, aSourceMapURL) { - return super(INTERNAL).then(that => { - let sourceMap = aSourceMap; - if (typeof aSourceMap === "string") { - sourceMap = util.parseSourceMapInput(aSourceMap); - } - - const version = util.getArg(sourceMap, "version"); - const sections = util.getArg(sourceMap, "sections"); - - if (version != that._version) { - throw new Error("Unsupported version: " + version); - } - - that._sources = new ArraySet(); - that._names = new ArraySet(); - that.__generatedMappings = null; - that.__originalMappings = null; - that.__generatedMappingsUnsorted = null; - that.__originalMappingsUnsorted = null; - - let lastOffset = { - line: -1, - column: 0 - }; - return Promise.all(sections.map(s => { - if (s.url) { - // The url field will require support for asynchronicity. - // See https://github.com/mozilla/source-map/issues/16 - throw new Error("Support for url field in sections not implemented."); - } - const offset = util.getArg(s, "offset"); - const offsetLine = util.getArg(offset, "line"); - const offsetColumn = util.getArg(offset, "column"); - - if (offsetLine < lastOffset.line || - (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { - throw new Error("Section offsets must be ordered and non-overlapping."); - } - lastOffset = offset; - - const cons = new SourceMapConsumer(util.getArg(s, "map"), aSourceMapURL); - return cons.then(consumer => { - return { - generatedOffset: { - // The offset fields are 0-based, but we use 1-based indices when - // encoding/decoding from VLQ. - generatedLine: offsetLine + 1, - generatedColumn: offsetColumn + 1 - }, - consumer - }; - }); - })).then(s => { - that._sections = s; - return that; - }); - }); - } - - // `__generatedMappings` and `__originalMappings` are arrays that hold the - // parsed mapping coordinates from the source map's "mappings" attribute. They - // are lazily instantiated, accessed via the `_generatedMappings` and - // `_originalMappings` getters respectively, and we only parse the mappings - // and create these arrays once queried for a source location. We jump through - // these hoops because there can be many thousands of mappings, and parsing - // them is expensive, so we only want to do it if we must. - // - // Each object in the arrays is of the form: - // - // { - // generatedLine: The line number in the generated code, - // generatedColumn: The column number in the generated code, - // source: The path to the original source file that generated this - // chunk of code, - // originalLine: The line number in the original source that - // corresponds to this chunk of generated code, - // originalColumn: The column number in the original source that - // corresponds to this chunk of generated code, - // name: The name of the original symbol which generated this chunk of - // code. - // } - // - // All properties except for `generatedLine` and `generatedColumn` can be - // `null`. - // - // `_generatedMappings` is ordered by the generated positions. - // - // `_originalMappings` is ordered by the original positions. - get _generatedMappings() { - if (!this.__generatedMappings) { - this._sortGeneratedMappings(); - } - - return this.__generatedMappings; - } - - get _originalMappings() { - if (!this.__originalMappings) { - this._sortOriginalMappings(); - } - - return this.__originalMappings; - } - - get _generatedMappingsUnsorted() { - if (!this.__generatedMappingsUnsorted) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__generatedMappingsUnsorted; - } - - get _originalMappingsUnsorted() { - if (!this.__originalMappingsUnsorted) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__originalMappingsUnsorted; - } - - _sortGeneratedMappings() { - const mappings = this._generatedMappingsUnsorted; - mappings.sort(util.compareByGeneratedPositionsDeflated); - this.__generatedMappings = mappings; - } - - _sortOriginalMappings() { - const mappings = this._originalMappingsUnsorted; - mappings.sort(util.compareByOriginalPositions); - this.__originalMappings = mappings; - } - - /** - * The list of original sources. - */ - get sources() { - const sources = []; - for (let i = 0; i < this._sections.length; i++) { - for (let j = 0; j < this._sections[i].consumer.sources.length; j++) { - sources.push(this._sections[i].consumer.sources[j]); - } - } - return sources; - } - - /** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. The line number - * is 1-based. - * - column: The column number in the generated source. The column - * number is 0-based. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. The - * line number is 1-based. - * - column: The column number in the original source, or null. The - * column number is 0-based. - * - name: The original identifier, or null. - */ - originalPositionFor(aArgs) { - const needle = { - generatedLine: util.getArg(aArgs, "line"), - generatedColumn: util.getArg(aArgs, "column") - }; - - // Find the section containing the generated position we're trying to map - // to an original position. - const sectionIndex = binarySearch.search(needle, this._sections, - function(aNeedle, section) { - const cmp = aNeedle.generatedLine - section.generatedOffset.generatedLine; - if (cmp) { - return cmp; - } - - return (aNeedle.generatedColumn - - section.generatedOffset.generatedColumn); - }); - const section = this._sections[sectionIndex]; - - if (!section) { - return { - source: null, - line: null, - column: null, - name: null - }; - } - - return section.consumer.originalPositionFor({ - line: needle.generatedLine - - (section.generatedOffset.generatedLine - 1), - column: needle.generatedColumn - - (section.generatedOffset.generatedLine === needle.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - bias: aArgs.bias - }); - } - - /** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ - hasContentsOfAllSources() { - return this._sections.every(function(s) { - return s.consumer.hasContentsOfAllSources(); - }); - } - - /** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ - sourceContentFor(aSource, nullOnMissing) { - for (let i = 0; i < this._sections.length; i++) { - const section = this._sections[i]; - - const content = section.consumer.sourceContentFor(aSource, true); - if (content) { - return content; - } - } - if (nullOnMissing) { - return null; - } - throw new Error('"' + aSource + '" is not in the SourceMap.'); - } - - /** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. The line number - * is 1-based. - * - column: The column number in the original source. The column - * number is 0-based. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. The - * line number is 1-based. - * - column: The column number in the generated source, or null. - * The column number is 0-based. - */ - generatedPositionFor(aArgs) { - for (let i = 0; i < this._sections.length; i++) { - const section = this._sections[i]; - - // Only consider this section if the requested source is in the list of - // sources of the consumer. - if (section.consumer._findSourceIndex(util.getArg(aArgs, "source")) === -1) { - continue; - } - const generatedPosition = section.consumer.generatedPositionFor(aArgs); - if (generatedPosition) { - const ret = { - line: generatedPosition.line + - (section.generatedOffset.generatedLine - 1), - column: generatedPosition.column + - (section.generatedOffset.generatedLine === generatedPosition.line - ? section.generatedOffset.generatedColumn - 1 - : 0) - }; - return ret; - } - } - - return { - line: null, - column: null - }; - } - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - _parseMappings(aStr, aSourceRoot) { - const generatedMappings = this.__generatedMappingsUnsorted = []; - const originalMappings = this.__originalMappingsUnsorted = []; - for (let i = 0; i < this._sections.length; i++) { - const section = this._sections[i]; - - const sectionMappings = []; - section.consumer.eachMapping(m => sectionMappings.push(m)); - - for (let j = 0; j < sectionMappings.length; j++) { - const mapping = sectionMappings[j]; - - // TODO: test if null is correct here. The original code used - // `source`, which would actually have gotten used as null because - // var's get hoisted. - // See: https://github.com/mozilla/source-map/issues/333 - let source = util.computeSourceURL(section.consumer.sourceRoot, null, this._sourceMapURL); - this._sources.add(source); - source = this._sources.indexOf(source); - - let name = null; - if (mapping.name) { - this._names.add(mapping.name); - name = this._names.indexOf(mapping.name); - } - - // The mappings coming from the consumer for the section have - // generated positions relative to the start of the section, so we - // need to offset them to be relative to the start of the concatenated - // generated file. - const adjustedMapping = { - source, - generatedLine: mapping.generatedLine + - (section.generatedOffset.generatedLine - 1), - generatedColumn: mapping.generatedColumn + - (section.generatedOffset.generatedLine === mapping.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name - }; - - generatedMappings.push(adjustedMapping); - if (typeof adjustedMapping.originalLine === "number") { - originalMappings.push(adjustedMapping); - } - } - } - } - - eachMapping(aCallback, aContext, aOrder) { - const context = aContext || null; - const order = aOrder || SourceMapConsumer.GENERATED_ORDER; - - let mappings; - switch (order) { - case SourceMapConsumer.GENERATED_ORDER: - mappings = this._generatedMappings; - break; - case SourceMapConsumer.ORIGINAL_ORDER: - mappings = this._originalMappings; - break; - default: - throw new Error("Unknown order of iteration."); - } - - const sourceRoot = this.sourceRoot; - mappings.map(function(mapping) { - let source = null; - if (mapping.source !== null) { - source = this._sources.at(mapping.source); - source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL); - } - return { - source, - generatedLine: mapping.generatedLine, - generatedColumn: mapping.generatedColumn, - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: mapping.name === null ? null : this._names.at(mapping.name) - }; - }, this).forEach(aCallback, context); - } - - /** - * Find the mapping that best matches the hypothetical "needle" mapping that - * we are searching for in the given "haystack" of mappings. - */ - _findMapping(aNeedle, aMappings, aLineName, - aColumnName, aComparator, aBias) { - // To return the position we are searching for, we must first find the - // mapping for the given position and then return the opposite position it - // points to. Because the mappings are sorted, we can use binary search to - // find the best mapping. - - if (aNeedle[aLineName] <= 0) { - throw new TypeError("Line must be greater than or equal to 1, got " - + aNeedle[aLineName]); - } - if (aNeedle[aColumnName] < 0) { - throw new TypeError("Column must be greater than or equal to 0, got " - + aNeedle[aColumnName]); - } - - return binarySearch.search(aNeedle, aMappings, aComparator, aBias); - } - - allGeneratedPositionsFor(aArgs) { - const line = util.getArg(aArgs, "line"); - - // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping - // returns the index of the closest mapping less than the needle. By - // setting needle.originalColumn to 0, we thus find the last mapping for - // the given line, provided such a mapping exists. - const needle = { - source: util.getArg(aArgs, "source"), - originalLine: line, - originalColumn: util.getArg(aArgs, "column", 0) - }; - - needle.source = this._findSourceIndex(needle.source); - if (needle.source < 0) { - return []; - } - - if (needle.originalLine < 1) { - throw new Error("Line numbers must be >= 1"); - } - - if (needle.originalColumn < 0) { - throw new Error("Column numbers must be >= 0"); - } - - const mappings = []; - - let index = this._findMapping(needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - binarySearch.LEAST_UPPER_BOUND); - if (index >= 0) { - let mapping = this._originalMappings[index]; - - if (aArgs.column === undefined) { - const originalLine = mapping.originalLine; - - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we found. Since - // mappings are sorted, this is guaranteed to find all mappings for - // the line we found. - while (mapping && mapping.originalLine === originalLine) { - let lastColumn = mapping.lastGeneratedColumn; - if (this._computedColumnSpans && lastColumn === null) { - lastColumn = Infinity; - } - mappings.push({ - line: util.getArg(mapping, "generatedLine", null), - column: util.getArg(mapping, "generatedColumn", null), - lastColumn, - }); - - mapping = this._originalMappings[++index]; - } - } else { - const originalColumn = mapping.originalColumn; - - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we were searching for. - // Since mappings are sorted, this is guaranteed to find all mappings for - // the line we are searching for. - while (mapping && - mapping.originalLine === line && - mapping.originalColumn == originalColumn) { - let lastColumn = mapping.lastGeneratedColumn; - if (this._computedColumnSpans && lastColumn === null) { - lastColumn = Infinity; - } - mappings.push({ - line: util.getArg(mapping, "generatedLine", null), - column: util.getArg(mapping, "generatedColumn", null), - lastColumn, - }); - - mapping = this._originalMappings[++index]; - } - } - } - - return mappings; - } - - destroy() { - for (let i = 0; i < this._sections.length; i++) { - this._sections[i].consumer.destroy(); - } - } -} -exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; - -/* - * Cheat to get around inter-twingled classes. `factory()` can be at the end - * where it has access to non-hoisted classes, but it gets hoisted itself. - */ -function _factory(aSourceMap, aSourceMapURL) { - let sourceMap = aSourceMap; - if (typeof aSourceMap === "string") { - sourceMap = util.parseSourceMapInput(aSourceMap); - } - - const consumer = sourceMap.sections != null - ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) - : new BasicSourceMapConsumer(sourceMap, aSourceMapURL); - return Promise.resolve(consumer); -} - -function _factoryBSM(aSourceMap, aSourceMapURL) { - return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL); -} diff --git a/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/source-map-generator.js b/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/source-map-generator.js deleted file mode 100644 index 1f073b08..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/source-map-generator.js +++ /dev/null @@ -1,413 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -const base64VLQ = require("./base64-vlq"); -const util = require("./util"); -const ArraySet = require("./array-set").ArraySet; -const MappingList = require("./mapping-list").MappingList; - -/** - * An instance of the SourceMapGenerator represents a source map which is - * being built incrementally. You may pass an object with the following - * properties: - * - * - file: The filename of the generated source. - * - sourceRoot: A root for all relative URLs in this source map. - */ -class SourceMapGenerator { - constructor(aArgs) { - if (!aArgs) { - aArgs = {}; - } - this._file = util.getArg(aArgs, "file", null); - this._sourceRoot = util.getArg(aArgs, "sourceRoot", null); - this._skipValidation = util.getArg(aArgs, "skipValidation", false); - this._sources = new ArraySet(); - this._names = new ArraySet(); - this._mappings = new MappingList(); - this._sourcesContents = null; - } - - /** - * Creates a new SourceMapGenerator based on a SourceMapConsumer - * - * @param aSourceMapConsumer The SourceMap. - */ - static fromSourceMap(aSourceMapConsumer) { - const sourceRoot = aSourceMapConsumer.sourceRoot; - const generator = new SourceMapGenerator({ - file: aSourceMapConsumer.file, - sourceRoot - }); - aSourceMapConsumer.eachMapping(function(mapping) { - const newMapping = { - generated: { - line: mapping.generatedLine, - column: mapping.generatedColumn - } - }; - - if (mapping.source != null) { - newMapping.source = mapping.source; - if (sourceRoot != null) { - newMapping.source = util.relative(sourceRoot, newMapping.source); - } - - newMapping.original = { - line: mapping.originalLine, - column: mapping.originalColumn - }; - - if (mapping.name != null) { - newMapping.name = mapping.name; - } - } - - generator.addMapping(newMapping); - }); - aSourceMapConsumer.sources.forEach(function(sourceFile) { - let sourceRelative = sourceFile; - if (sourceRoot !== null) { - sourceRelative = util.relative(sourceRoot, sourceFile); - } - - if (!generator._sources.has(sourceRelative)) { - generator._sources.add(sourceRelative); - } - - const content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - generator.setSourceContent(sourceFile, content); - } - }); - return generator; - } - - /** - * Add a single mapping from original source line and column to the generated - * source's line and column for this source map being created. The mapping - * object should have the following properties: - * - * - generated: An object with the generated line and column positions. - * - original: An object with the original line and column positions. - * - source: The original source file (relative to the sourceRoot). - * - name: An optional original token name for this mapping. - */ - addMapping(aArgs) { - const generated = util.getArg(aArgs, "generated"); - const original = util.getArg(aArgs, "original", null); - let source = util.getArg(aArgs, "source", null); - let name = util.getArg(aArgs, "name", null); - - if (!this._skipValidation) { - this._validateMapping(generated, original, source, name); - } - - if (source != null) { - source = String(source); - if (!this._sources.has(source)) { - this._sources.add(source); - } - } - - if (name != null) { - name = String(name); - if (!this._names.has(name)) { - this._names.add(name); - } - } - - this._mappings.add({ - generatedLine: generated.line, - generatedColumn: generated.column, - originalLine: original != null && original.line, - originalColumn: original != null && original.column, - source, - name - }); - } - - /** - * Set the source content for a source file. - */ - setSourceContent(aSourceFile, aSourceContent) { - let source = aSourceFile; - if (this._sourceRoot != null) { - source = util.relative(this._sourceRoot, source); - } - - if (aSourceContent != null) { - // Add the source content to the _sourcesContents map. - // Create a new _sourcesContents map if the property is null. - if (!this._sourcesContents) { - this._sourcesContents = Object.create(null); - } - this._sourcesContents[util.toSetString(source)] = aSourceContent; - } else if (this._sourcesContents) { - // Remove the source file from the _sourcesContents map. - // If the _sourcesContents map is empty, set the property to null. - delete this._sourcesContents[util.toSetString(source)]; - if (Object.keys(this._sourcesContents).length === 0) { - this._sourcesContents = null; - } - } - } - - /** - * Applies the mappings of a sub-source-map for a specific source file to the - * source map being generated. Each mapping to the supplied source file is - * rewritten using the supplied source map. Note: The resolution for the - * resulting mappings is the minimium of this map and the supplied map. - * - * @param aSourceMapConsumer The source map to be applied. - * @param aSourceFile Optional. The filename of the source file. - * If omitted, SourceMapConsumer's file property will be used. - * @param aSourceMapPath Optional. The dirname of the path to the source map - * to be applied. If relative, it is relative to the SourceMapConsumer. - * This parameter is needed when the two source maps aren't in the same - * directory, and the source map to be applied contains relative source - * paths. If so, those relative source paths need to be rewritten - * relative to the SourceMapGenerator. - */ - applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { - let sourceFile = aSourceFile; - // If aSourceFile is omitted, we will use the file property of the SourceMap - if (aSourceFile == null) { - if (aSourceMapConsumer.file == null) { - throw new Error( - "SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, " + - 'or the source map\'s "file" property. Both were omitted.' - ); - } - sourceFile = aSourceMapConsumer.file; - } - const sourceRoot = this._sourceRoot; - // Make "sourceFile" relative if an absolute Url is passed. - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - // Applying the SourceMap can add and remove items from the sources and - // the names array. - const newSources = this._mappings.toArray().length > 0 - ? new ArraySet() - : this._sources; - const newNames = new ArraySet(); - - // Find mappings for the "sourceFile" - this._mappings.unsortedForEach(function(mapping) { - if (mapping.source === sourceFile && mapping.originalLine != null) { - // Check if it can be mapped by the source map, then update the mapping. - const original = aSourceMapConsumer.originalPositionFor({ - line: mapping.originalLine, - column: mapping.originalColumn - }); - if (original.source != null) { - // Copy mapping - mapping.source = original.source; - if (aSourceMapPath != null) { - mapping.source = util.join(aSourceMapPath, mapping.source); - } - if (sourceRoot != null) { - mapping.source = util.relative(sourceRoot, mapping.source); - } - mapping.originalLine = original.line; - mapping.originalColumn = original.column; - if (original.name != null) { - mapping.name = original.name; - } - } - } - - const source = mapping.source; - if (source != null && !newSources.has(source)) { - newSources.add(source); - } - - const name = mapping.name; - if (name != null && !newNames.has(name)) { - newNames.add(name); - } - - }, this); - this._sources = newSources; - this._names = newNames; - - // Copy sourcesContents of applied map. - aSourceMapConsumer.sources.forEach(function(srcFile) { - const content = aSourceMapConsumer.sourceContentFor(srcFile); - if (content != null) { - if (aSourceMapPath != null) { - srcFile = util.join(aSourceMapPath, srcFile); - } - if (sourceRoot != null) { - srcFile = util.relative(sourceRoot, srcFile); - } - this.setSourceContent(srcFile, content); - } - }, this); - } - - /** - * A mapping can have one of the three levels of data: - * - * 1. Just the generated position. - * 2. The Generated position, original position, and original source. - * 3. Generated and original position, original source, as well as a name - * token. - * - * To maintain consistency, we validate that any new mapping being added falls - * in to one of these categories. - */ - _validateMapping(aGenerated, aOriginal, aSource, aName) { - // When aOriginal is truthy but has empty values for .line and .column, - // it is most likely a programmer error. In this case we throw a very - // specific error message to try to guide them the right way. - // For example: https://github.com/Polymer/polymer-bundler/pull/519 - if (aOriginal && typeof aOriginal.line !== "number" && typeof aOriginal.column !== "number") { - throw new Error( - "original.line and original.column are not numbers -- you probably meant to omit " + - "the original mapping entirely and only map the generated position. If so, pass " + - "null for the original mapping instead of an object with empty or null values." - ); - } - - if (aGenerated && "line" in aGenerated && "column" in aGenerated - && aGenerated.line > 0 && aGenerated.column >= 0 - && !aOriginal && !aSource && !aName) { - // Case 1. - - } else if (aGenerated && "line" in aGenerated && "column" in aGenerated - && aOriginal && "line" in aOriginal && "column" in aOriginal - && aGenerated.line > 0 && aGenerated.column >= 0 - && aOriginal.line > 0 && aOriginal.column >= 0 - && aSource) { - // Cases 2 and 3. - - } else { - throw new Error("Invalid mapping: " + JSON.stringify({ - generated: aGenerated, - source: aSource, - original: aOriginal, - name: aName - })); - } - } - - /** - * Serialize the accumulated mappings in to the stream of base 64 VLQs - * specified by the source map format. - */ - _serializeMappings() { - let previousGeneratedColumn = 0; - let previousGeneratedLine = 1; - let previousOriginalColumn = 0; - let previousOriginalLine = 0; - let previousName = 0; - let previousSource = 0; - let result = ""; - let next; - let mapping; - let nameIdx; - let sourceIdx; - - const mappings = this._mappings.toArray(); - for (let i = 0, len = mappings.length; i < len; i++) { - mapping = mappings[i]; - next = ""; - - if (mapping.generatedLine !== previousGeneratedLine) { - previousGeneratedColumn = 0; - while (mapping.generatedLine !== previousGeneratedLine) { - next += ";"; - previousGeneratedLine++; - } - } else if (i > 0) { - if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { - continue; - } - next += ","; - } - - next += base64VLQ.encode(mapping.generatedColumn - - previousGeneratedColumn); - previousGeneratedColumn = mapping.generatedColumn; - - if (mapping.source != null) { - sourceIdx = this._sources.indexOf(mapping.source); - next += base64VLQ.encode(sourceIdx - previousSource); - previousSource = sourceIdx; - - // lines are stored 0-based in SourceMap spec version 3 - next += base64VLQ.encode(mapping.originalLine - 1 - - previousOriginalLine); - previousOriginalLine = mapping.originalLine - 1; - - next += base64VLQ.encode(mapping.originalColumn - - previousOriginalColumn); - previousOriginalColumn = mapping.originalColumn; - - if (mapping.name != null) { - nameIdx = this._names.indexOf(mapping.name); - next += base64VLQ.encode(nameIdx - previousName); - previousName = nameIdx; - } - } - - result += next; - } - - return result; - } - - _generateSourcesContent(aSources, aSourceRoot) { - return aSources.map(function(source) { - if (!this._sourcesContents) { - return null; - } - if (aSourceRoot != null) { - source = util.relative(aSourceRoot, source); - } - const key = util.toSetString(source); - return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) - ? this._sourcesContents[key] - : null; - }, this); - } - - /** - * Externalize the source map. - */ - toJSON() { - const map = { - version: this._version, - sources: this._sources.toArray(), - names: this._names.toArray(), - mappings: this._serializeMappings() - }; - if (this._file != null) { - map.file = this._file; - } - if (this._sourceRoot != null) { - map.sourceRoot = this._sourceRoot; - } - if (this._sourcesContents) { - map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); - } - - return map; - } - - /** - * Render the source map being generated to a string. - */ - toString() { - return JSON.stringify(this.toJSON()); - } -} - -SourceMapGenerator.prototype._version = 3; -exports.SourceMapGenerator = SourceMapGenerator; diff --git a/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/source-node.js b/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/source-node.js deleted file mode 100644 index 45d4dfd8..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/source-node.js +++ /dev/null @@ -1,404 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -const SourceMapGenerator = require("./source-map-generator").SourceMapGenerator; -const util = require("./util"); - -// Matches a Windows-style `\r\n` newline or a `\n` newline used by all other -// operating systems these days (capturing the result). -const REGEX_NEWLINE = /(\r?\n)/; - -// Newline character code for charCodeAt() comparisons -const NEWLINE_CODE = 10; - -// Private symbol for identifying `SourceNode`s when multiple versions of -// the source-map library are loaded. This MUST NOT CHANGE across -// versions! -const isSourceNode = "$$$isSourceNode$$$"; - -/** - * SourceNodes provide a way to abstract over interpolating/concatenating - * snippets of generated JavaScript source code while maintaining the line and - * column information associated with the original source code. - * - * @param aLine The original line number. - * @param aColumn The original column number. - * @param aSource The original source's filename. - * @param aChunks Optional. An array of strings which are snippets of - * generated JS, or other SourceNodes. - * @param aName The original identifier. - */ -class SourceNode { - constructor(aLine, aColumn, aSource, aChunks, aName) { - this.children = []; - this.sourceContents = {}; - this.line = aLine == null ? null : aLine; - this.column = aColumn == null ? null : aColumn; - this.source = aSource == null ? null : aSource; - this.name = aName == null ? null : aName; - this[isSourceNode] = true; - if (aChunks != null) this.add(aChunks); - } - - /** - * Creates a SourceNode from generated code and a SourceMapConsumer. - * - * @param aGeneratedCode The generated code - * @param aSourceMapConsumer The SourceMap for the generated code - * @param aRelativePath Optional. The path that relative sources in the - * SourceMapConsumer should be relative to. - */ - static fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { - // The SourceNode we want to fill with the generated code - // and the SourceMap - const node = new SourceNode(); - - // All even indices of this array are one line of the generated code, - // while all odd indices are the newlines between two adjacent lines - // (since `REGEX_NEWLINE` captures its match). - // Processed fragments are accessed by calling `shiftNextLine`. - const remainingLines = aGeneratedCode.split(REGEX_NEWLINE); - let remainingLinesIndex = 0; - const shiftNextLine = function() { - const lineContents = getNextLine(); - // The last line of a file might not have a newline. - const newLine = getNextLine() || ""; - return lineContents + newLine; - - function getNextLine() { - return remainingLinesIndex < remainingLines.length ? - remainingLines[remainingLinesIndex++] : undefined; - } - }; - - // We need to remember the position of "remainingLines" - let lastGeneratedLine = 1, lastGeneratedColumn = 0; - - // The generate SourceNodes we need a code range. - // To extract it current and last mapping is used. - // Here we store the last mapping. - let lastMapping = null; - let nextLine; - - aSourceMapConsumer.eachMapping(function(mapping) { - if (lastMapping !== null) { - // We add the code from "lastMapping" to "mapping": - // First check if there is a new line in between. - if (lastGeneratedLine < mapping.generatedLine) { - // Associate first line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - lastGeneratedLine++; - lastGeneratedColumn = 0; - // The remaining code is added without mapping - } else { - // There is no new line in between. - // Associate the code between "lastGeneratedColumn" and - // "mapping.generatedColumn" with "lastMapping" - nextLine = remainingLines[remainingLinesIndex] || ""; - const code = nextLine.substr(0, mapping.generatedColumn - - lastGeneratedColumn); - remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - - lastGeneratedColumn); - lastGeneratedColumn = mapping.generatedColumn; - addMappingWithCode(lastMapping, code); - // No more remaining code, continue - lastMapping = mapping; - return; - } - } - // We add the generated code until the first mapping - // to the SourceNode without any mapping. - // Each line is added as separate string. - while (lastGeneratedLine < mapping.generatedLine) { - node.add(shiftNextLine()); - lastGeneratedLine++; - } - if (lastGeneratedColumn < mapping.generatedColumn) { - nextLine = remainingLines[remainingLinesIndex] || ""; - node.add(nextLine.substr(0, mapping.generatedColumn)); - remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); - lastGeneratedColumn = mapping.generatedColumn; - } - lastMapping = mapping; - }, this); - // We have processed all mappings. - if (remainingLinesIndex < remainingLines.length) { - if (lastMapping) { - // Associate the remaining code in the current line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - } - // and add the remaining lines without any mapping - node.add(remainingLines.splice(remainingLinesIndex).join("")); - } - - // Copy sourcesContent into SourceNode - aSourceMapConsumer.sources.forEach(function(sourceFile) { - const content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aRelativePath != null) { - sourceFile = util.join(aRelativePath, sourceFile); - } - node.setSourceContent(sourceFile, content); - } - }); - - return node; - - function addMappingWithCode(mapping, code) { - if (mapping === null || mapping.source === undefined) { - node.add(code); - } else { - const source = aRelativePath - ? util.join(aRelativePath, mapping.source) - : mapping.source; - node.add(new SourceNode(mapping.originalLine, - mapping.originalColumn, - source, - code, - mapping.name)); - } - } - } - - /** - * Add a chunk of generated JS to this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ - add(aChunk) { - if (Array.isArray(aChunk)) { - aChunk.forEach(function(chunk) { - this.add(chunk); - }, this); - } else if (aChunk[isSourceNode] || typeof aChunk === "string") { - if (aChunk) { - this.children.push(aChunk); - } - } else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; - } - - /** - * Add a chunk of generated JS to the beginning of this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ - prepend(aChunk) { - if (Array.isArray(aChunk)) { - for (let i = aChunk.length - 1; i >= 0; i--) { - this.prepend(aChunk[i]); - } - } else if (aChunk[isSourceNode] || typeof aChunk === "string") { - this.children.unshift(aChunk); - } else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; - } - - /** - * Walk over the tree of JS snippets in this node and its children. The - * walking function is called once for each snippet of JS and is passed that - * snippet and the its original associated source's line/column location. - * - * @param aFn The traversal function. - */ - walk(aFn) { - let chunk; - for (let i = 0, len = this.children.length; i < len; i++) { - chunk = this.children[i]; - if (chunk[isSourceNode]) { - chunk.walk(aFn); - } else if (chunk !== "") { - aFn(chunk, { source: this.source, - line: this.line, - column: this.column, - name: this.name }); - } - } - } - - /** - * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between - * each of `this.children`. - * - * @param aSep The separator. - */ - join(aSep) { - let newChildren; - let i; - const len = this.children.length; - if (len > 0) { - newChildren = []; - for (i = 0; i < len - 1; i++) { - newChildren.push(this.children[i]); - newChildren.push(aSep); - } - newChildren.push(this.children[i]); - this.children = newChildren; - } - return this; - } - - /** - * Call String.prototype.replace on the very right-most source snippet. Useful - * for trimming whitespace from the end of a source node, etc. - * - * @param aPattern The pattern to replace. - * @param aReplacement The thing to replace the pattern with. - */ - replaceRight(aPattern, aReplacement) { - const lastChild = this.children[this.children.length - 1]; - if (lastChild[isSourceNode]) { - lastChild.replaceRight(aPattern, aReplacement); - } else if (typeof lastChild === "string") { - this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); - } else { - this.children.push("".replace(aPattern, aReplacement)); - } - return this; - } - - /** - * Set the source content for a source file. This will be added to the SourceMapGenerator - * in the sourcesContent field. - * - * @param aSourceFile The filename of the source file - * @param aSourceContent The content of the source file - */ - setSourceContent(aSourceFile, aSourceContent) { - this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; - } - - /** - * Walk over the tree of SourceNodes. The walking function is called for each - * source file content and is passed the filename and source content. - * - * @param aFn The traversal function. - */ - walkSourceContents(aFn) { - for (let i = 0, len = this.children.length; i < len; i++) { - if (this.children[i][isSourceNode]) { - this.children[i].walkSourceContents(aFn); - } - } - - const sources = Object.keys(this.sourceContents); - for (let i = 0, len = sources.length; i < len; i++) { - aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); - } - } - - /** - * Return the string representation of this source node. Walks over the tree - * and concatenates all the various snippets together to one string. - */ - toString() { - let str = ""; - this.walk(function(chunk) { - str += chunk; - }); - return str; - } - - /** - * Returns the string representation of this source node along with a source - * map. - */ - toStringWithSourceMap(aArgs) { - const generated = { - code: "", - line: 1, - column: 0 - }; - const map = new SourceMapGenerator(aArgs); - let sourceMappingActive = false; - let lastOriginalSource = null; - let lastOriginalLine = null; - let lastOriginalColumn = null; - let lastOriginalName = null; - this.walk(function(chunk, original) { - generated.code += chunk; - if (original.source !== null - && original.line !== null - && original.column !== null) { - if (lastOriginalSource !== original.source - || lastOriginalLine !== original.line - || lastOriginalColumn !== original.column - || lastOriginalName !== original.name) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - lastOriginalSource = original.source; - lastOriginalLine = original.line; - lastOriginalColumn = original.column; - lastOriginalName = original.name; - sourceMappingActive = true; - } else if (sourceMappingActive) { - map.addMapping({ - generated: { - line: generated.line, - column: generated.column - } - }); - lastOriginalSource = null; - sourceMappingActive = false; - } - for (let idx = 0, length = chunk.length; idx < length; idx++) { - if (chunk.charCodeAt(idx) === NEWLINE_CODE) { - generated.line++; - generated.column = 0; - // Mappings end at eol - if (idx + 1 === length) { - lastOriginalSource = null; - sourceMappingActive = false; - } else if (sourceMappingActive) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - } else { - generated.column++; - } - } - }); - this.walkSourceContents(function(sourceFile, sourceContent) { - map.setSourceContent(sourceFile, sourceContent); - }); - - return { code: generated.code, map }; - } -} - -exports.SourceNode = SourceNode; diff --git a/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/util.js b/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/util.js deleted file mode 100644 index bf32115a..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/util.js +++ /dev/null @@ -1,546 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -/** - * This is a helper function for getting values from parameter/options - * objects. - * - * @param args The object we are extracting values from - * @param name The name of the property we are getting. - * @param defaultValue An optional value to return if the property is missing - * from the object. If this is not specified and the property is missing, an - * error will be thrown. - */ -function getArg(aArgs, aName, aDefaultValue) { - if (aName in aArgs) { - return aArgs[aName]; - } else if (arguments.length === 3) { - return aDefaultValue; - } - throw new Error('"' + aName + '" is a required argument.'); - -} -exports.getArg = getArg; - -const urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/; -const dataUrlRegexp = /^data:.+\,.+$/; - -function urlParse(aUrl) { - const match = aUrl.match(urlRegexp); - if (!match) { - return null; - } - return { - scheme: match[1], - auth: match[2], - host: match[3], - port: match[4], - path: match[5] - }; -} -exports.urlParse = urlParse; - -function urlGenerate(aParsedUrl) { - let url = ""; - if (aParsedUrl.scheme) { - url += aParsedUrl.scheme + ":"; - } - url += "//"; - if (aParsedUrl.auth) { - url += aParsedUrl.auth + "@"; - } - if (aParsedUrl.host) { - url += aParsedUrl.host; - } - if (aParsedUrl.port) { - url += ":" + aParsedUrl.port; - } - if (aParsedUrl.path) { - url += aParsedUrl.path; - } - return url; -} -exports.urlGenerate = urlGenerate; - -const MAX_CACHED_INPUTS = 32; - -/** - * Takes some function `f(input) -> result` and returns a memoized version of - * `f`. - * - * We keep at most `MAX_CACHED_INPUTS` memoized results of `f` alive. The - * memoization is a dumb-simple, linear least-recently-used cache. - */ -function lruMemoize(f) { - const cache = []; - - return function(input) { - for (let i = 0; i < cache.length; i++) { - if (cache[i].input === input) { - const temp = cache[0]; - cache[0] = cache[i]; - cache[i] = temp; - return cache[0].result; - } - } - - const result = f(input); - - cache.unshift({ - input, - result, - }); - - if (cache.length > MAX_CACHED_INPUTS) { - cache.pop(); - } - - return result; - }; -} - -/** - * Normalizes a path, or the path portion of a URL: - * - * - Replaces consecutive slashes with one slash. - * - Removes unnecessary '.' parts. - * - Removes unnecessary '/..' parts. - * - * Based on code in the Node.js 'path' core module. - * - * @param aPath The path or url to normalize. - */ -const normalize = lruMemoize(function normalize(aPath) { - let path = aPath; - const url = urlParse(aPath); - if (url) { - if (!url.path) { - return aPath; - } - path = url.path; - } - const isAbsolute = exports.isAbsolute(path); - - // Split the path into parts between `/` characters. This is much faster than - // using `.split(/\/+/g)`. - const parts = []; - let start = 0; - let i = 0; - while (true) { - start = i; - i = path.indexOf("/", start); - if (i === -1) { - parts.push(path.slice(start)); - break; - } else { - parts.push(path.slice(start, i)); - while (i < path.length && path[i] === "/") { - i++; - } - } - } - - let up = 0; - for (i = parts.length - 1; i >= 0; i--) { - const part = parts[i]; - if (part === ".") { - parts.splice(i, 1); - } else if (part === "..") { - up++; - } else if (up > 0) { - if (part === "") { - // The first part is blank if the path is absolute. Trying to go - // above the root is a no-op. Therefore we can remove all '..' parts - // directly after the root. - parts.splice(i + 1, up); - up = 0; - } else { - parts.splice(i, 2); - up--; - } - } - } - path = parts.join("/"); - - if (path === "") { - path = isAbsolute ? "/" : "."; - } - - if (url) { - url.path = path; - return urlGenerate(url); - } - return path; -}); -exports.normalize = normalize; - -/** - * Joins two paths/URLs. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be joined with the root. - * - * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a - * scheme-relative URL: Then the scheme of aRoot, if any, is prepended - * first. - * - Otherwise aPath is a path. If aRoot is a URL, then its path portion - * is updated with the result and aRoot is returned. Otherwise the result - * is returned. - * - If aPath is absolute, the result is aPath. - * - Otherwise the two paths are joined with a slash. - * - Joining for example 'http://' and 'www.example.com' is also supported. - */ -function join(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - if (aPath === "") { - aPath = "."; - } - const aPathUrl = urlParse(aPath); - const aRootUrl = urlParse(aRoot); - if (aRootUrl) { - aRoot = aRootUrl.path || "/"; - } - - // `join(foo, '//www.example.org')` - if (aPathUrl && !aPathUrl.scheme) { - if (aRootUrl) { - aPathUrl.scheme = aRootUrl.scheme; - } - return urlGenerate(aPathUrl); - } - - if (aPathUrl || aPath.match(dataUrlRegexp)) { - return aPath; - } - - // `join('http://', 'www.example.com')` - if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { - aRootUrl.host = aPath; - return urlGenerate(aRootUrl); - } - - const joined = aPath.charAt(0) === "/" - ? aPath - : normalize(aRoot.replace(/\/+$/, "") + "/" + aPath); - - if (aRootUrl) { - aRootUrl.path = joined; - return urlGenerate(aRootUrl); - } - return joined; -} -exports.join = join; - -exports.isAbsolute = function(aPath) { - return aPath.charAt(0) === "/" || urlRegexp.test(aPath); -}; - -/** - * Make a path relative to a URL or another path. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be made relative to aRoot. - */ -function relative(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - - aRoot = aRoot.replace(/\/$/, ""); - - // It is possible for the path to be above the root. In this case, simply - // checking whether the root is a prefix of the path won't work. Instead, we - // need to remove components from the root one by one, until either we find - // a prefix that fits, or we run out of components to remove. - let level = 0; - while (aPath.indexOf(aRoot + "/") !== 0) { - const index = aRoot.lastIndexOf("/"); - if (index < 0) { - return aPath; - } - - // If the only part of the root that is left is the scheme (i.e. http://, - // file:///, etc.), one or more slashes (/), or simply nothing at all, we - // have exhausted all components, so the path is not relative to the root. - aRoot = aRoot.slice(0, index); - if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { - return aPath; - } - - ++level; - } - - // Make sure we add a "../" for each component we removed from the root. - return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); -} -exports.relative = relative; - -const supportsNullProto = (function() { - const obj = Object.create(null); - return !("__proto__" in obj); -}()); - -function identity(s) { - return s; -} - -/** - * Because behavior goes wacky when you set `__proto__` on objects, we - * have to prefix all the strings in our set with an arbitrary character. - * - * See https://github.com/mozilla/source-map/pull/31 and - * https://github.com/mozilla/source-map/issues/30 - * - * @param String aStr - */ -function toSetString(aStr) { - if (isProtoString(aStr)) { - return "$" + aStr; - } - - return aStr; -} -exports.toSetString = supportsNullProto ? identity : toSetString; - -function fromSetString(aStr) { - if (isProtoString(aStr)) { - return aStr.slice(1); - } - - return aStr; -} -exports.fromSetString = supportsNullProto ? identity : fromSetString; - -function isProtoString(s) { - if (!s) { - return false; - } - - const length = s.length; - - if (length < 9 /* "__proto__".length */) { - return false; - } - - /* eslint-disable no-multi-spaces */ - if (s.charCodeAt(length - 1) !== 95 /* '_' */ || - s.charCodeAt(length - 2) !== 95 /* '_' */ || - s.charCodeAt(length - 3) !== 111 /* 'o' */ || - s.charCodeAt(length - 4) !== 116 /* 't' */ || - s.charCodeAt(length - 5) !== 111 /* 'o' */ || - s.charCodeAt(length - 6) !== 114 /* 'r' */ || - s.charCodeAt(length - 7) !== 112 /* 'p' */ || - s.charCodeAt(length - 8) !== 95 /* '_' */ || - s.charCodeAt(length - 9) !== 95 /* '_' */) { - return false; - } - /* eslint-enable no-multi-spaces */ - - for (let i = length - 10; i >= 0; i--) { - if (s.charCodeAt(i) !== 36 /* '$' */) { - return false; - } - } - - return true; -} - -/** - * Comparator between two mappings where the original positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same original source/line/column, but different generated - * line and column the same. Useful when searching for a mapping with a - * stubbed out mapping. - */ -function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { - let cmp = strcmp(mappingA.source, mappingB.source); - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0 || onlyCompareOriginal) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - return strcmp(mappingA.name, mappingB.name); -} -exports.compareByOriginalPositions = compareByOriginalPositions; - -/** - * Comparator between two mappings with deflated source and name indices where - * the generated positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same generated line and column, but different - * source/name/original line and column the same. Useful when searching for a - * mapping with a stubbed out mapping. - */ -function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { - let cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0 || onlyCompareGenerated) { - return cmp; - } - - cmp = strcmp(mappingA.source, mappingB.source); - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } - - return strcmp(mappingA.name, mappingB.name); -} -exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; - -function strcmp(aStr1, aStr2) { - if (aStr1 === aStr2) { - return 0; - } - - if (aStr1 === null) { - return 1; // aStr2 !== null - } - - if (aStr2 === null) { - return -1; // aStr1 !== null - } - - if (aStr1 > aStr2) { - return 1; - } - - return -1; -} - -/** - * Comparator between two mappings with inflated source and name strings where - * the generated positions are compared. - */ -function compareByGeneratedPositionsInflated(mappingA, mappingB) { - let cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } - - cmp = strcmp(mappingA.source, mappingB.source); - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } - - return strcmp(mappingA.name, mappingB.name); -} -exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; - -/** - * Strip any JSON XSSI avoidance prefix from the string (as documented - * in the source maps specification), and then parse the string as - * JSON. - */ -function parseSourceMapInput(str) { - return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, "")); -} -exports.parseSourceMapInput = parseSourceMapInput; - -/** - * Compute the URL of a source given the the source root, the source's - * URL, and the source map's URL. - */ -function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) { - sourceURL = sourceURL || ""; - - if (sourceRoot) { - // This follows what Chrome does. - if (sourceRoot[sourceRoot.length - 1] !== "/" && sourceURL[0] !== "/") { - sourceRoot += "/"; - } - // The spec says: - // Line 4: An optional source root, useful for relocating source - // files on a server or removing repeated values in the - // “sources” entry. This value is prepended to the individual - // entries in the “source” field. - sourceURL = sourceRoot + sourceURL; - } - - // Historically, SourceMapConsumer did not take the sourceMapURL as - // a parameter. This mode is still somewhat supported, which is why - // this code block is conditional. However, it's preferable to pass - // the source map URL to SourceMapConsumer, so that this function - // can implement the source URL resolution algorithm as outlined in - // the spec. This block is basically the equivalent of: - // new URL(sourceURL, sourceMapURL).toString() - // ... except it avoids using URL, which wasn't available in the - // older releases of node still supported by this library. - // - // The spec says: - // If the sources are not absolute URLs after prepending of the - // “sourceRoot”, the sources are resolved relative to the - // SourceMap (like resolving script src in a html document). - if (sourceMapURL) { - const parsed = urlParse(sourceMapURL); - if (!parsed) { - throw new Error("sourceMapURL could not be parsed"); - } - if (parsed.path) { - // Strip the last path component, but keep the "/". - const index = parsed.path.lastIndexOf("/"); - if (index >= 0) { - parsed.path = parsed.path.substring(0, index + 1); - } - } - sourceURL = join(urlGenerate(parsed), sourceURL); - } - - return normalize(sourceURL); -} -exports.computeSourceURL = computeSourceURL; diff --git a/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/wasm.js b/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/wasm.js deleted file mode 100644 index d9363a90..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/source-map/lib/wasm.js +++ /dev/null @@ -1,107 +0,0 @@ -const readWasm = require("../lib/read-wasm"); - -/** - * Provide the JIT with a nice shape / hidden class. - */ -function Mapping() { - this.generatedLine = 0; - this.generatedColumn = 0; - this.lastGeneratedColumn = null; - this.source = null; - this.originalLine = null; - this.originalColumn = null; - this.name = null; -} - -let cachedWasm = null; - -module.exports = function wasm() { - if (cachedWasm) { - return cachedWasm; - } - - const callbackStack = []; - - cachedWasm = readWasm().then(buffer => { - return WebAssembly.instantiate(buffer, { - env: { - mapping_callback( - generatedLine, - generatedColumn, - - hasLastGeneratedColumn, - lastGeneratedColumn, - - hasOriginal, - source, - originalLine, - originalColumn, - - hasName, - name - ) { - const mapping = new Mapping(); - // JS uses 1-based line numbers, wasm uses 0-based. - mapping.generatedLine = generatedLine + 1; - mapping.generatedColumn = generatedColumn; - - if (hasLastGeneratedColumn) { - // JS uses inclusive last generated column, wasm uses exclusive. - mapping.lastGeneratedColumn = lastGeneratedColumn - 1; - } - - if (hasOriginal) { - mapping.source = source; - // JS uses 1-based line numbers, wasm uses 0-based. - mapping.originalLine = originalLine + 1; - mapping.originalColumn = originalColumn; - - if (hasName) { - mapping.name = name; - } - } - - callbackStack[callbackStack.length - 1](mapping); - }, - - start_all_generated_locations_for() { console.time("all_generated_locations_for"); }, - end_all_generated_locations_for() { console.timeEnd("all_generated_locations_for"); }, - - start_compute_column_spans() { console.time("compute_column_spans"); }, - end_compute_column_spans() { console.timeEnd("compute_column_spans"); }, - - start_generated_location_for() { console.time("generated_location_for"); }, - end_generated_location_for() { console.timeEnd("generated_location_for"); }, - - start_original_location_for() { console.time("original_location_for"); }, - end_original_location_for() { console.timeEnd("original_location_for"); }, - - start_parse_mappings() { console.time("parse_mappings"); }, - end_parse_mappings() { console.timeEnd("parse_mappings"); }, - - start_sort_by_generated_location() { console.time("sort_by_generated_location"); }, - end_sort_by_generated_location() { console.timeEnd("sort_by_generated_location"); }, - - start_sort_by_original_location() { console.time("sort_by_original_location"); }, - end_sort_by_original_location() { console.timeEnd("sort_by_original_location"); }, - } - }); - }).then(Wasm => { - return { - exports: Wasm.instance.exports, - withMappingCallback: (mappingCallback, f) => { - callbackStack.push(mappingCallback); - try { - f(); - } finally { - callbackStack.pop(); - } - } - }; - }).then(null, e => { - cachedWasm = null; - throw e; - }); - - return cachedWasm; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/source-map/package.json b/node_modules/hexo-theme-butterfly/node_modules/source-map/package.json deleted file mode 100644 index 1ed45b98..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/source-map/package.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "name": "source-map", - "description": "Generates and consumes source maps", - "version": "0.7.4", - "homepage": "https://github.com/mozilla/source-map", - "author": "Nick Fitzgerald ", - "contributors": [ - "Tobias Koppers ", - "Duncan Beevers ", - "Stephen Crane ", - "Ryan Seddon ", - "Miles Elam ", - "Mihai Bazon ", - "Michael Ficarra ", - "Todd Wolfson ", - "Alexander Solovyov ", - "Felix Gnass ", - "Conrad Irwin ", - "usrbincc ", - "David Glasser ", - "Chase Douglas ", - "Evan Wallace ", - "Heather Arthur ", - "Hugh Kennedy ", - "David Glasser ", - "Simon Lydell ", - "Jmeas Smith ", - "Michael Z Goddard ", - "azu ", - "John Gozde ", - "Adam Kirkton ", - "Chris Montgomery ", - "J. Ryan Stinnett ", - "Jack Herrington ", - "Chris Truter ", - "Daniel Espeset ", - "Jamie Wong ", - "Eddy Bruël ", - "Hawken Rives ", - "Gilad Peleg ", - "djchie ", - "Gary Ye ", - "Nicolas Lalevée " - ], - "repository": { - "type": "git", - "url": "http://github.com/mozilla/source-map.git" - }, - "main": "./source-map.js", - "types": "./source-map.d.ts", - "files": [ - "source-map.js", - "source-map.d.ts", - "lib/", - "dist/source-map.js" - ], - "engines": { - "node": ">= 8" - }, - "license": "BSD-3-Clause", - "scripts": { - "lint": "eslint *.js lib/ test/", - "prebuild": "npm run lint", - "build": "webpack --color", - "pretest": "npm run build", - "test": "node test/run-tests.js", - "precoverage": "npm run build", - "coverage": "nyc node test/run-tests.js", - "setup": "mkdir -p coverage && cp -n .waiting.html coverage/index.html || true", - "dev:live": "live-server --port=4103 --ignorePattern='(js|css|png)$' coverage", - "dev:watch": "watch 'npm run coverage' lib/ test/", - "predev": "npm run setup", - "dev": "npm-run-all -p --silent dev:*", - "clean": "rm -rf coverage .nyc_output", - "toc": "doctoc --title '## Table of Contents' README.md && doctoc --title '## Table of Contents' CONTRIBUTING.md" - }, - "devDependencies": { - "doctoc": "^1.3.1", - "eslint": "^4.19.1", - "live-server": "^1.2.0", - "npm-run-all": "^4.1.2", - "nyc": "^11.7.1", - "watch": "^1.0.2", - "webpack": "^4.9.1", - "webpack-cli": "^3.1" - }, - "nyc": { - "reporter": "html" - }, - "typings": "source-map" -} diff --git a/node_modules/hexo-theme-butterfly/node_modules/source-map/source-map.d.ts b/node_modules/hexo-theme-butterfly/node_modules/source-map/source-map.d.ts deleted file mode 100644 index d57e56ba..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/source-map/source-map.d.ts +++ /dev/null @@ -1,369 +0,0 @@ -// Type definitions for source-map 0.7 -// Project: https://github.com/mozilla/source-map -// Definitions by: Morten Houston Ludvigsen , -// Ron Buckton , -// John Vilk -// Definitions: https://github.com/mozilla/source-map -export type SourceMapUrl = string; - -export interface StartOfSourceMap { - file?: string; - sourceRoot?: string; - skipValidation?: boolean; -} - -export interface RawSourceMap { - version: number; - sources: string[]; - names: string[]; - sourceRoot?: string; - sourcesContent?: string[]; - mappings: string; - file: string; -} - -export interface RawIndexMap extends StartOfSourceMap { - version: number; - sections: RawSection[]; -} - -export interface RawSection { - offset: Position; - map: RawSourceMap; -} - -export interface Position { - line: number; - column: number; -} - -export interface NullablePosition { - line: number | null; - column: number | null; - lastColumn: number | null; -} - -export interface MappedPosition { - source: string; - line: number; - column: number; - name?: string; -} - -export interface NullableMappedPosition { - source: string | null; - line: number | null; - column: number | null; - name: string | null; -} - -export interface MappingItem { - source: string; - generatedLine: number; - generatedColumn: number; - originalLine: number; - originalColumn: number; - name: string; -} - -export interface Mapping { - generated: Position; - original: Position; - source: string; - name?: string; -} - -export interface CodeWithSourceMap { - code: string; - map: SourceMapGenerator; -} - -export interface SourceMapConsumer { - /** - * Compute the last column for each generated mapping. The last column is - * inclusive. - */ - computeColumnSpans(): void; - - /** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. - * - column: The column number in the generated source. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. - * - column: The column number in the original source, or null. - * - name: The original identifier, or null. - */ - originalPositionFor(generatedPosition: Position & { bias?: number }): NullableMappedPosition; - - /** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: The column number in the original source. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - generatedPositionFor(originalPosition: MappedPosition & { bias?: number }): NullablePosition; - - /** - * Returns all generated line and column information for the original source, - * line, and column provided. If no column is provided, returns all mappings - * corresponding to a either the line we are searching for or the next - * closest line that has any mappings. Otherwise, returns all mappings - * corresponding to the given line and either the column we are searching for - * or the next closest column that has any offsets. - * - * The only argument is an object with the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: Optional. the column number in the original source. - * - * and an array of objects is returned, each with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - allGeneratedPositionsFor(originalPosition: MappedPosition): NullablePosition[]; - - /** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ - hasContentsOfAllSources(): boolean; - - /** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ - sourceContentFor(source: string, returnNullOnMissing?: boolean): string | null; - - /** - * Iterate over each mapping between an original source/line/column and a - * generated line/column in this source map. - * - * @param callback - * The function that is called with each mapping. - * @param context - * Optional. If specified, this object will be the value of `this` every - * time that `aCallback` is called. - * @param order - * Either `SourceMapConsumer.GENERATED_ORDER` or - * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to - * iterate over the mappings sorted by the generated file's line/column - * order or the original's source/line/column order, respectively. Defaults to - * `SourceMapConsumer.GENERATED_ORDER`. - */ - eachMapping(callback: (mapping: MappingItem) => void, context?: any, order?: number): void; - /** - * Free this source map consumer's associated wasm data that is manually-managed. - * Alternatively, you can use SourceMapConsumer.with to avoid needing to remember to call destroy. - */ - destroy(): void; -} - -export interface SourceMapConsumerConstructor { - prototype: SourceMapConsumer; - - GENERATED_ORDER: number; - ORIGINAL_ORDER: number; - GREATEST_LOWER_BOUND: number; - LEAST_UPPER_BOUND: number; - - new (rawSourceMap: RawSourceMap, sourceMapUrl?: SourceMapUrl): Promise; - new (rawSourceMap: RawIndexMap, sourceMapUrl?: SourceMapUrl): Promise; - new (rawSourceMap: RawSourceMap | RawIndexMap | string, sourceMapUrl?: SourceMapUrl): Promise; - - /** - * Create a BasicSourceMapConsumer from a SourceMapGenerator. - * - * @param sourceMap - * The source map that will be consumed. - */ - fromSourceMap(sourceMap: SourceMapGenerator, sourceMapUrl?: SourceMapUrl): Promise; - - /** - * Construct a new `SourceMapConsumer` from `rawSourceMap` and `sourceMapUrl` - * (see the `SourceMapConsumer` constructor for details. Then, invoke the `async - * function f(SourceMapConsumer) -> T` with the newly constructed consumer, wait - * for `f` to complete, call `destroy` on the consumer, and return `f`'s return - * value. - * - * You must not use the consumer after `f` completes! - * - * By using `with`, you do not have to remember to manually call `destroy` on - * the consumer, since it will be called automatically once `f` completes. - * - * ```js - * const xSquared = await SourceMapConsumer.with( - * myRawSourceMap, - * null, - * async function (consumer) { - * // Use `consumer` inside here and don't worry about remembering - * // to call `destroy`. - * - * const x = await whatever(consumer); - * return x * x; - * } - * ); - * - * // You may not use that `consumer` anymore out here; it has - * // been destroyed. But you can use `xSquared`. - * console.log(xSquared); - * ``` - */ - with(rawSourceMap: RawSourceMap | RawIndexMap | string, sourceMapUrl: SourceMapUrl | null | undefined, callback: (consumer: BasicSourceMapConsumer | IndexedSourceMapConsumer) => Promise | T): Promise; -} - -export const SourceMapConsumer: SourceMapConsumerConstructor; - -export interface BasicSourceMapConsumer extends SourceMapConsumer { - file: string; - sourceRoot: string; - sources: string[]; - sourcesContent: string[]; -} - -export interface BasicSourceMapConsumerConstructor { - prototype: BasicSourceMapConsumer; - - new (rawSourceMap: RawSourceMap | string): Promise; - - /** - * Create a BasicSourceMapConsumer from a SourceMapGenerator. - * - * @param sourceMap - * The source map that will be consumed. - */ - fromSourceMap(sourceMap: SourceMapGenerator): Promise; -} - -export const BasicSourceMapConsumer: BasicSourceMapConsumerConstructor; - -export interface IndexedSourceMapConsumer extends SourceMapConsumer { - sources: string[]; -} - -export interface IndexedSourceMapConsumerConstructor { - prototype: IndexedSourceMapConsumer; - - new (rawSourceMap: RawIndexMap | string): Promise; -} - -export const IndexedSourceMapConsumer: IndexedSourceMapConsumerConstructor; - -export class SourceMapGenerator { - constructor(startOfSourceMap?: StartOfSourceMap); - - /** - * Creates a new SourceMapGenerator based on a SourceMapConsumer - * - * @param sourceMapConsumer The SourceMap. - */ - static fromSourceMap(sourceMapConsumer: SourceMapConsumer): SourceMapGenerator; - - /** - * Add a single mapping from original source line and column to the generated - * source's line and column for this source map being created. The mapping - * object should have the following properties: - * - * - generated: An object with the generated line and column positions. - * - original: An object with the original line and column positions. - * - source: The original source file (relative to the sourceRoot). - * - name: An optional original token name for this mapping. - */ - addMapping(mapping: Mapping): void; - - /** - * Set the source content for a source file. - */ - setSourceContent(sourceFile: string, sourceContent: string): void; - - /** - * Applies the mappings of a sub-source-map for a specific source file to the - * source map being generated. Each mapping to the supplied source file is - * rewritten using the supplied source map. Note: The resolution for the - * resulting mappings is the minimium of this map and the supplied map. - * - * @param sourceMapConsumer The source map to be applied. - * @param sourceFile Optional. The filename of the source file. - * If omitted, SourceMapConsumer's file property will be used. - * @param sourceMapPath Optional. The dirname of the path to the source map - * to be applied. If relative, it is relative to the SourceMapConsumer. - * This parameter is needed when the two source maps aren't in the same - * directory, and the source map to be applied contains relative source - * paths. If so, those relative source paths need to be rewritten - * relative to the SourceMapGenerator. - */ - applySourceMap(sourceMapConsumer: SourceMapConsumer, sourceFile?: string, sourceMapPath?: string): void; - - toString(): string; - - toJSON(): RawSourceMap; -} - -export class SourceNode { - children: SourceNode[]; - sourceContents: any; - line: number; - column: number; - source: string; - name: string; - - constructor(); - constructor( - line: number | null, - column: number | null, - source: string | null, - chunks?: Array<(string | SourceNode)> | SourceNode | string, - name?: string - ); - - static fromStringWithSourceMap( - code: string, - sourceMapConsumer: SourceMapConsumer, - relativePath?: string - ): SourceNode; - - add(chunk: Array<(string | SourceNode)> | SourceNode | string): SourceNode; - - prepend(chunk: Array<(string | SourceNode)> | SourceNode | string): SourceNode; - - setSourceContent(sourceFile: string, sourceContent: string): void; - - walk(fn: (chunk: string, mapping: MappedPosition) => void): void; - - walkSourceContents(fn: (file: string, content: string) => void): void; - - join(sep: string): SourceNode; - - replaceRight(pattern: string, replacement: string): SourceNode; - - toString(): string; - - toStringWithSourceMap(startOfSourceMap?: StartOfSourceMap): CodeWithSourceMap; -} diff --git a/node_modules/hexo-theme-butterfly/node_modules/source-map/source-map.js b/node_modules/hexo-theme-butterfly/node_modules/source-map/source-map.js deleted file mode 100644 index 272d278a..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/source-map/source-map.js +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2009-2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE.txt or: - * http://opensource.org/licenses/BSD-3-Clause - */ -exports.SourceMapGenerator = require("./lib/source-map-generator").SourceMapGenerator; -exports.SourceMapConsumer = require("./lib/source-map-consumer").SourceMapConsumer; -exports.SourceNode = require("./lib/source-node").SourceNode; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/Changelog.md b/node_modules/hexo-theme-butterfly/node_modules/stylus/Changelog.md deleted file mode 100644 index a86b90aa..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/Changelog.md +++ /dev/null @@ -1,1469 +0,0 @@ -0.59.0 / 2022-08-13 -=================== - * deps: switching from css to @adobe/css-tools [#2709](https://github.com/stylus/stylus/pull/2709) - -0.58.1 / 2022-05-31 -=================== - * fix: bin/stylus in npm packages contains windows style line endings [#2691](https://github.com/stylus/stylus/issues/2691) - * ci: add yarn bin/stylus execute regression test [#2692](https://github.com/stylus/stylus/pull/2692) - -0.58.0 / 2022-05-28 -=================== - * feat: support full css level 4 logical combination selectors (`:is`, `:where`, `:not`, `:has`). [#2684](https://github.com/stylus/stylus/pull/2684) - * deps: drop [`safer-buffer`](https://www.npmjs.com/package/safer-buffer). [#2682](https://github.com/stylus/stylus/pull/2682) - * chore: ci add code coverage benchmark. [#2683](https://github.com/stylus/stylus/pull/2683) - * chore: delete unused .gitmodules file. [#2687](https://github.com/stylus/stylus/pull/2687) - * chore: remove unused require. [#2686](https://github.com/stylus/stylus/pull/2686) - -0.57.0 / 2022-02-19 -=================== - * Fix: remove lib-cov and outdated deps. [#2659](https://github.com/stylus/stylus/pull/2659) - -0.56.0 / 2021-12-18 -=================== - * Deps: upgrade debug version from v3 to v4. [#2643](https://github.com/stylus/stylus/pull/2643) - * Deps: remove dependencies semver and mkdirp. [2641](https://github.com/stylus/stylus/pull/2641) - * Fix: variable names beginning with a keyword and dash. [#2634](https://github.com/stylus/stylus/pull/2634) - * Fix: @import url() error in dependency resolver. [#2632](https://github.com/stylus/stylus/pull/2632) - -0.55.0 / 2021-09-04 -=================== - - * Fearure: Add deg and fr as exceptions for 0 value unit omission. [#2578](https://github.com/stylus/stylus/pull/2578) - * Feature: Add inverse trigonometric functions as bifs. [#2186](https://github.com/stylus/stylus/pull/2186) closes [#1567](https://github.com/stylus/stylus/issues/1567) - * Fix: Bug fixes of encoding png image in url lib function. [#2549](https://github.com/stylus/stylus/pull/2549) - * Refactoring: Replace dependency css-parse with css. [#2554](https://github.com/stylus/stylus/pull/2554) - -0.54.8 / 2020-07-16 -=================== - - * Feature: Patched Renderer.deps() to recognize identifiers as import paths. [#2519](https://github.com/stylus/stylus/pull/2519) - * Fix: fix for Node v14 'Accessing non-existent property' errors [#2538](https://github.com/stylus/stylus/pull/2538) - * Fix: tests on windows [#2523](https://github.com/stylus/stylus/pull/2523) - * Fix: fixed an issue when running Stylus inside of an .asar archive [#2520](https://github.com/stylus/stylus/pull/2520) - * Fix: fix property lookup negation [#2506](https://github.com/stylus/stylus/pull/2506) closes [#2485](https://github.com/stylus/stylus/issues/2485) - -0.54.7 / 2019-08-21 -=================== - - * Fix: bug in hash access [#2484](https://github.com/stylus/stylus/pull/2484) - -0.54.6 / 2019-08-19 -=================== - - * Feature: Extend length method to work with strings [#2110](https://github.com/stylus/stylus/pull/2110) - * Feature: add quiet flag to have a more "quiet" output. [#2088](https://github.com/stylus/stylus/pull/2088) - * Feature: Support for cssnext nested at-rule syntax (apply, nested) [#2335](https://github.com/stylus/stylus/pull/2335) - * Feature: Make prefix-classes work with partial and range refs in selectors [#2278](https://github.com/stylus/stylus/pull/2278) - * Feature: Extend in block level import [#2270](https://github.com/stylus/stylus/pull/2270) - * chore: Use mkdir() recursive option instead of mkdirp() [#2426](https://github.com/stylus/stylus/pull/2426) - * chore: Define function arguments explicitly [#2417](https://github.com/stylus/stylus/pull/2417) - * Fix issue with cos & sin not stripping rad unit. [#2284](https://github.com/stylus/stylus/pull/2284) - * Fix: handle empty at-rules [#2416](https://github.com/stylus/stylus/pull/2416) - * Fix: Do not use the deprecated Buffer() constructor [#2424](https://github.com/stylus/stylus/pull/2424) - * Fix: 'imports' couldn't be set as a option [#2425](https://github.com/stylus/stylus/pull/2411) closes [#2411](https://github.com/stylus/stylus/pull/2411) - * Fix: no such directory error in Stylus Executable [#2421](https://github.com/stylus/stylus/pull/2421) - * Fix: define column for mixin [#2456](https://github.com/stylus/stylus/pull/2456) - * Fix: work with hash [#2453](https://github.com/stylus/stylus/pull/2453) - * Fix: check whether captureStackTrace exists [#2394](https://github.com/stylus/stylus/pull/2394) - - - -0.54.5 / 2016-04-28 -=================== - - * Fix: [CLI] Correct console output for Node 6.0 - -0.54.4 / 2016-04-27 -=================== - - * Fix: Correct extname checks for Node 6.0 - -0.54.3 / 2016-04-26 -=================== - - * Fix: Proper embedurl encoding for svg files with a hash. - * Fix: Validate this.dest before using path.extname. - * Fix: Update node-glob version. - -0.54.2 / 2016-03-11 -=================== - - * Fix: False-positive import loop with empty imported file. - -0.54.0 / 2016-03-05 -=================== - - * Feature: Added initial reference selector. - * Feature: New `embedurl()` bif with optional utf8 uncoding support for SVG. - * Feature: New `index()` bif. - * Feature: New `percentage()` bif. - * Feature: New `slice()` bif, #2115. - * Feature: Support for UTF-8 encoding of urls, #2084. - * Feature: Added `global` flag to `define()` function. - * Feature: `match()` bif now returns the matched values instead of a boolean, #2109. - * Feature: Added an optional `flags` argument to `match()` bif, #2109. - * Docs: Added basic “getting started” to Readme, #2073. - * Docs: Updated information about error reporting. - * Fix: `selectors()` now returns proper subselectors. - * Fix: No more unneeded spaces with partial reference selector using ranges. - * Fix: Proper evaluating of the default arguments. - * Fix: Evaluate variables in current-media function. - * Fix: Validate regexp flags for `match` function. - * Fix: Proper conditional assignment and "define" method. - * Fix: Proper relative paths in sourcemaps if --out flag is set to a filename. - * Fix: Proper errors with `--include-css` and `--resolve-url` used concurrently. - * Fix: [Evaluator] Support for function as a default argument for functions. - * Fix: [Lexer] Proper multiline comments inside multiline expressions. - * Fix: [JS API] Proper variables from options object inside expressions. - * Fix: [Renderer] No more caching of parsed AST for deps-resolver. - -0.53.0 / 2015-12-14 -=================== - - * Feature: Numeric partial references. - * Feature: Relative references. - * Feature: New `selectors()` bif. - * Feature: Support for comma-separated lists as `selector()`'s arguments. - * Docs: Reworked contribution guidelines. - * Docs: Added Contributor Code of Conduct. - * Fix: Support for multiple consecutive parent references. - * Fix: Proper removal of parent references at the root when combinators are present. - * Fix: Don't add space before unknown units. - * Fix: Allow comma-separated lists in `@supports` value. - * Fix: No more error message for "assertType" without parameter name. - * Fix: Proper middleware overlap function on windows. Thanks to #2029 by @bcomnes. - * Fix: Better absolute path detection for Windows. Thanks to #2033 by @mlohbihler. - * Refactoring: Moved bifs to separate files. - - -0.52.4 / 2015-09-04 -=================== - - * Fix: Revert changes in "looksLikeSelector" method. - -0.52.3 / 2015-09-04 -=================== - - * Fix: Another parsing regression. - -0.52.2 / 2015-09-03 -=================== - - * Fix: A parsing regression. - -0.52.1 / 2015-09-03 -=================== - - * Fix: Correct line numbers in error messages for files with CSS comments. - * Fix: Better absolute urls detection. - * Fix: Added type assertions to "substr", "split" and "replace" bifs. - * Fix: Atrules parsing with a block at a new line. - * Fix: Bug with commented indented lines at the end of a file. - * Fix: Stylus error messages for Node 0.12+. - * Fix: A bug with arguments cloning. - -0.52.0 / 2015-07-19 -=================== - - * Feature: new url resolver without url checks (`--resolve-url-nocheck`). - * Feature: New option to json bif ("leave-strings"). - * Feature: New option to json bif ("optional"). - * Feature: Adding utf-8 charset to inline sourcemap. - * Feature: allow inline CSS comments inside value. - * Fix: shouldn't fail to compile in strict mode, #1923. - * Fix: Paths should be normalized for windows support, #1954. - * Fix: Proper parsing of selector groups with placeholder and color-like ID. - * Fix: Proper import loop detection. - * Fix: Correct output of namespaces and charsets inside imports. - * Fix: Indented comments shouldn't cause errors. - * Fix: Proper way of parsing lists in "convert" bif. - * Fix: Proper comma escaping in an object interpolation. - * Fix: Allow no whitespace between keyframes name and the following curly brace. - -0.51.1 / 2015-04-28 -=================== - - * Fixed `;` at the end of blockless unknown at-rules. - * Fixed float units convertion by `convert` bif. - -0.51.0 / 2015-04-23 -=================== - - * Added support for cascading extend. - * Added "transparent" as a named color. - * Added support for blockless unknown at-rules. - * Made math more strict. - * Fixed bug with extending nested placeholder selectors inside MQ. - * Fixed imports inside `@media` blocks. - * Fixed url resolver to consider `--out` options. - * Fixed parsing of multiple "else if" statements. - * Fixed an edge case with recursive extend. - * Fixed regression with nested media queries. - * Fixed parsing of nested comments. - * Fixed checking paths overlap if 'dest' is a function in middleware. - -0.50.0 / 2015-02-05 -=================== - - * Added `!optional` directive for extending, #1757. - * Added `selector-exists` bif, #1758. - * Added `remove` bif for removing items from hashes. - * Added optional recursive hash merging, #1771. - * Added optional (`--hoist-atrules` flag) `@import` and `@charset` hoisting. - * Added a way to output to specific file path with CLI, #1800. - * Fixed regression with using `@media` inside `+cache`. - * Fixed `resolve-url` for hash urls, #1778. - * Fixed `mix` bif for differently transparent colors, #1792. - * Fixed bug with postfix `&` without comma. - * Fixed incorrectly imported functions defined in other files with nested @require. - * Fixed duplicated selectors when extending into placeholders with MQ. - * Fixed `filter: contrast()` error. - * Fixed the cloning of cached nodes. - * Fixed incorrect filenames included in source maps, #1812. - * Fixed stripping of unsuppressed comments from nested blocks. - * Fixed build error for multiple files, #1813. - * Fixed error handling slightly. - * Fixed (throwing error) edge case of watching and printing at the same time, #1798. - * Fixed watch to log to std.err, #1796. - * Fixed indent in complex rules at CSS to Stylus conversion, #1808. - -0.49.3 / 2014-11-06 -=================== - - * Fixed regression with `block` keyword inside block mixin. - -0.49.2 / 2014-10-14 -=================== - - * Fixed regression #1727 + small fixes for #1717. - * Fixed nested selectors when using nested and bubbled media queries. - * Fixed issue when mixin's block is used as part of a property value. - * Fixed hardcoded `.styl` extension from CLI (added `extname` arg). - -0.49.1 / 2014-09-24 -=================== - - * Fixed an output order of nested media queries. - * Fixed regression with cached nodes. - * Fixed support for `Woff2` and `WebP` mime-tipes, #1699. - -0.49.0 / 2014-09-22 -=================== - - * Added a way to use plugins in stylus.render options, #1697. - * Added LRU for memory caching. - * Now returning literal CSS on parser error when `--resolve-url` is set. - * Now not showing JS stack trace for stylus' `error()` calls. - * Fixed inconsistent source maps' field orders. - * Fixed bug with calling functions inside an inline loop. - * Fixed bug with nested media queries inside a mixin. - * Fixed bug with extending nested selector inside placeholder selector. - * Fixed bug with alpha variable for hsla/rgba. - * Fixed extending of rules inside unknown at-rules. - * Fixed incorrect merging of media queries using variables. - * Fixed bubbling for `@keyframes`. - * Fixed incorrect `@supports` parsing. - * Fixed `url()` support for `@namespace`. - * Fixed incorrect filename and column information for cached nodes. - * Fixed `--sourcemap-base` to be ignored when `--out` is present. - * Fixed outputting sourcemap log message when `--print` was present. - -0.48.1 / 2014-08-21 -=================== - - * Fixed sourcemap paths when `--out` flag is present, #1668. - * Fixed the naming convention for maps: `.styl.map` => `.css.map`, #1668. - -0.48.0 / 2014-08-20 -=================== - - * Added basic sourcemaps support, #1655. - * Added info on columns for sourcemaps and better error reporting. - * Added `globals` and `functions` keys to options object in JS API, #1653. - * Added `rebeccapurple` named color. - * Added `unicode-range` support (#1648). - * Changed the behaviour of adding percents together to the more sane one, #1664. - * Fixed bug with property lookup inside mixin block (#1645). - * Fixed a bug with nested media queries inside mixins (#1643). - * Fixed an `@extend` inside `@media` queries with multi-level selectors (#1658). - * Fixed bug with cloning of an interpolated selector with comma (#1660). - * Fixed bug with nested media queries in conditionals. - * Fixed a bug with cached imports (#1641). - * Fixed `@css` literal that generated `u+0085` characters instead of newlines (#1663). - * Fixed escaped comma (`\,`) inside hashes (#1666). - * Fixed a string representation of HSLA node to preserve `%` (#1439). - * Fixed incorrect position of inline comments (#1597). - * Fixed a bug with an apostrophe and a colon in a single-line comment (#1647). - -0.47.3 / 2014-07-22 -=================== - - * Fixed support for schema-less urls inside `url()`. - -0.47.2 / 2014-07-19 -=================== - - * Fixed comma-first multiline syntax, #1634. - * Fixed hsla arguments for different color functions, #1619. - * Fixed Bug with @media and placeholder selectors, #1625. - * Fixed bug with nested media queries, 1620. - * Fixed broken URL parsing for source and destination paths, #1613. - -0.47.1 / 2014-07-02 -=================== - - * Fixed treatment of unknown pseudo-elements, #1608. - * Fixed unit expression precedence error, #1611. - -0.47.0 / 2014-07-01 -=================== - - * Added support for anonymous functions, #1580. - * A lot of better color functions, #1526: - * Added support for two arguments for `hsla`. - * Added component setters (`red`, `hue`, `alpha` etc.). - * Added `luminosity` bif. - * Added `blend` bif. - * Added `contrast` bif. - * Added `transparentify` bif. - * Added `list-separator` bif, #1576. - * Added symlinks support to CLI, #1577. - * Added idents and units coercion, #1605. - * Fixed `@keyframes` parsing issue. - * Fixed parse error when `{` is on a new line in at-rules. - * Fixed an issue with multiline parsing. - * Fixed another issue with cached imports, #1587. - * Fixed illegal unary "%", missing left-hand operand, #1586. - * Reverted #1527. - -0.46.3 / 2014-06-09 -=================== - - * Fixed parse error, #1582. - -0.46.2 / 2014-06-04 -=================== - - * Fixed regression with double writing of transparent mixin value, #1574. - -0.46.1 / 2014-06-04 -=================== - - * Fixed regression with a root reference in interpolated selectors, #1573. - -0.46.0 / 2014-06-03 -=================== - - * Added support for nested media queries, #1540. - * Added `convert` built-in function, #1545. - * Added negative index values support for subscripts, #1564. - * Add short-circuit evaluation for logical operators, #1532. - * Fixed the dropped commas in splat arguments, #1525. - * Fixed double-writing the `@media` and other at-rules in mixins, #1535. - * Fixed unit expression precedence error, #1537. - * Fixed comments inside the property expressions, #1538. - * Fixed handling of the `@css` and `unquote` inside groups, #1527. - * Fixed incorrect line numbers on errors, #1543. - * Fixed import cloning with cache, #1548. - * Fixed cloning to preserve `property.literal`, #1558. - * Fixed bifs arguments cloning bug, #1560. - * Fixed bug with nested interpolated selectors with a comma, 1568. - * Fixed `current-property` ignored in property lookup, #1565. - * Fixed `current-property`'s value to be evaluated in the right context, #1562. - * Fixed spaces and comments inside a hash declaration, #1554. - * Fixed aliases for transparent mixins, #1557. - * Fixed compilation fail when 'dest' path doesn't end with '/', #1541. - * Fixed bug with CSS to Stylus `@keyframes` converting, #1549. - -0.45.1 / 2014-05-16 -=================== - - * Fixed regression with `@require` and globbed paths inside functions, #1529. - -0.45.0 / 2014-05-11 -=================== - - * Added support for more CSS-like syntax variants: indented code blocks, closing curly brace on the same line with props etc (as now ignoring meaningless tokens while parsing), #1506. - * Added support for block-level `@import` and `@require`, #1495. - * Added hash values support in `@media`, #1504. - * Added coercion for pt units, #1483. - * Added a way to escape `\` in a tag name, #1487. - * Fixed trailing spaces and comments in the selector groups, #1499. - * Fixed comments in the selector parts (now ignoring them), #1517. - * Fixed bug with url string having a protocol, #1510. - * Fixed bug with `@scope` and complex selectors, #1505. - * Fixed the recursion with the `display: block` inside block mixins, #1515. - * Fixed bug with current-property and block mixins, #1512. - * Fixed bug with complex selectors in conditionals, #1500. - * Fixed bug with `@media` bubbling and conditionals, #1518. - * Fixed bug with newlines and comments in conditionals, #1520. - * Fixed bug with the variable in the first line of mixin, #1502. - * Fixed but with the variable right after iterating over an empty list, #1503. - * Fixed bug with built-in function calls inside a hash assignment, #1488. - * Fixed bug with `*` selector first in the group, #1498. - * Fixed unnecessary bubbling for `@keyframes`, #1490. - * Fixed bug with undefined `filename` on keyframes, #1485. - -0.44.0 / 2014-04-23 -=================== - - * Major performance tuning and basic caching support, almost ⨉2 build time boost, #1428. - * Added basic support for most at-rules, #1464. - * Added `+cache` built-in mixin for caching the result of functions and mixins into placeholders, #1466. - * Added `current-media()` bif that returns the string for the current media query, #1466. - * Added `called-from` property in functions that contains the names of the functions from the call stack till the current one, #1466. - * Added a way to escape commas and parent references inside selectors, #1413. - * Removed the never needed `-ms-` prefix for keyframes. - * Fixed rendering of multiple selectors inside interpolation, #1413. - -0.43.1 / 2014-04-07 -=================== - - * Fixed regression with `only` keyword, #1460. - -0.43.0 / 2014-04-05 -=================== - - * Added better support for media queries — interpolations, expressions in values and more, #1453. - * Added `define` bif, #1382. - * Add `--prefix` option for CLI and `+prefix-classes` mixin, #1420. - * Added `--deps` flag to list the dependencies of the compiled file and stylus.deps function, #1429. - * Added support for multiple selectors in `@extend`, #1419. - * Added the support of the hash objects to `define`, #1444. - * Fixed some floating point problems in maths, #1339. - * Fixed the lost decimal part of units can when coercing from a string, #1387. - * Fixed bug with hash lookup when a property name is the same as a name of local variable, #1433. - * Fixed bug with the `+=` operator with strings, #1423. - * Fixed a bug in recompiling of the files with `--watch`, #1435. - * Fixed `default` value for `cursor` property (Temporally remove `default` from the pseudo-classes list), #1438. - * Fixed the rendering of empty `@keyframes`, #1442. - * Fixed parseColor for single digit integers in rgb(a) strings, #1447. - * Fixed wrong named colors, #1450. - - -0.42.3 / 2014-03-03 -================== - - * Fixed bug with pseudo-elements as part of the nested selector with a class, #1415. - * Ignoring comments in REPL, #1390. - * Fixed bug with print of the line numbers when node has empty `nodes` array, #1412. - * Fixed bug with first argument for defaulted arguments, #1407. - * Fixed compression of blocks with nested rules, #1396. - * Fixed bug with importing of files with `.css` in the dirname, #1385. - * Fixed eaten whitespace after selector with a keyword, #1383. - -0.42.2 / 2014-01-30 -================== - - * Added support for reverse ranges. - * Fixed bug with an expression as arguments of function call. - * Fixed bug with property lookup inside `@block`. - * Fixed bug with parsing an attribute selector. - * Fixed bug with `add-property` inside function call. - * Fixed compiling to a directory with `.styl` in the name. - * Fixed bug with missed `mtime` in middleware imports. - * Fixed an incorrect line number in multi-line group selectors. - * Fixed incorrect file path in win32 debug info, #1353. - -0.42.1 / 2014-01-19 -================== - - * Fixed color functions to fallback into literal CSS functions, #1340. - * Fixed `@import` globbing with `--watch`. - * Fixed Bug with units as part of the selector. - * Fixed compiling with UTF-8 BOM. - * Added Icons, and reorganization of graphics folder, #1346. - -0.42.0 / 2014-01-06 -================== - - * Added `@require`, #1287. - * Added more lookup patterns for the `@import` and `@require`. Support Node.js modules, #1316. - * Added file globbing, #1306 and #1013. - * Added root reference, part of #1240. - * Added basic support for `@block` entity, #1290. - * Added string support for `selector()` bif, #1279. - * Added options as an optional argument for `use()` bif, #1297. - * Added some new colors shortcuts: grayscale, complement, tint & shade, #1308. - * Fixed broken @media queries in logic blocks, #1289. - * Fixed function call inside block mixin is on the `block` variable pass, #1285. - * Fixed bug with `if` and color in array check, #1301. - * Fixed bug with list of color keywords as default argument, #1294. - * Fixed bug with property lookup in @media queries, #1315. - * Now using `css-parse` instead of `CSSOM` for converting CSS -> Stylus, #1307. - -0.41.3 / 2013-12-12 -================== - - * Fixed regression for `selector`, #1278. - -0.41.2 / 2013-12-10 -================== - - * Fixed property lookup in blocks, #1273. - * Fixed @extend in blocks, #1274. - * Fixed if-else-if-else, #1276. - -0.41.1 / 2013-12-08 -================== - - * Fixed inaccessible local variable inside conditional which is inside a selector, #1267. - * Fixed some minor issues with `selector()` interpolation, #1259. - * Fixed missing hashes in base64 converted urls, #1263. - * Fixed conditionals inside `@font-face`, #1268. - -0.41.0 / 2013-11-30 -================== - - * Added basic [block mixins](http://stylus-lang.com/docs/mixins.html#block-mixins) (`+foo`) with block interpolation (`block`), #1223. - * Added [`selector()` bif](http://stylus-lang.com/docs/selectors.html#selector-bif), #1249. - * Added [hash interpolation to blocks](http://stylus-lang.com/docs/hashes.html#interpolation), #1202. - * Fixed parent reference in root context from returning `&`. - * Fixed bug with double writing media blocks, 1ed44a81 - * Fixed a lot of regressions after hashes, #1230, #1236, #1237, #1248. - -0.40.3 / 2013-11-16 -================== - - * Fixed current-property to be available in function evaluation context, #1211. - * Fixed another regression, #1215. - -0.40.2 / 2013-11-12 -================== - - * Fixed regression after the #1185, #1207. - -0.40.1 / 2013-11-12 -================== - - * Fixed assign to hashes using dot, #1201. - * Fixed regression from the #1185. - * Fixed precedence of the subscript operator, #1189. - * Fixed imports in functions, #1192. - * Fixed compressing of time units, #1204. - -0.40.0 / 2013-11-05 -================== - - * Allow multiple `end` event handlers + optional result css modification, #1180. - * Added Support for proper hashes in json config, #1186. - * Allow functions accept object literal as an argument, #1184. - * Fixed another infinite loop (`a[` etc.), #1187. - * Fixed bug in hashes subassigns with functions, #1181. - * Fixed "is" attribute selectors fail, #1185. - -0.39.4 / 2013-11-03 -================== - - * Fixed another regression after #1150, #1183. - -0.39.3 / 2013-11-01 -================== - - * Fixed parse error in conditional statement without `()`, #1178. - -0.39.2 / 2013-10-31 -================== - - * Fixed other regressions after #1150, #1175. - -0.39.1 / 2013-10-30 -================== - - * Fixed regression after #1150, #1172. - -0.39.0 / 2013-10-30 -================== - - * Added basic hashes support, #1150. - * Allow to inject Evaluator via Renderer's options, #1149. - * Fixed infinite loop case, #1147. - * Fixed Bug with `else if match`, #1154. - * Fixed schemaless absolute urls for `url`, #1148. - * Fixed urls in windows 7 for `--relative-url`, #1156. - * Fixed calculation inside `calc` CSS function, #1133. - * Fixed parsing shorthand colors from json config, #1158. - -0.38.0 / 2013-09-24 -================== - - * Fixed `push` not to modify the first element of another array, #1118. - * Fixed property lookup from mixins, #1127. - * Fixed support for `src` and `dest` in middleware, started tests for middleware #1143. - * Fixed `--resolve-url` that removed tails from urls, #1126. - * Fixed mime type for `.woff`, #1128. - * Fixed `.toString` for undefined functions, #1119. - * Fixed path overlap for non-string dest, #1115. - * Fixed `path.resolve` for nonœ-true resolveURL, #1116. - * Fixed sync return in `stylus.render()`, #1138. - * Fixed duplicate calls from `this.calling`, #1122. - -0.37.0 / 2013-08-19 -================== - - * Added optional params to the json bif, #1102. - * Added `--print` option to print CSS to stdout, #1108. - * Fixed json bif to return literals for colours, #875. - * Fixed include of the css files when `--resolve-url` is on, #1099. - * Fixed error in negating variables, #1101. - * Fixed bug in `p` function, #1111. - * Fixed tests under windows, #1105. - * Fixed regression after #1094, #1113. - * Fixed regression after #983, #1098. - -0.36.1 / 2013-08-06 -================== - - * Fixed regression after #1090, #1094. - -0.36.0 / 2013-08-01 -================== - - * Added `substr`, `replace` and `split` bifs, #1088. - * Added possibility to provide functions to src and dest, #930. - * Added explicit expose for events, #898. - * Added blocking and css manipulation possibility within 'end' event, #923. - * Fixed unneeded code for imports, #1090. - * Fixed mtime for literal imports, #983. - * Fixed empty string as possible quote value for string node, #956. - * Fixed non-symmetrical src and dest paths in middleware, #1037. - -0.35.1 / 2013-07-29 -================== - - * Fixed the support for progressive JPEGs in `image-size`, #1087. - -0.35.0 / 2013-07-29 -================== - - * Added jpeg and svg support to image-size, #1083. - * Added `tan` trigonometric function, also `sin` and `cos` now understand `deg` units. - * Added fonts to data URI `url()` mimes, also the list of mimes is now configurable, #841, #1046. - * Added base conversion for numbers, #714. - * Fixes extends from nested mixins, #1084. - * Fixes coercion error, #1082. - -0.34.1 / 2013-07-12 -================== - - * Fixed the regression after #865. - -0.34.0 / 2013-07-12 -================== - - * Added built-in `use()` function to extend Stylus from inside of `.styl` files, #788. - * Added optional resolver of relative urls, #1070. - * Fixes incorrect imports lookup inside function call, #1069. - * Fixes a lot of issues with trailing symbols in comments, #865. - * Fixes brace on a newline CSS code style. - * Some minor fixes to tmbundle: #975, #1033, #1034. - -0.33.1 / 2013-06-30 -================== - - * Fixed the `exports.version` to always show an actual one. - -0.33.0 / 2013-06-30 -================== - - * Added extendable placeholder selectors, #1014. - * Added optional argument to `image-size` function, #812. - * Fixed inline comments after selectors, #862. - * Fixed a bug with empty block in CSS syntax, #712. - -0.32.1 / 2013-02-27 -================== - - * fix issue on Windows where absolute path starts with two backslashes - * fix extends within a loop. - * fix: don't try to read absolute urls - -0.32.0 / 2013-01-04 -================== - - * add sync api for #230 #691 #151 - * fix unsuppressed comments in nested imports - * fix #911 Percentage calculation value not copied - -0.31.0 / 2012-11-24 -================== - - * add support for rounding precision - * fix extends with parent reference. Closes #879 - * fix importing of files with ".css" in the dirname - * fix #619 Support slash in media - * fix #819 Extends generate duplicate selectors - * fix #807 directory with `.styl` in the name and local install of stylus - * fix #814 Add property function with media query - * fix #828 Add 'x' unit for image-set (synonym to dppx). - * fix #834 Percentage calculation not used when value is expression - -0.30.1 / 2012-10-17 -================== - - * fix mozdocument nodes not getting visited during imports. Fixes #853 - -0.30.0 / 2012-10-15 -================== - - * add @-moz-document to the lexer and parser. Fixes #436 - * add --import for issue #485 - * fix @property lookup when a sibling is null - * fix 'limit' file size option that was broken in 61a2cf - * fix pseudo-selector properties. Closes #808 - -0.29.0 / 2012-08-15 -================== - - * add more features to the textmate bundle [paulmillr] - * add `json()` BIF for loading variables from JSON files [geddesign] - * fix for #790 allow trailing colon, comma etc in // comments [geddesign] - -0.28.2 / 2012-07-15 -================== - - * fix extend in mixin. Closes #747, #748 and #751 - -0.28.1 / 2012-07-07 -================== - - * fix __@media__ cloning - -0.28.0 / 2012-07-06 -================== - - * add suffix to `basename()` BIF - * add `pathjoin()` BIF - * add `basename()` BIF - * add `dirname()` BIF - * add `extname()` BIF - * fix `@extend` in mixin. Closes #638 - -0.27.2 / 2012-06-19 -================== - - * Adding list of all css3 units - * Fixed CSS to stylus conversion `!important` support - * Fix last rule being ignored if empty indents at the end of the file - * Fixes #425: Compiler hangs when the last property isn't followed by semicolon at the end of the document - * Fixes #435: Can't concat array inside url() - -0.27.1 / 2012-05-28 -================== - - * Fixes #698: incorrect function call within for with named argument [Tõnis Tiigi] - * Fixes #676. Stylus incorrectly imports the .css files that are not in the same folder as the processed .styl file - -0.27.0 / 2012-05-10 -================== - - * Added `add-property()` mixin support [jasonkuhrt] - * Added % support for `fade-in()` and `fade-out()` [jasonkuhrt] - * Added % support to `rgba()` [jasonkuhrt] - * Fixed `.import()` - previously failed to mixin - -0.26.1 / 2012-05-07 -================== - - * any node. Closes #657 - -0.26.0 / 2012-04-27 -================== - - * Added BIF shift [gravof] - * Added BIF pop [gravof] - * Added support for __@media__ bubbling properties [Ian MacLeod] - * Changed: strip trailing zeros [gravof] - -0.25.0 / 2012-04-03 -================== - - * Added `make test-cov` - * Added temporary multiline support. - * Added: allow for '%' unit type in the 'alpha' of rgba and hsla [jasonkuhrt] - * Updated cssom dep - * Removed growl dep. Closes #583 - * Fixed BIF retval coercion - * Fixed issue #390, nested @media - -0.24.0 / 2012-02-16 -================== - - * Added `mix()` BIF (docs needed) - * Added: cast return values from js functions - * Fixed binops in mixin selectors. Closes #566 - * Fixed `opposite-position()` pass through "center"` - -0.23.0 / 2012-02-02 -================== - - * Added `Renderer` "end" event - * Added: cast return value from js-functions - * Cleaned up documentation grammar etc [Zearin] - -0.22.6 / 2012-01-20 -================== - - * Fixed postfix conditional cloning. Closes #535 - * Fixed idents prefixed with several hyphens. Closes #536 - * Fixed up the TextMate bundle syntax [ianstormtaylor] - -0.22.5 / 2012-01-16 -================== - - * Fixed underscore in function identifier. Closes #524 - -0.22.4 / 2012-01-11 -================== - - * Fixed __@extends__ inheritance bug. Closes #499 - * Fixed 'lineno' global leak due to missing `new` [teppeis] - -0.22.3 / 2012-01-11 -================== - - * Fixed `--watch` working on windows with a temporary hack [dciccale] - * Fixed __@extend__ with no properties. Closes #498 - -0.22.2 / 2012-01-08 -================== - - * Added: allow newlines in place of commas for keyframes - * Fixed: skip comment newlines between keyframe positions. Closes #504 - -0.22.1 / 2012-01-08 -================== - - * Fixed __@keyframes__ support for multiple values. Closes #503 - -0.22.0 / 2012-01-04 -================== - - * Added `@extend`. Closes #149 - * Added more syntax highlighting to TextMate bundle [paulmillr] - * Added `keys(pairs)` and `values(pairs)` BIFs - * Added JavaScript object coercion support - * Added JavaScript -> Stylus node coercion utilities - * Fixed `.define()`ing of functions - * Fixed `stylus(1)` repl for 0.6.x - -0.21.2 / 2011-12-22 -================== - - * Fixed literal / within function call. Closes #432 - -0.21.1 / 2011-12-20 -================== - - * Fixed space after `)` in selectors. Closes #449 - -0.21.0 / 2011-12-17 -================== - - * Added unit casting, ex: `(n * 5)%`. Closes #285 - -0.20.1 / 2011-12-16 -================== - - * Added global leak detection to the test suite - * Fixed two globals - * Fixed operator ident regression. Closes #292 - -0.20.0 / 2011-12-11 -================== - - * Added `--include-css` to literally include imported CSS. Closes #448 - * Fixed coercion bug with expression. Closes #480 - -0.19.8 / 2011-12-01 -================== - - * Fixed middleware `mkdir -p` support - -0.19.7 / 2011-11-30 -================== - - * Fixed `or` binop regression. Closes #475 - -0.19.6 / 2011-11-30 -================== - - * Fixed current-property with commas. Closes #472 - -0.19.5 / 2011-11-28 -================== - - * revert noop visitor methods, this breaks extensions - -0.19.4 / 2011-11-28 -================== - - * Fixed css-style __@page__ support - * Fixed __@page__ block evaluation - * Fixed __@font-face__ block evaluation [Suor] - -0.19.3 / 2011-11-17 -================== - - * Added "include css" setting (need docs) to literally include imported css. Closes #448 - * Added EOL escape. Related to #195 - * Fixed tab support in lexical analysis (trailing colors etc). Closes #460 - -0.19.2 / 2011-11-09 -================== - - * Fixed "in" within selectors. Closes #458 - -0.19.1 / 2011-11-08 -================== - - * Added `spin()` BIF (same as `color + 50deg` etc) - * Removed "sys" require()s for 0.6.x - * Fixed sibling property lookup bug. Closes #452 - * Fixed: retain original quote for strings - -0.19.0 / 2011-10-26 -================== - - * Added property lookup bubbling support. Closes #446 - -0.18.1 / 2011-10-26 -================== - - * Added "indent spaces" compiler setting. Closes #445 - * Allow node > 0.4.x < 0.7.0 - * Fixed: allow function execution within @imports - -0.18.0 / 2011-10-21 -================== - - * Added #n support (#e -> #eeeeee). Closes #430 - * Added #nn support (#ef -> #efefef) - * Added support for rgb percentages. - * Fixed property rendering in blocks. Closes #440 - -0.17.0 / 2011-09-30 -================== - - * Added `@scope ` feature to scope all subsequent selectors - * Added list equality to the `!=` operator - * Added list equality to the `==` operator - * Added mkdir -p support to the middleware - * Changed: `!` coerces expression not the first value - * Fixed Ternary boolean coercion. Closes #420 - * Fixed __@font-face__ __@import__ regression. Closes #418 - -0.16.0 / 2011-09-26 -================== - - * Added `mkdir -p` support to the middleware - * Added `@import url(string)` support. Closes #352 - * Added `fade-in()` and `fade-out()` BIFs - * Adding prefixes for Opera and IE - * Fixed comments trailing __@media__. Closes #415 [guillermo] - * Fixed: Output from --help in stylus executable cut-off half way through - * Changed: treat -/+ operations with percentages as lighten()/darken(). -Closes #401 - -0.15.4 / 2011-09-14 -================== - - * Fixed `String#coerce()` for Expressions - -0.15.3 / 2011-09-14 -================== - - * Added `-U, --inline` to stylus(1) - * Added `rem` support. Closes #395 - * Fixed __@charset__ semi-colon. Closes #400 - * Fixed infinite loop in `Parser#function()`. Closes #393 - -0.15.2 / 2011-09-06 -================== - - * Added alias `:=` of `?=`. Closes #389 - * Removed auto-prefixing of pseudo element selectors. Closes #385 - * Changed: when left-hand operand has no unit assign the right - * Fixed __@keyframes__ with __@import__ regression. Closes #372 - * Fixed css __@import__ within blocks regression. Closes #388 - * Fixed unwrapping of property args expression. Closes #379 - * Fixed __@prop__ access scope issue, use closet block, not current - * Fixed __@font-face__. Closes #375 - -0.15.1 / 2011-08-18 -================== - - * Added pseudo-element vendor expansion support - * Added `@keyframe` expansion support. Closes #293 - * Added support for arbitrary `@-VENDOR-keyframes` support - * Added support for `@property` mixin property access Closes #363 - * Added `/*!` support to comments to disable suppression - * Changed: allow uses to append `.styl` when importing. Closes #366 - * Fixed paren matching issue. Closes #368 - * Fixed windows absolute path checking Added `utils.absolute(path)` - * Fixed `Ident#clone()` with `.property` flag - * Fixed evaluation of expression when using @name. Closes #361 - * Fixed `path.join()` usage in `utils.lookup()`. Closes #356 - * Fixed space after comment regression. Closes #360 - -0.15.0 / 2011-08-15 -================== - - * Adding `Renderer#get(option)` - * Added the ability to reference property values with `@`. Closes #344 - * Changed comment output. css-style multi-line comments are preserved - * Fixed issue with bools in selectors. Closes #280 - -0.14.0 / 2011-08-10 -================== - - * Added firebug original file / line number mapping [parallel] - * Added support for `#rgba` and `#rrggbbaa` color formats - * Changed: fix alpha to a scale of 2 - * Fixing function param check to allow for empty function arguments - -0.13.9 / 2011-08-04 -================== - - * Fixed `lighten()` BIF 'lighten by %' function push color closer to white [cwolves] - * Fixed cli plugin usage absolute paths, don't prepend the CWD [cpojer] - * Renaming 'import' to '_import' because import is a reserved word in node v0.5 - -0.13.8 / 2011-08-01 -================== - - * Added `PI` and `-math-prop(name)` - * Added `cos()` and `sin()` - * Added support for __SVG__ data URIs [mhemesath] - * Rename variable "import" to "imported" [eegg] - -0.13.7 / 2011-07-15 -================== - - * Added `js(str)` BIF - * Fixed reserved keyword `import` with `imported` - -0.13.6 / 2011-07-12 -================== - - * Added `@-webkit-keyframes` support. Closes #307 - * Added gedit language-spec - * Changed: optional `growl` dep for stylus(1) - * Changed: `require("stylus")` instead of `../` for the mac app integration - -0.13.5 / 2011-06-27 -================== - - * Fixed middleware handling of new and removed `@import` s [brandonbloom] - -0.13.4 / 2011-06-22 -================== - - * Added __Compile and Display CSS__ TextMate command (⌘B) [Daniel Gasienica] - * Fixed caching behavior for recompilation of files with changed imports [Brandon Bloom] - -0.13.3 / 2011-06-01 -================== - - * Added padding for error linenos so they line up - * Improved unary op error messages - * Improved invalid `@keyframes` ident error msg - * Fixed HSLA regression for operations resulting in a bool. Closes #274 - * Fixed `arguments` issue with excluding defaults. Closes #272 - -0.13.2 / 2011-05-31 -================== - - * Fixed colors after `url()` call regression. Closes #270 - -0.13.1 / 2011-05-30 -================== - - * Fixed colors in `url()`. Closes #267 - * Fixed selector without trailing comma containing selector token. Closes #260 - -0.13.0 / 2011-05-17 -================== - - * Added `-u, --use PATH` flag for utilizing plugins - * Fixed `hsla.clampDegrees()` with negative values [Bruno Héridet] - -0.12.4 / 2011-05-12 -================== - - * Added support for underscore in identifiers. Closes #247 - * Fixed `@keyframe` block evaluation. Closes #252 - -0.12.3 / 2011-05-08 -================== - - * Fixed `0%` in `@keyframes` from becoming `0` when compressed. Closes #248 - -0.12.2 / 2011-05-03 -================== - - * Fixed issue with `^=` attr selector causing infinite loop. Closes #244 - * Fixed multiple occurrences of `&` in selectors. Closes #243 - -0.12.1 / 2011-04-29 -================== - - * Fixed spaces around line-height shorthand. Closes #228 - * Fixed `-{foo}` interpolation support. Closes #235 - -0.12.0 / 2011-04-29 -================== - - * Added `*prop: val` hack support (blueprint / html boilerplate etc parse fine now) - * Added selector interpolation support - * Fixed "-" within interpolation. Closes #220 - -0.11.12 / 2011-04-27 -================== - - * Added `SyntaxError` and `ParseError` - * Removed `stylus.parse()` - * Fixed error reporting. Closes #44 - -0.11.11 / 2011-04-24 -================== - - * Fixed mutation of units when using unary ops. Closes #233 - -0.11.10 / 2011-04-17 -================== - - * Fixed regression. Closes #229 - -0.11.9 / 2011-04-15 -================== - - * Fixed issue with large selectors spanning several lines - -0.11.8 / 2011-04-15 -================== - - * Added support for `Renderer#define(name, node)` to define a global - -0.11.7 / 2011-04-12 -================== - - * Added `Renderer#use(fn)`. Closes #224 - * Improved `utils.assertType()` error message; include param name - -0.11.6 / 2011-04-12 -================== - - * Fixed: node.source and node.filename are writable - -0.11.5 / 2011-04-12 -================== - - * Added / employed `Null#isNull` - * Added / employed `Boolean#is{True,False}` - * Removed all uses of `instanceof` - * Removed all equality checks between singleton nodes - -0.11.4 / 2011-04-10 -================== - - * Added `Arguments#clone()` - * Added `push()` / `append()` - * Added `unshift()` / `prepend()` BIFs - -0.11.3 / 2011-04-08 -================== - - * Fixed: keyword args previously not evaluated - * Fixed: subpixel support - * Fixed bug preventing combinators (and other ops) in `@media` blocks. Closes #216 [reported by jsteenkamp] - -0.11.2 / 2011-04-06 -================== - - * Added `Renderer#include(path)`. Closes #214 - * Fixed `@import` path resolution bug. Closes #215 - * Fixed optional keyword arg bug. Closes #212 - -0.11.1 / 2011-04-01 -================== - - * Fixed regression preventing commas from outputting - -0.11.0 / 2011-04-01 -================== - - * Added `HSLA#add(h,s,l,a)` - * Added `HSLA#sub(h,s,l,a)` - * Added `RGBA#add(r,g,b,a)` - * Added `RGBA#sub(r,g,b,a)` - * Added `RGBA#multiply(n)` - * Added `RGBA#divide(n)` - * Added `HSLA#adjustHue(deg)` - * Added `HSLA#adjustLightness(percent)` - * Added `HSLA#adjustSaturation(percent)` - * Added `linear-gradient()` example - * Added `s(fmt, ...)` built-in; sprintf-like - * Added `%` sprintf-like string operator, ex: `'%s %s' % (1 2)` - * Added `current-property` local variable - * Added `add-property(name, val)` - * Added the ability for functions to duplicate the property they are invoked within - * Added `[]=` operator support. Ex: `fonts[1] = arial`, `nums[1..3] = 2` - * Added `-I, --include ` to stylus(1). Closes #206 - * Added support for `50 + 25% == 75` - * Added support for `rgba + 25%` to lighten - * Added support for `rgba - 25%` to darken - * Added support for `rgba - 25` to adjust rgb values - * Changed: null now outputs "null" instead of "[Null]" - * Fixed hsl operation support, all operations are equivalent on rgba/hsla nodes - * Fixed degree rotation - -0.10.0 / 2011-03-29 -================== - - * Added keyword argument support - * Added `Arguments` node, acts like `Expression` - * Added `utils.params()` - * Added `debug` option to stylus middleware - * Added support for `hsl + 15deg` etc to adjust hue - * Added special-case for percentage based `RGBA` operations (`#eee - 20%`) - * Changed: right-hand colors in operations are not clamped (`#eee * 0.2`) - * Added support for `unit * color` (swaps operands) - * Fixed color component requests on the opposite node type (ex red on hsla node) - * Fixed `Expression#clone()` to support `Arguments` - * Fixed issue with middleware where imports are improperly mapped - * Fixed mutation of color when adjusting values - * Fixed: coerce string to literal - * Removed {`darken`,`lighten`}`-by()` BIFs - -0.9.2 / 2011-03-21 -================== - - * Removed a `console.log()` call - -0.9.1 / 2011-03-18 -================== - - * Fixed connect middleware `@import` support. Closes #168 - The middleware is now smart enough to know when imports - change, and will re-compile the target file. - - * Changed middleware `compile` function to return the `Renderer` (API change) - -0.9.0 / 2011-03-18 -================== - - * Added `-i, --interactive` for the Stylus REPL (eval stylus expressions, tab-completion etc) - * Added link to vim syntax - * Changed `p()` built-in to display parens - * Changed `--compress -C` to `-c`, and `-css -c` is now `-C` - * Fixed: preserve rest-arg expressions. Closes #194 - * Fixed `*=` in selector, ex `[class*="foo"]` - * Fixed `--watch` issue with growl, updated to 1.1.0. Closes #188 - * Fixed negative floats when compressed. Closes #193 [reported by ludicco] - -0.8.0 / 2011-03-14 -================== - - * Added postfix `for`-loop support. - Ex: `return n if n % 2 == 0 for n in nums` - * Added support for several postfix operators - Ex: `border-radius: 5px if true unless false;` - * Added `last(expr)` built-in function - * Added `sum(nums)` built-in function - * Added `avg(nums)` built-in function - * Added `join(delim, vals)` built-in function - * Added `Evaluator#{currentScope,currentBlock}` - * Added multi-line function parameter definition support - * Changed: `0` is falsey, `0%`, `0em`, `0px` etc truthy. Closes #160 - * Fixed `for` implicit __return__ value - * Fixed `for` explicit __return__ value - * Fixed mixin property ordering - -0.7.4 / 2011-03-10 -================== - - * Added `RGBA` node - * Added `is a "color"` special-case, true for `HSLA` and `RGBA` nodes. -Closes #180 - * Performance; 2.5× faster compiles due to removing use of getters in `Parser` and `Lexer` (yes, they are really slow). - * Removed `Color` node - * Fixed stylus(1) `--watch` support due to dynamic `@import` support. Closes #176 - -0.7.3 / 2011-03-09 -================== - - * Fixed: allow semi-colons for non-css syntax for one-liners - -0.7.2 / 2011-03-08 -================== - - * Added `isnt` operator (same as `is not` and `!=`) - * Added support for dynamic `@import` expressions - * Added `@import` index resolution support - * Added `light()` / `dark()` BIFs - * Added `compress` option for Connect middleware [disfated] - * Changed: most built-in functions defined in stylus (`./lib/functions/index.styl`) - * Fixed dynamic expressions in `url()`. Closes #105 - -0.7.1 / 2011-03-07 -================== - - * Fixed connect middleware for 0.4.x - -0.7.0 / 2011-03-02 -================== - - * Added `is` and `is not` aliases for `==` and `!=` - * Added `@keyframes` dynamic name support - * Fixed units in interpolation - * Fixed clamping of HSLA degrees / percentages - -0.6.7 / 2011-03-01 -================== - - * Fixed __RGBA__ -> __HSLA__ conversion due to typo - -0.6.6 / 2011-03-01 -================== - - * Added string -> unit type coercion support aka `5px + "10"` will give `15px` - * Added `warn` option Closes #152 - Currently this only reports on re-definition of functions - * Added `$` as a valid identifier character - * Added `mixin` local variable for function introspection capabilities. Closes #162 - * Fixed typo: `Unit#toBoolean()` is now correct - * Fixed interpolation function calls. Closes #156 - * Fixed mixins within Media node. Closes #153 - * Fixed function call in ret val. Closes #154 - -0.6.5 / 2011-02-24 -================== - - * Fixed parent ref `&` mid-selector bug. Closes #148 [reported by visnu] - -0.6.4 / 2011-02-24 -================== - - * Fixed `for` within brackets. Closes #146 - -0.6.3 / 2011-02-22 -================== - - * Fixed single-ident selectors. Closes #142 - * Fixed cyclic `@import` with file of the same name. Closes #143 - -0.6.2 / 2011-02-21 -================== - - * Added stylus(1) growl support when using `--watch` - * Added `@import` watching support to stylus(1). Closes #134 - * Changed: stylus(1) only throws when `--watch` is not used - * Fixed `darken-by()` BIF - * Fixed `@import` literal semi-colon. Closes #140 - -0.6.1 / 2011-02-18 -================== - - * Fixed evaluation of nodes after a return. Closes #139 - -0.6.0 / 2011-02-18 -================== - - * Added `stylus(1)` direct css to stylus file conversion [Mario] - For example instead of `$ stylus --css < foo.css > foo.styl` - you may now either `$ stylus --css foo.css` or provide - a destination path `$ stylus --css foo.css /tmp/out.styl`. - - * Added postfix conditionals. Closes #74 - Expressive ruby-ish syntax, ex: `padding 5px if allow-padding`. - -0.5.3 / 2011-02-17 -================== - - * Added `in` operator. `3 in nums`, `padding in props` etc - * Added `Expression#hash`, hashing all of the nodes in order - * Added tests for conditionals with braces. Closes #136 - * Fixed ids that are also valid colors. Closes #137 - -0.5.2 / 2011-02-15 -================== - - * Fixed spaces after `}` with css-style. Closes #131 - * Fixed single-line css-style support. Closes #130 - -0.5.1 / 2011-02-11 -================== - - * Fixed mixin property ordering. Closes #125 - -0.5.0 / 2011-02-09 -================== - - * Added `lighten-by()` BIF - * Added `darken-by()` BIF - -0.4.1 / 2011-02-09 -================== - - * Added support for function definition braces - * Fixed issue with invalid color output. Closes #127 - -0.4.0 / 2011-02-07 -================== - - * Added css-style syntax support - * Fixed support for `*` selector within `@media` blocks - -0.3.1 / 2011-02-04 -================== - - * Fixed property disambiguation logic. Closes #117 - You no longer need to add a trailing comma when - chaining selectors such as `td:nth-child(2)\ntd:nth-child(3)` - -0.3.0 / 2011-02-04 -================== - - * Added more assignment operators. Closes #77 - `+=`, `-=`, `*=`, `/=`, and `%=` - -0.2.1 / 2011-02-02 -================== - - * Fixed `--compress` when passing files for stylus(1). Closes #115 - * Fixed bug preventing absolute paths from being passed to `@import` - * Fixed `opposite-position()` with nested expressions, unwrapping - * Fixed a couple global var leaks [aheckmann] - -0.2.0 / 2011-02-01 -================== - - * Added: `url()` utilizing general lookup paths. - This means that `{ paths: [] }` is optional now, as lookups - will be relative to the file being rendered by default. - - * Added `-w, --watch` support to stylus(1). Closes #113 - -0.1.0 / 2011-02-01 -================== - - * Added `opposite-position(positions)` built-in function - * Added `image-lookup(path)` built-in function - * Added `-o, --out ` support to stylus(1) - * Added `stylus [file|dir ...]` support - * Added: defaulting paths to `[CWD]` for stylus(1) - * Changed: `unquote()` using `Literal` node - * Changed: utilizing `Literal` in place of some `Ident`s - -0.0.2 / 2011-01-31 -================== - - * Added optional property colon support. Closes #110 - * Added `--version` to stylus(1) - -0.0.1 / 2011-01-31 -================== - - * Initial release diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/LICENSE b/node_modules/hexo-theme-butterfly/node_modules/stylus/LICENSE deleted file mode 100644 index 367fabf1..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) Automattic - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/Readme.md b/node_modules/hexo-theme-butterfly/node_modules/stylus/Readme.md deleted file mode 100644 index 65ba716f..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/Readme.md +++ /dev/null @@ -1,90 +0,0 @@ -

Stylus logo

- -[![Build Status](https://github.com/stylus/stylus/actions/workflows/ci.yml/badge.svg?branch=dev)](https://github.com/stylus/stylus/actions?query=branch%3Adev) -[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-brightgreen.svg)](https://github.com/stylus/stylus/pulse) -[![npm version](https://img.shields.io/npm/v/stylus?color=brightgreen)](https://www.npmjs.com/package/stylus) -[![npm](https://img.shields.io/npm/dm/stylus.svg)](https://www.npmjs.com/package/stylus) -[![Join the community on github discussion](https://img.shields.io/badge/Join%20the%20community-on%20discussions-%23754ffb?logo=googlechat&logoColor=white)](https://github.com/stylus/stylus/discussions) - -Stylus is a revolutionary new language, providing an efficient, dynamic, and expressive way to generate CSS. Supporting both an indented syntax and regular CSS style. - -## Sponsors - -You can sponsor stylus ongoing development via [opencollective](https://opencollective.com/stylus/) or [paypal](https://www.paypal.com/paypalme/iChenLei/) ! - - - - - - - - - - - - -
- - automattic - - - - mojotech - -
-

Your Logo

-
- - opencollective stylus - - or - - Paypal stylus - -
- -### Backers -[![Backers](https://opencollective.com/stylus/individuals.svg)](https://opencollective.com/stylus/) - -## Installation - -```bash -$ npm install stylus -g -``` - -## Basic Usage -Watch and compile a stylus file from command line with -```bash -stylus -w style.styl -o style.css -``` -You can also [try all stylus features on stylus-lang.com](http://stylus-lang.com/try.html), build something with stylus on [codepen](http://codepen.io) or [RunKit](https://npm.runkit.com/stylus) - -### 📖 New Docs (alpha) - -Try our new [official documentation website](http://stylus-docs.netlify.app/) and give us feedback via [github issues](https://github.com/stylus/stylus/issues), thanks. - -### Community modules - - - https://github.com/stylus/stylus/wiki - -### Stylus cheatsheet - - - [Stylus cheatsheet](https://devhints.io/stylus), very useful stylus syntax code snippet for you - -### Code of Conduct - -Please note that this project is released with a [Contributor Code of Conduct](Code_of_Conduct.md). By participating in this project you agree to abide by its terms. - -### Contribution - -Please read our [Contribution Guide](Contributing.md) before making any pull requests to the project. Included are directions for opening issues, workflows, and coding standards. - -Thank you to all the people who already contributed to Stylus! - - - -## License - -[MIT](https://github.com/stylus/stylus/blob/dev/LICENSE) - -Copyright (c) 2010-present [TJ](https://github.com/tj) and [Stylus maintainers](https://github.com/orgs/stylus/people) diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/bin/stylus b/node_modules/hexo-theme-butterfly/node_modules/stylus/bin/stylus deleted file mode 100644 index d842645a..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/bin/stylus +++ /dev/null @@ -1,846 +0,0 @@ -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var fs = require('fs') - , stylus = require('../lib/stylus') - , basename = require('path').basename - , dirname = require('path').dirname - , extname = require('path').extname - , resolve = require('path').resolve - , join = require('path').join - , isWindows = process.platform === 'win32' - , mkdirSync = fs.mkdirSync; - -/** - * Arguments. - */ - -var args = process.argv.slice(2); - -/** - * Compare flag. - */ - -var compare = false; - -/** - * Compress flag. - */ - -var compress = false; - -/** - * CSS conversion flag. - */ - -var convertCSS = false; - -/** - * Line numbers flag. - */ - -var linenos = false; - -/** - * CSS class prefix. - */ -var prefix = ''; - -/** - * Print to stdout flag. - */ -var print = false; - -/** - * Firebug flag - */ - -var firebug = false; - -/** - * Quiet flag - */ - -var quiet = false; - -/** - * Sourcemap flag - */ - -var sourcemap = false; - -/** - * Files to processes. - */ - -var files = []; - -/** - * Import paths. - */ - -var paths = []; - -/** - * Destination directory. - */ - -var dest; - -/** - * Watcher hash. - */ - -var watchers; - -/** - * Enable REPL. - */ - -var interactive; - -/** - * Plugins. - */ - -var plugins = []; - -/** - * Optional url() function. - */ - -var urlFunction = false; - -/** - * Include CSS on import. - */ - -var includeCSS = false; - -/** - * Set file imports. - */ - -var imports = []; - -/** - * Resolve relative urls - */ - -var resolveURL = false; - -/** - * Disable cache. - */ - -var disableCache = false; - -/** - * Display dependencies flag. - */ - -var deps = false; - -/** - * Hoist at-rules. - */ - -var hoist = false; - -/** - * Specify custom file extension. - */ - -var ext = '.css'; - -/** - * Usage docs. - */ - -var usage = [ - '' - , ' Usage: stylus [options] [command] [< in [> out]]' - , ' [file|dir ...]' - , '' - , ' Commands:' - , '' - , ' help [:] Opens help info at MDN for in' - , ' your default browser. Optionally' - , ' searches other resources of :' - , ' safari opera w3c ms caniuse quirksmode' - , '' - , ' Options:' - , '' - , ' -i, --interactive Start interactive REPL' - , ' -u, --use Utilize the Stylus plugin at ' - , ' -U, --inline Utilize image inlining via data URI support' - , ' -w, --watch Watch file(s) for changes and re-compile' - , ' -o, --out Output to when passing files' - , ' -C, --css [dest] Convert CSS input to Stylus' - , ' -I, --include Add to lookup paths' - , ' -c, --compress Compress CSS output' - , ' -d, --compare Display input along with output' - , ' -f, --firebug Emits debug infos in the generated CSS that' - , ' can be used by the FireStylus Firebug plugin' - , ' -l, --line-numbers Emits comments in the generated CSS' - , ' indicating the corresponding Stylus line' - , ' -m, --sourcemap Generates a sourcemap in sourcemaps v3 format' - , ' -q, --quiet Less noisy output' - , ' --sourcemap-inline Inlines sourcemap with full source text in base64 format' - , ' --sourcemap-root "sourceRoot" property of the generated sourcemap' - , ' --sourcemap-base Base from which sourcemap and all sources are relative' - , ' -P, --prefix [prefix] prefix all css classes' - , ' -p, --print Print out the compiled CSS' - , ' --import Import stylus ' - , ' --include-css Include regular CSS on @import' - , ' --ext Specify custom file extension for compiled file, default .css' - , ' -D, --deps Display dependencies of the compiled file' - , ' --disable-cache Disable caching' - , ' --hoist-atrules Move @import and @charset to the top' - , ' -r, --resolve-url Resolve relative urls inside imports' - , ' --resolve-url-nocheck Like --resolve-url but without file existence check' - , ' -V, --version Display the version of Stylus' - , ' -h, --help Display help information' - , '' -].join('\n'); - -/** - * Handle arguments. - */ - -var arg; -while (args.length) { - arg = args.shift(); - switch (arg) { - case '-h': - case '--help': - console.error(usage); - return; - case '-d': - case '--compare': - compare = true; - break; - case '-c': - case '--compress': - compress = true; - break; - case '-C': - case '--css': - convertCSS = true; - break; - case '-f': - case '--firebug': - firebug = true; - break; - case '-l': - case '--line-numbers': - linenos = true; - break; - case '-m': - case '--sourcemap': - sourcemap = {}; - break; - case '-q': - case '--quiet': - quiet = true; - break; - case '--sourcemap-inline': - sourcemap = sourcemap || {}; - sourcemap.inline = true; - break; - case '--sourcemap-root': - var url = args.shift(); - if (!url) throw new Error('--sourcemap-root required'); - sourcemap = sourcemap || {}; - sourcemap.sourceRoot = url; - break; - case '--sourcemap-base': - var path = args.shift(); - if (!path) throw new Error('--sourcemap-base required'); - sourcemap = sourcemap || {}; - sourcemap.basePath = path; - break; - case '-P': - case '--prefix': - prefix = args.shift(); - if (!prefix) throw new Error('--prefix required'); - break; - case '-p': - case '--print': - print = true; - break; - case '-V': - case '--version': - console.log(stylus.version); - return; - case '-o': - case '--out': - dest = args.shift(); - if (!dest) throw new Error('--out required'); - break; - case 'help': - var name = args.shift() - , browser = name.split(':'); - if (browser.length > 1) { - name = [].slice.call(browser, 1).join(':'); - browser = browser[0]; - } else { - name = browser[0]; - browser = ''; - } - if (!name) throw new Error('help required'); - help(name); - break; - case '--include-css': - includeCSS = true; - break; - case '--ext': - ext = args.shift(); - if (!ext) throw new Error('--ext required'); - break; - case '--disable-cache': - disableCache = true; - break; - case '--hoist-atrules': - hoist = true; - break; - case '-i': - case '--repl': - case '--interactive': - interactive = true; - break; - case '-I': - case '--include': - var path = args.shift(); - if (!path) throw new Error('--include required'); - paths.push(path); - break; - case '-w': - case '--watch': - watchers = {}; - break; - case '-U': - case '--inline': - args.unshift('--use', 'url'); - break; - case '-u': - case '--use': - var options; - var path = args.shift(); - if (!path) throw new Error('--use required'); - - // options - if ('--with' == args[0]) { - args.shift(); - options = args.shift(); - if (!options) throw new Error('--with required'); - options = eval('(' + options + ')'); - } - - // url support - if ('url' == path) { - urlFunction = options || {}; - } else { - paths.push(dirname(path)); - plugins.push({ path: path, options: options }); - } - break; - case '--import': - var file = args.shift(); - if (!file) throw new Error('--import required'); - imports.push(file); - break; - case '-r': - case '--resolve-url': - resolveURL = {}; - break; - case '--resolve-url-nocheck': - resolveURL = { nocheck: true }; - break; - case '-D': - case '--deps': - deps = true; - break; - default: - files.push(arg); - } -} - -// if --watch is used, assume we are -// not working with stdio - -if (watchers && !files.length) { - files = fs.readdirSync(process.cwd()) - .filter(function(file){ - return file.match(/\.styl$/); - }); -} - -// --sourcemap flag is not working with stdio -if (sourcemap && !files.length) sourcemap = false; - -/** - * Open the default browser to the CSS property `name`. - * - * @param {String} name - */ - -function help(name) { - var url - , exec = require('child_process').exec - , command; - - name = encodeURIComponent(name); - - switch (browser) { - case 'safari': - case 'webkit': - url = 'https://developer.apple.com/library/safari/search/?q=' + name; - break; - case 'opera': - url = 'http://dev.opera.com/search/?term=' + name; - break; - case 'w3c': - url = 'http://www.google.com/search?q=site%3Awww.w3.org%2FTR+' + name; - break; - case 'ms': - url = 'http://social.msdn.microsoft.com/search/en-US/ie?query=' + name + '&refinement=59%2c61'; - break; - case 'caniuse': - url = 'http://caniuse.com/#search=' + name; - break; - case 'quirksmode': - url = 'http://www.google.com/search?q=site%3Awww.quirksmode.org+' + name; - break; - default: - url = 'https://developer.mozilla.org/en/CSS/' + name; - } - - switch (process.platform) { - case 'linux': command = 'x-www-browser'; break; - default: command = 'open'; - } - - exec(command + ' "' + url + '"', function(){ - process.exit(0); - }); -} - -// Compilation options - -if (files.length > 1 && isCSS(dest)) { - dest = dirname(dest); -} - -var options = { - filename: 'stdin' - , compress: compress - , firebug: firebug - , linenos: linenos - , sourcemap: sourcemap - , paths: [process.cwd()].concat(paths) - , prefix: prefix - , dest: dest - , 'hoist atrules': hoist -}; - -// Buffer stdin - -var str = ''; - -// Convert CSS to Stylus - -if (convertCSS) { - switch (files.length) { - case 2: - compileCSSFile(files[0], files[1]); - break; - case 1: - var file = files[0]; - compileCSSFile(file, join(dirname(file), basename(file, extname(file))) + '.styl'); - break; - default: - var stdin = process.openStdin(); - stdin.setEncoding('utf8'); - stdin.on('data', function(chunk){ str += chunk; }); - stdin.on('end', function(){ - var out = stylus.convertCSS(str); - console.log(out); - }); - } -} else if (interactive) { - repl(); -} else if (deps) { - // if --deps is used, just display list of the dependencies - // not working with stdio and dirs - displayDeps(); -} else { - if (files.length) { - compileFiles(files); - } else { - compileStdio(); - } -} - -/** - * Start Stylus REPL. - */ - -function repl() { - var options = { cache: false, filename: 'stdin', imports: [join(__dirname, '..', 'lib', 'functions')] } - , parser = new stylus.Parser('', options) - , evaluator = new stylus.Evaluator(parser.parse(), options) - , rl = require('readline') - , repl = rl.createInterface(process.stdin, process.stdout, autocomplete) - , global = evaluator.global.scope; - - // expose BIFs - evaluator.evaluate(); - - // readline - repl.setPrompt('> '); - repl.prompt(); - - // HACK: flat-list auto-complete - function autocomplete(line){ - var out = process.stdout - , keys = Object.keys(global.locals) - , len = keys.length - , words = line.split(/\s+/) - , word = words.pop() - , names = [] - , name - , node - , key; - - // find words that match - for (var i = 0; i < len; ++i) { - key = keys[i]; - if (0 == key.indexOf(word)) { - node = global.lookup(key); - switch (node.nodeName) { - case 'function': - names.push(node.toString()); - break; - default: - names.push(key); - } - } - } - - return [names, line]; - }; - - repl.on('line', function(line){ - if (!line.trim().length) return repl.prompt(); - parser = new stylus.Parser(line, options); - parser.state.push('expression'); - evaluator.return = true; - try { - var expr = parser.parse(); - evaluator.root = expr; - var ret = evaluator.evaluate(); - var node; - while (node = ret.nodes.pop()) { - if (!node.suppress) { - var str = node.toString(); - if ('(' == str[0]) str = str.replace(/^\(|\)$/g, ''); - console.log('\033[90m=> \033[0m' + highlight(str)); - break; - } - } - repl.prompt(); - } catch (err) { - console.error('\033[31merror: %s\033[0m', err.message || err.stack); - repl.prompt(); - } - }); - - repl.on('SIGINT', function(){ - console.log(); - process.exit(0); - }); -} - -/** - * Highlight the given string of Stylus. - */ - -function highlight(str) { - return str - .replace(/(#)?(\d+(\.\d+)?)/g, function($0, $1, $2){ - return $1 ? $0 : '\033[36m' + $2 + '\033[0m'; - }) - .replace(/(#[\da-fA-F]+)/g, '\033[33m$1\033[0m') - .replace(/('.*?'|".*?")/g, '\033[32m$1\033[0m'); -} - -/** - * Convert a CSS file to a Styl file - */ - -function compileCSSFile(file, fileOut) { - fs.stat(file, function(err, stat){ - if (err) throw err; - if (stat.isFile()) { - fs.readFile(file, 'utf8', function(err, str){ - if (err) throw err; - var styl = stylus.convertCSS(str); - fs.writeFile(fileOut, styl, function(err){ - if (err) throw err; - }); - }); - } - }); -} - -/** - * Compile with stdio. - */ - -function compileStdio() { - process.stdin.setEncoding('utf8'); - process.stdin.on('data', function(chunk){ str += chunk; }); - process.stdin.on('end', function(){ - // Compile to css - var style = stylus(str, options); - if (includeCSS) style.set('include css', true); - if (disableCache) style.set('cache', false); - usePlugins(style); - importFiles(style); - style.render(function(err, css){ - if (err) throw err; - if (compare) { - console.log('\n\x1b[1mInput:\x1b[0m'); - console.log(str); - console.log('\n\x1b[1mOutput:\x1b[0m'); - } - console.log(css); - if (compare) console.log(); - }); - }).resume(); -} - -/** - * Compile the given files. - */ - -function compileFiles(files) { - files.forEach(compileFile); -} - -/** - * Display dependencies of the compiled files. - */ - -function displayDeps() { - files.forEach(function(file){ - // ensure file exists - fs.stat(file, function(err, stat){ - if (err) throw err; - fs.readFile(file, 'utf8', function(err, str){ - if (err) throw err; - options.filename = file; - var style = stylus(str, options); - - usePlugins(style); - importFiles(style); - console.log(style.deps().join('\n')); - }); - }); - }); -} - -/** - * Compile the given file. - */ - -function compileFile(file) { - // ensure file exists - fs.stat(file, function(err, stat){ - if (err) throw err; - // file - if (stat.isFile()) { - fs.readFile(file, 'utf8', function(err, str){ - if (err) throw err; - options.filename = file; - options._imports = []; - var style = stylus(str, options); - if (includeCSS) style.set('include css', true); - if (disableCache) style.set('cache', false); - if (sourcemap) style.set('sourcemap', sourcemap); - - usePlugins(style); - importFiles(style); - style.render(function(err, css){ - watchImports(file, options._imports); - if (err) { - if (watchers) { - console.error(err.stack || err.message); - } else { - throw err; - } - } else { - writeFile(file, css); - // write sourcemap - if (sourcemap && !sourcemap.inline) { - writeSourcemap(file, style.sourcemap); - } - } - }); - }); - // directory - } else if (stat.isDirectory()) { - fs.readdir(file, function(err, files){ - if (err) throw err; - files.filter(function(path){ - return path.match(/\.styl$/); - }).map(function(path){ - return join(file, path); - }).forEach(compileFile); - }); - } - }); -} - -/** - * Write the given CSS output. - */ - -function createPath(file, sourceMap) { - var out; - if (files.length === 1 && isCSS(dest)) { - return [dest, sourceMap ? '.map' : ''].join(''); - } - // --out support - out = [basename(file, extname(file)), sourceMap ? ext + '.map' : ext].join(''); - return dest - ? join(dest, out) - : join(dirname(file), out); -} - -/** - * Check if the given path is a CSS file. - */ - -function isCSS(file) { - return file && '.css' === extname(file); -} - -function writeFile(file, css) { - // --print support - if (print) return process.stdout.write(css); - var path = createPath(file); - - mkdirSync(dirname(path), { recursive: true }) - - fs.writeFile(path, css, function(err){ - if (err) throw err; - console.log(' \033[90mcompiled\033[0m %s', path); - // --watch support - watch(file, file); - }); -} - -/** -* Write the given sourcemap. -*/ - -function writeSourcemap(file, sourcemap) { - var path = createPath(file, true); - - mkdirSync(dirname(path), { recursive: true }) - - fs.writeFile(path, JSON.stringify(sourcemap), function(err){ - if (err) throw err; - // don't output log message if --print is present - if (!print) console.log(' \033[90mgenerated\033[0m %s', path); - }); -} - -/** - * Watch the given `file` and recompiling `rootFile` when modified. - */ - -function watch(file, rootFile) { - // not watching - if (!watchers) return; - - // already watched - if (watchers[file]) { - watchers[file][rootFile] = true; - return; - } - - // watch the file itself - watchers[file] = {}; - watchers[file][rootFile] = true; - if (print) { - console.error('Stylus CLI Error: Watch and print cannot be used together'); - process.exit(1); - } - if(!quiet){ - console.log(' \033[90mwatching\033[0m %s', file); - } - // if is windows use fs.watch api instead - // TODO: remove watchFile when fs.watch() works on osx etc - if (isWindows) { - fs.watch(file, compile); - } else { - fs.watchFile(file, { interval: 300 }, function(curr, prev) { - if (curr.mtime > prev.mtime) compile(); - }); - } - - function compile() { - for (var rootFile in watchers[file]) { - compileFile(rootFile); - } - } -} - -/** - * Watch `imports`, re-compiling `file` when they change. - */ - -function watchImports(file, imports) { - imports.forEach(function(imported){ - if (!imported.path) return; - watch(imported.path, file); - }); -} - -/** - * Utilize plugins. - */ - -function usePlugins(style) { - plugins.forEach(function(plugin){ - var path = plugin.path; - var options = plugin.options; - fn = require(/^\.+\//.test(path) ? resolve(path) : path); - if ('function' != typeof fn) { - throw new Error('plugin ' + path + ' does not export a function'); - } - style.use(fn(options)); - }); - - if (urlFunction) { - style.define('url', stylus.url(urlFunction)); - } else if (resolveURL) { - style.define('url', stylus.resolver(resolveURL)); - } -} - -/** - * Imports the indicated files. - */ - -function importFiles(style) { - imports.forEach(function(file) { - style.import(file); - }); -} diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/index.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/index.js deleted file mode 100644 index ff73c82f..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lib/stylus'); diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/browserify.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/browserify.js deleted file mode 100644 index 8024acd4..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/browserify.js +++ /dev/null @@ -1,2 +0,0 @@ - -module.exports = require('./stylus'); diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/cache/fs.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/cache/fs.js deleted file mode 100644 index baf49f34..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/cache/fs.js +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Module dependencies. - */ - -var crypto = require('crypto') - , fs = require('fs') - , join = require('path').join - , version = require('../../package').version - , nodes = require('../nodes'); - -var FSCache = module.exports = function(options) { - options = options || {}; - this._location = options['cache location'] || '.styl-cache'; - if (!fs.existsSync(this._location)) fs.mkdirSync(this._location); -}; - -/** - * Set cache item with given `key` to `value`. - * - * @param {String} key - * @param {Object} value - * @api private - */ - -FSCache.prototype.set = function(key, value) { - fs.writeFileSync(join(this._location, key), JSON.stringify(value)); -}; - -/** - * Get cache item with given `key`. - * - * @param {String} key - * @return {Object} - * @api private - */ - -FSCache.prototype.get = function(key) { - var data = fs.readFileSync(join(this._location, key), 'utf-8'); - return JSON.parse(data, FSCache.fromJSON); -}; - -/** - * Check if cache has given `key`. - * - * @param {String} key - * @return {Boolean} - * @api private - */ - -FSCache.prototype.has = function(key) { - return fs.existsSync(join(this._location, key)); -}; - -/** - * Generate key for the source `str` with `options`. - * - * @param {String} str - * @param {Object} options - * @return {String} - * @api private - */ - -FSCache.prototype.key = function(str, options) { - var hash = crypto.createHash('sha1'); - hash.update(str + version + options.prefix); - return hash.digest('hex'); -}; - -/** - * JSON to Stylus nodes converter. - * - * @api private - */ - -FSCache.fromJSON = function(key, val) { - if (val && val.__type) { - val.__proto__ = nodes[val.__type].prototype; - } - return val; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/cache/index.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/cache/index.js deleted file mode 100644 index 2fa4ec5d..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/cache/index.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Get cache object by `name`. - * - * @param {String|Function} name - * @param {Object} options - * @return {Object} - * @api private - */ - -var getCache = module.exports = function(name, options){ - if ('function' == typeof name) return new name(options); - - var cache; - switch (name){ - // case 'fs': - // cache = require('./fs') - // break; - case 'memory': - cache = require('./memory'); - break; - default: - cache = require('./null'); - } - return new cache(options); -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/cache/memory.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/cache/memory.js deleted file mode 100644 index b273265d..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/cache/memory.js +++ /dev/null @@ -1,116 +0,0 @@ -/** - * Module dependencies. - */ - -var crypto = require('crypto') - , nodes = require('../nodes'); - -var MemoryCache = module.exports = function(options) { - options = options || {}; - this.limit = options['cache limit'] || 256; - this._cache = {}; - this.length = 0; - this.head = this.tail = null; -}; - -/** - * Set cache item with given `key` to `value`. - * - * @param {String} key - * @param {Object} value - * @api private - */ - -MemoryCache.prototype.set = function(key, value) { - var clone = value.clone() - , item; - - clone.filename = nodes.filename; - clone.lineno = nodes.lineno; - clone.column = nodes.column; - item = { key: key, value: clone }; - this._cache[key] = item; - - if (this.tail) { - this.tail.next = item; - item.prev = this.tail; - } else { - this.head = item; - } - - this.tail = item; - if (this.length++ == this.limit) this.purge(); -}; - -/** - * Get cache item with given `key`. - * - * @param {String} key - * @return {Object} - * @api private - */ - -MemoryCache.prototype.get = function(key) { - var item = this._cache[key] - , val = item.value.clone(); - - if (item == this.tail) return val; - if (item.next) { - if (item == this.head) this.head = item.next; - item.next.prev = item.prev; - } - if (item.prev) item.prev.next = item.next; - - item.next = null; - item.prev = this.tail; - - if (this.tail) this.tail.next = item; - this.tail = item; - - return val; -}; - -/** - * Check if cache has given `key`. - * - * @param {String} key - * @return {Boolean} - * @api private - */ - -MemoryCache.prototype.has = function(key) { - return !!this._cache[key]; -}; - -/** - * Generate key for the source `str` with `options`. - * - * @param {String} str - * @param {Object} options - * @return {String} - * @api private - */ - -MemoryCache.prototype.key = function(str, options) { - var hash = crypto.createHash('sha1'); - hash.update(str + options.prefix); - return hash.digest('hex'); -}; - -/** - * Remove the oldest item from the cache. - * - * @api private - */ - -MemoryCache.prototype.purge = function() { - var item = this.head; - - if (this.head.next) { - this.head = this.head.next; - this.head.prev = null; - } - - this._cache[item.key] = item.prev = item.next = null; - this.length--; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/cache/null.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/cache/null.js deleted file mode 100644 index 0b418214..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/cache/null.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Module dependencies. - */ - -var NullCache = module.exports = function() {}; - -/** - * Set cache item with given `key` to `value`. - * - * @param {String} key - * @param {Object} value - * @api private - */ - -NullCache.prototype.set = function(key, value) {}; - -/** - * Get cache item with given `key`. - * - * @param {String} key - * @return {Object} - * @api private - */ - -NullCache.prototype.get = function(key) {}; - -/** - * Check if cache has given `key`. - * - * @param {String} key - * @return {Boolean} - * @api private - */ - -NullCache.prototype.has = function(key) { - return false; -}; - -/** - * Generate key for the source `str` with `options`. - * - * @param {String} str - * @param {Object} options - * @return {String} - * @api private - */ - -NullCache.prototype.key = function(str, options) { - return ''; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/colors.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/colors.js deleted file mode 100644 index 16230388..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/colors.js +++ /dev/null @@ -1,158 +0,0 @@ - -/*! - * Stylus - colors - * Copyright (c) Automattic - * MIT Licensed - */ - -module.exports = { - aliceblue: [240, 248, 255, 1] - , antiquewhite: [250, 235, 215, 1] - , aqua: [0, 255, 255, 1] - , aquamarine: [127, 255, 212, 1] - , azure: [240, 255, 255, 1] - , beige: [245, 245, 220, 1] - , bisque: [255, 228, 196, 1] - , black: [0, 0, 0, 1] - , blanchedalmond: [255, 235, 205, 1] - , blue: [0, 0, 255, 1] - , blueviolet: [138, 43, 226, 1] - , brown: [165, 42, 42, 1] - , burlywood: [222, 184, 135, 1] - , cadetblue: [95, 158, 160, 1] - , chartreuse: [127, 255, 0, 1] - , chocolate: [210, 105, 30, 1] - , coral: [255, 127, 80, 1] - , cornflowerblue: [100, 149, 237, 1] - , cornsilk: [255, 248, 220, 1] - , crimson: [220, 20, 60, 1] - , cyan: [0, 255, 255, 1] - , darkblue: [0, 0, 139, 1] - , darkcyan: [0, 139, 139, 1] - , darkgoldenrod: [184, 134, 11, 1] - , darkgray: [169, 169, 169, 1] - , darkgreen: [0, 100, 0, 1] - , darkgrey: [169, 169, 169, 1] - , darkkhaki: [189, 183, 107, 1] - , darkmagenta: [139, 0, 139, 1] - , darkolivegreen: [85, 107, 47, 1] - , darkorange: [255, 140, 0, 1] - , darkorchid: [153, 50, 204, 1] - , darkred: [139, 0, 0, 1] - , darksalmon: [233, 150, 122, 1] - , darkseagreen: [143, 188, 143, 1] - , darkslateblue: [72, 61, 139, 1] - , darkslategray: [47, 79, 79, 1] - , darkslategrey: [47, 79, 79, 1] - , darkturquoise: [0, 206, 209, 1] - , darkviolet: [148, 0, 211, 1] - , deeppink: [255, 20, 147, 1] - , deepskyblue: [0, 191, 255, 1] - , dimgray: [105, 105, 105, 1] - , dimgrey: [105, 105, 105, 1] - , dodgerblue: [30, 144, 255, 1] - , firebrick: [178, 34, 34, 1] - , floralwhite: [255, 250, 240, 1] - , forestgreen: [34, 139, 34, 1] - , fuchsia: [255, 0, 255, 1] - , gainsboro: [220, 220, 220, 1] - , ghostwhite: [248, 248, 255, 1] - , gold: [255, 215, 0, 1] - , goldenrod: [218, 165, 32, 1] - , gray: [128, 128, 128, 1] - , green: [0, 128, 0, 1] - , greenyellow: [173, 255, 47, 1] - , grey: [128, 128, 128, 1] - , honeydew: [240, 255, 240, 1] - , hotpink: [255, 105, 180, 1] - , indianred: [205, 92, 92, 1] - , indigo: [75, 0, 130, 1] - , ivory: [255, 255, 240, 1] - , khaki: [240, 230, 140, 1] - , lavender: [230, 230, 250, 1] - , lavenderblush: [255, 240, 245, 1] - , lawngreen: [124, 252, 0, 1] - , lemonchiffon: [255, 250, 205, 1] - , lightblue: [173, 216, 230, 1] - , lightcoral: [240, 128, 128, 1] - , lightcyan: [224, 255, 255, 1] - , lightgoldenrodyellow: [250, 250, 210, 1] - , lightgray: [211, 211, 211, 1] - , lightgreen: [144, 238, 144, 1] - , lightgrey: [211, 211, 211, 1] - , lightpink: [255, 182, 193, 1] - , lightsalmon: [255, 160, 122, 1] - , lightseagreen: [32, 178, 170, 1] - , lightskyblue: [135, 206, 250, 1] - , lightslategray: [119, 136, 153, 1] - , lightslategrey: [119, 136, 153, 1] - , lightsteelblue: [176, 196, 222, 1] - , lightyellow: [255, 255, 224, 1] - , lime: [0, 255, 0, 1] - , limegreen: [50, 205, 50, 1] - , linen: [250, 240, 230, 1] - , magenta: [255, 0, 255, 1] - , maroon: [128, 0, 0, 1] - , mediumaquamarine: [102, 205, 170, 1] - , mediumblue: [0, 0, 205, 1] - , mediumorchid: [186, 85, 211, 1] - , mediumpurple: [147, 112, 219, 1] - , mediumseagreen: [60, 179, 113, 1] - , mediumslateblue: [123, 104, 238, 1] - , mediumspringgreen: [0, 250, 154, 1] - , mediumturquoise: [72, 209, 204, 1] - , mediumvioletred: [199, 21, 133, 1] - , midnightblue: [25, 25, 112, 1] - , mintcream: [245, 255, 250, 1] - , mistyrose: [255, 228, 225, 1] - , moccasin: [255, 228, 181, 1] - , navajowhite: [255, 222, 173, 1] - , navy: [0, 0, 128, 1] - , oldlace: [253, 245, 230, 1] - , olive: [128, 128, 0, 1] - , olivedrab: [107, 142, 35, 1] - , orange: [255, 165, 0, 1] - , orangered: [255, 69, 0, 1] - , orchid: [218, 112, 214, 1] - , palegoldenrod: [238, 232, 170, 1] - , palegreen: [152, 251, 152, 1] - , paleturquoise: [175, 238, 238, 1] - , palevioletred: [219, 112, 147, 1] - , papayawhip: [255, 239, 213, 1] - , peachpuff: [255, 218, 185, 1] - , peru: [205, 133, 63, 1] - , pink: [255, 192, 203, 1] - , plum: [221, 160, 221, 1] - , powderblue: [176, 224, 230, 1] - , purple: [128, 0, 128, 1] - , red: [255, 0, 0, 1] - , rosybrown: [188, 143, 143, 1] - , royalblue: [65, 105, 225, 1] - , saddlebrown: [139, 69, 19, 1] - , salmon: [250, 128, 114, 1] - , sandybrown: [244, 164, 96, 1] - , seagreen: [46, 139, 87, 1] - , seashell: [255, 245, 238, 1] - , sienna: [160, 82, 45, 1] - , silver: [192, 192, 192, 1] - , skyblue: [135, 206, 235, 1] - , slateblue: [106, 90, 205, 1] - , slategray: [112, 128, 144, 1] - , slategrey: [112, 128, 144, 1] - , snow: [255, 250, 250, 1] - , springgreen: [0, 255, 127, 1] - , steelblue: [70, 130, 180, 1] - , tan: [210, 180, 140, 1] - , teal: [0, 128, 128, 1] - , thistle: [216, 191, 216, 1] - , tomato: [255, 99, 71, 1] - , transparent: [0, 0, 0, 0] - , turquoise: [64, 224, 208, 1] - , violet: [238, 130, 238, 1] - , wheat: [245, 222, 179, 1] - , white: [255, 255, 255, 1] - , whitesmoke: [245, 245, 245, 1] - , yellow: [255, 255, 0, 1] - , yellowgreen: [154, 205, 50, 1] - , rebeccapurple: [102, 51, 153, 1] -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/convert/css.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/convert/css.js deleted file mode 100644 index eb4e2278..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/convert/css.js +++ /dev/null @@ -1,328 +0,0 @@ -/*! - * Stylus - CSS to Stylus conversion - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Convert the given `css` to Stylus source. - * - * @param {String} css - * @return {String} - * @api public - */ - -module.exports = function(css){ - return new Converter(css).stylus(); -}; - -/** - * Initialize a new `Converter` with the given `css`. - * - * @param {String} css - * @api private - */ - -function Converter(css) { - var { parse } = require('@adobe/css-tools'); - this.css = css; - this.root = parse(css, { position: false }); - this.indents = 0; -} - -/** - * Convert to Stylus. - * - * @return {String} - * @api private - */ - -Converter.prototype.stylus = function(){ - return this.visitRules(this.root.stylesheet.rules); -}; - -/** - * Return indent string. - * - * @return {String} - * @api private - */ - -Converter.prototype.__defineGetter__('indent', function(){ - return Array(this.indents + 1).join(' '); -}); - -/** - * Visit `node`. - * - * @param {*} node - * @return {String} - * @api private - */ - -Converter.prototype.visit = function(node){ - switch (node.type) { - case 'rule': - case 'comment': - case 'charset': - case 'namespace': - case 'media': - case 'import': - case 'document': - case 'keyframes': - case 'page': - case 'host': - case 'supports': - var name = node.type[0].toUpperCase() + node.type.slice(1); - return this['visit' + name](node); - case 'font-face': - return this.visitFontFace(node); - } -}; - -/** - * Visit the rules on `node`. - * - * @param {Array} node - * @return {String} - * @api private - */ - -Converter.prototype.visitRules = function(node){ - var buf = ''; - for (var i = 0, len = node.length; i < len; ++i) { - buf += this.visit(node[i]); - } - return buf; -}; - -/** - * Visit FontFace `node`. - * - * @param {FontFace} node - * @return {String} - * @api private - */ - - Converter.prototype.visitFontFace = function(node){ - var buf = this.indent + '@font-face'; - buf += '\n'; - ++this.indents; - for (var i = 0, len = node.declarations.length; i < len; ++i) { - buf += this.visitDeclaration(node.declarations[i]); - } - --this.indents; - return buf; - }; - -/** - * Visit Media `node`. - * - * @param {Media} node - * @return {String} - * @api private - */ - -Converter.prototype.visitMedia = function(node){ - var buf = this.indent + '@media ' + node.media; - buf += '\n'; - ++this.indents; - buf += this.visitRules(node.rules); - --this.indents; - return buf; -}; - -/** - * Visit Declaration `node`. - * - * @param {Declaration} node - * @return {String} - * @api private - */ - -Converter.prototype.visitDeclaration = function(node){ - if ('comment' == node.type) { - return this.visitComment(node); - } else { - var buf = this.indent + node.property + ': ' + node.value + '\n'; - return buf; - } -}; - -/** - * Visit Rule `node`.` - * - * @param {Rule} node - * @return {String} - * @api private - */ - -Converter.prototype.visitRule = function(node){ - var buf = this.indent + node.selectors.join(',\n' + this.indent) + '\n'; - ++this.indents; - for (var i = 0, len = node.declarations.length; i < len; ++i) { - buf += this.visitDeclaration(node.declarations[i]); - } - --this.indents; - return buf + '\n'; -}; - -/** - * Visit Comment `node`.` - * - * @param {Comment} node - * @return {String} - * @api private - */ - -Converter.prototype.visitComment = function(node){ - var buf = this.indent + '/*' + node.comment + '*/'; - return buf + '\n'; -}; - -/** - * Visit Charset `node`.` - * - * @param {Charset} node - * @return {String} - * @api private - */ - -Converter.prototype.visitCharset = function(node){ - var buf = this.indent + '@charset ' + node.charset; - return buf + '\n'; -}; - -/** - * Visit Namespace `node`.` - * - * @param {Namespace} node - * @return {String} - * @api private - */ - -Converter.prototype.visitNamespace = function(node){ - var buf = this.indent + '@namespace ' + node.namespace; - return buf + '\n'; -}; - -/** - * Visit Import `node`.` - * - * @param {Import} node - * @return {String} - * @api private - */ - -Converter.prototype.visitImport = function(node){ - var buf = this.indent + '@import ' + node.import; - return buf + '\n'; -}; - -/** - * Visit Document `node`.` - * - * @param {Document} node - * @return {String} - * @api private - */ - -Converter.prototype.visitDocument = function(node){ - var buf = this.indent + '@' + node.vendor + 'document ' + node.document; - buf += '\n'; - ++this.indents; - buf += this.visitRules(node.rules); - --this.indents; - return buf; -}; - -/** - * Visit Keyframes `node`.` - * - * @param {Keyframes} node - * @return {String} - * @api private - */ - -Converter.prototype.visitKeyframes = function(node){ - var buf = this.indent + '@keyframes ' + node.name; - buf += '\n'; - ++this.indents; - for (var i = 0, len = node.keyframes.length; i < len; ++i) { - buf += this.visitKeyframe(node.keyframes[i]); - } - --this.indents; - return buf; -}; - -/** - * Visit Keyframe `node`.` - * - * @param {Keyframe} node - * @return {String} - * @api private - */ - -Converter.prototype.visitKeyframe = function(node){ - var buf = this.indent + node.values.join(', '); - buf += '\n'; - ++this.indents; - for (var i = 0, len = node.declarations.length; i < len; ++i) { - buf += this.visitDeclaration(node.declarations[i]); - } - --this.indents; - return buf; -}; - -/** - * Visit Page `node`.` - * - * @param {Page} node - * @return {String} - * @api private - */ - -Converter.prototype.visitPage = function(node){ - var buf = this.indent + '@page' + (node.selectors.length ? ' ' + node.selectors.join(', ') : ''); - buf += '\n'; - ++this.indents; - for (var i = 0, len = node.declarations.length; i < len; ++i) { - buf += this.visitDeclaration(node.declarations[i]); - } - --this.indents; - return buf; -}; - -/** - * Visit Supports `node`.` - * - * @param {Supports} node - * @return {String} - * @api private - */ - -Converter.prototype.visitSupports = function(node){ - var buf = this.indent + '@supports ' + node.supports; - buf += '\n'; - ++this.indents; - buf += this.visitRules(node.rules); - --this.indents; - return buf; -}; - -/** - * Visit Host `node`.` - * - * @param {Host} node - * @return {String} - * @api private - */ - -Converter.prototype.visitHost = function(node){ - var buf = this.indent + '@host'; - buf += '\n'; - ++this.indents; - buf += this.visitRules(node.rules); - --this.indents; - return buf; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/errors.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/errors.js deleted file mode 100644 index 7bc627c5..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/errors.js +++ /dev/null @@ -1,55 +0,0 @@ - -/*! - * Stylus - errors - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Expose constructors. - */ - -exports.ParseError = ParseError; -exports.SyntaxError = SyntaxError; - -/** - * Initialize a new `ParseError` with the given `msg`. - * - * @param {String} msg - * @api private - */ - -function ParseError(msg) { - this.name = 'ParseError'; - this.message = msg; - if (Error.captureStackTrace) { - Error.captureStackTrace(this, ParseError); - } -} - -/** - * Inherit from `Error.prototype`. - */ - -ParseError.prototype.__proto__ = Error.prototype; - -/** - * Initialize a new `SyntaxError` with the given `msg`. - * - * @param {String} msg - * @api private - */ - -function SyntaxError(msg) { - this.name = 'SyntaxError'; - this.message = msg; - if (Error.captureStackTrace) { - Error.captureStackTrace(this, ParseError); - } -} - -/** - * Inherit from `Error.prototype`. - */ - -SyntaxError.prototype.__proto__ = Error.prototype; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/acos.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/acos.js deleted file mode 100644 index 9b901917..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/acos.js +++ /dev/null @@ -1,19 +0,0 @@ -var nodes = require('../nodes') - , convert = require('./convert-angle') - , asin = require('./asin'); - -/** - * Return the arccosine of the given `value`. - * - * @param {Double} trigValue - * @param {Unit} output - * @return {Unit} - * @api public - */ -module.exports = function acos(trigValue, output) { - var output = typeof output !== 'undefined' ? output : 'deg'; - var convertedValue = convert(Math.PI / 2, output) - asin(trigValue, output).val; - var m = Math.pow(10, 9); - convertedValue = Math.round(convertedValue * m) / m; - return new nodes.Unit(convertedValue, output); -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/add-property.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/add-property.js deleted file mode 100644 index 1d86c923..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/add-property.js +++ /dev/null @@ -1,29 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes'); - -/** - * Add property `name` with the given `expr` - * to the mixin-able block. - * - * @param {String|Ident|Literal} name - * @param {Expression} expr - * @return {Property} - * @api public - */ - -(module.exports = function addProperty(name, expr){ - utils.assertType(name, 'expression', 'name'); - name = utils.unwrap(name).first; - utils.assertString(name, 'name'); - utils.assertType(expr, 'expression', 'expr'); - var prop = new nodes.Property([name], expr); - var block = this.closestBlock; - - var len = block.nodes.length - , head = block.nodes.slice(0, block.index) - , tail = block.nodes.slice(block.index++, len); - head.push(prop); - block.nodes = head.concat(tail); - - return prop; -}).raw = true; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/adjust.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/adjust.js deleted file mode 100644 index 3137634c..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/adjust.js +++ /dev/null @@ -1,30 +0,0 @@ -var utils = require('../utils'); - -/** - * Adjust HSL `color` `prop` by `amount`. - * - * @param {RGBA|HSLA} color - * @param {String} prop - * @param {Unit} amount - * @return {RGBA} - * @api private - */ - -function adjust(color, prop, amount){ - utils.assertColor(color, 'color'); - utils.assertString(prop, 'prop'); - utils.assertType(amount, 'unit', 'amount'); - var hsl = color.hsla.clone(); - prop = { hue: 'h', saturation: 's', lightness: 'l' }[prop.string]; - if (!prop) throw new Error('invalid adjustment property'); - var val = amount.val; - if ('%' == amount.type){ - val = 'l' == prop && val > 0 - ? (100 - hsl[prop]) * val / 100 - : hsl[prop] * (val / 100); - } - hsl[prop] += val; - return hsl.rgba; -}; -adjust.params = ['color', 'prop', 'amount']; -module.exports = adjust; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/alpha.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/alpha.js deleted file mode 100644 index c4ddc63e..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/alpha.js +++ /dev/null @@ -1,38 +0,0 @@ -var nodes = require('../nodes') - , rgba = require('./rgba'); - -/** - * Return the alpha component of the given `color`, - * or set the alpha component to the optional second `value` argument. - * - * Examples: - * - * alpha(#fff) - * // => 1 - * - * alpha(rgba(0,0,0,0.3)) - * // => 0.3 - * - * alpha(#fff, 0.5) - * // => rgba(255,255,255,0.5) - * - * @param {RGBA|HSLA} color - * @param {Unit} [value] - * @return {Unit|RGBA} - * @api public - */ - -function alpha(color, value){ - color = color.rgba; - if (value) { - return rgba( - new nodes.Unit(color.r), - new nodes.Unit(color.g), - new nodes.Unit(color.b), - value - ); - } - return new nodes.Unit(color.a, ''); -}; -alpha.params = ['color', 'value']; -module.exports = alpha; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/asin.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/asin.js deleted file mode 100644 index f21f7091..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/asin.js +++ /dev/null @@ -1,20 +0,0 @@ -var nodes = require('../nodes') - , convert = require('./convert-angle'); - -/** - * Return the arcsine of the given `value`. - * - * @param {Double} trigValue - * @param {Unit} output - * @return {Unit} - * @api public - */ - -module.exports = function atan(trigValue, output) { - var output = typeof output !== 'undefined' ? output : 'deg'; - var m = Math.pow(10, 9); - var value = Math.asin(trigValue) ; - var convertedValue = convert(value, output); - convertedValue = Math.round(convertedValue * m) / m; - return new nodes.Unit(convertedValue, output); -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/atan.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/atan.js deleted file mode 100644 index ae21aece..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/atan.js +++ /dev/null @@ -1,20 +0,0 @@ -var nodes = require('../nodes') - , convert = require('./convert-angle'); - -/** - * Return the arctangent of the given `value`. - * - * @param {Double} trigValue - * @param {Unit} output - * @return {Unit} - * @api public - */ - -module.exports = function atan(trigValue, output) { - var output = typeof output !== 'undefined' ? output : 'deg'; - var value = Math.atan(trigValue) ; - var m = Math.pow(10, 9); - var convertedValue = convert(value, output); - convertedValue = Math.round(convertedValue * m) / m; - return new nodes.Unit(convertedValue, output); -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/base-convert.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/base-convert.js deleted file mode 100644 index 06a3b289..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/base-convert.js +++ /dev/null @@ -1,26 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes'); - -/** - * Return a `Literal` `num` converted to the provided `base`, padded to `width` - * with zeroes (default width is 2) - * - * @param {Number} num - * @param {Number} base - * @param {Number} width - * @return {Literal} - * @api public - */ - -(module.exports = function(num, base, width) { - utils.assertPresent(num, 'number'); - utils.assertPresent(base, 'base'); - num = utils.unwrap(num).nodes[0].val; - base = utils.unwrap(base).nodes[0].val; - width = (width && utils.unwrap(width).nodes[0].val) || 2; - var result = Number(num).toString(base); - while (result.length < width) { - result = '0' + result; - } - return new nodes.Literal(result); -}).raw = true; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/basename.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/basename.js deleted file mode 100644 index ec00701d..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/basename.js +++ /dev/null @@ -1,17 +0,0 @@ -var utils = require('../utils') - , path = require('path'); - -/** - * Return the basename of `path`. - * - * @param {String} path - * @return {String} - * @api public - */ - -function basename(p, ext){ - utils.assertString(p, 'path'); - return path.basename(p.val, ext && ext.val); -}; -basename.params = ['p', 'ext']; -module.exports = basename; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/blend.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/blend.js deleted file mode 100644 index 61b507df..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/blend.js +++ /dev/null @@ -1,39 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes'); - -/** - * Blend the `top` color over the `bottom` - * - * Examples: - * - * blend(rgba(#FFF, 0.5), #000) - * // => #808080 - * - * blend(rgba(#FFDE00,.42), #19C261) - * // => #7ace38 - * - * blend(rgba(lime, 0.5), rgba(red, 0.25)) - * // => rgba(128,128,0,0.625) - * - * @param {RGBA|HSLA} top - * @param {RGBA|HSLA} [bottom=#fff] - * @return {RGBA} - * @api public - */ - -function blend(top, bottom){ - // TODO: different blend modes like overlay etc. - utils.assertColor(top); - top = top.rgba; - bottom = bottom || new nodes.RGBA(255, 255, 255, 1); - utils.assertColor(bottom); - bottom = bottom.rgba; - - return new nodes.RGBA( - top.r * top.a + bottom.r * (1 - top.a), - top.g * top.a + bottom.g * (1 - top.a), - top.b * top.a + bottom.b * (1 - top.a), - top.a + bottom.a - top.a * bottom.a); -}; -blend.params = ['top', 'bottom']; -module.exports = blend; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/blue.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/blue.js deleted file mode 100644 index 36302f65..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/blue.js +++ /dev/null @@ -1,35 +0,0 @@ -var nodes = require('../nodes') - , rgba = require('./rgba'); - -/** - * Return the blue component of the given `color`, - * or set the blue component to the optional second `value` argument. - * - * Examples: - * - * blue(#00c) - * // => 204 - * - * blue(#000, 255) - * // => #00f - * - * @param {RGBA|HSLA} color - * @param {Unit} [value] - * @return {Unit|RGBA} - * @api public - */ - -function blue(color, value){ - color = color.rgba; - if (value) { - return rgba( - new nodes.Unit(color.r), - new nodes.Unit(color.g), - value, - new nodes.Unit(color.a) - ); - } - return new nodes.Unit(color.b, ''); -}; -blue.params = ['color', 'value']; -module.exports = blue; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/clone.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/clone.js deleted file mode 100644 index 00889289..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/clone.js +++ /dev/null @@ -1,14 +0,0 @@ -var utils = require('../utils'); - -/** - * Return a clone of the given `expr`. - * - * @param {Expression} expr - * @return {Node} - * @api public - */ - -(module.exports = function clone(expr){ - utils.assertPresent(expr, 'expr'); - return expr.clone(); -}).raw = true; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/component.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/component.js deleted file mode 100644 index e21f7f25..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/component.js +++ /dev/null @@ -1,62 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes'); - -/** - * Color component name map. - */ - -var componentMap = { - red: 'r' - , green: 'g' - , blue: 'b' - , alpha: 'a' - , hue: 'h' - , saturation: 's' - , lightness: 'l' -}; - -/** - * Color component unit type map. - */ - -var unitMap = { - hue: 'deg' - , saturation: '%' - , lightness: '%' -}; - -/** - * Color type map. - */ - -var typeMap = { - red: 'rgba' - , blue: 'rgba' - , green: 'rgba' - , alpha: 'rgba' - , hue: 'hsla' - , saturation: 'hsla' - , lightness: 'hsla' -}; - -/** - * Return component `name` for the given `color`. - * - * @param {RGBA|HSLA} color - * @param {String} name - * @return {Unit} - * @api public - */ - -function component(color, name) { - utils.assertColor(color, 'color'); - utils.assertString(name, 'name'); - var name = name.string - , unit = unitMap[name] - , type = typeMap[name] - , name = componentMap[name]; - if (!name) throw new Error('invalid color component "' + name + '"'); - return new nodes.Unit(color[type][name], unit); -}; -component.params = ['color', 'name']; -module.exports = component; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/contrast.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/contrast.js deleted file mode 100644 index 7f8feb7e..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/contrast.js +++ /dev/null @@ -1,77 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes') - , blend = require('./blend') - , luminosity = require('./luminosity'); - -/** - * Returns the contrast ratio object between `top` and `bottom` colors, - * based on http://leaverou.github.io/contrast-ratio/ - * and https://github.com/LeaVerou/contrast-ratio/blob/gh-pages/color.js#L108 - * - * Examples: - * - * contrast(#000, #fff).ratio - * => 21 - * - * contrast(#000, rgba(#FFF, 0.5)) - * => { "ratio": "13.15;", "error": "7.85", "min": "5.3", "max": "21" } - * - * @param {RGBA|HSLA} top - * @param {RGBA|HSLA} [bottom=#fff] - * @return {Object} - * @api public - */ - -function contrast(top, bottom){ - if ('rgba' != top.nodeName && 'hsla' != top.nodeName) { - return new nodes.Literal('contrast(' + (top.isNull ? '' : top.toString()) + ')'); - } - var result = new nodes.Object(); - top = top.rgba; - bottom = bottom || new nodes.RGBA(255, 255, 255, 1); - utils.assertColor(bottom); - bottom = bottom.rgba; - function contrast(top, bottom) { - if (1 > top.a) { - top = blend(top, bottom); - } - var l1 = luminosity(bottom).val + 0.05 - , l2 = luminosity(top).val + 0.05 - , ratio = l1 / l2; - - if (l2 > l1) { - ratio = 1 / ratio; - } - return Math.round(ratio * 10) / 10; - } - - if (1 <= bottom.a) { - var resultRatio = new nodes.Unit(contrast(top, bottom)); - result.set('ratio', resultRatio); - result.set('error', new nodes.Unit(0)); - result.set('min', resultRatio); - result.set('max', resultRatio); - } else { - var onBlack = contrast(top, blend(bottom, new nodes.RGBA(0, 0, 0, 1))) - , onWhite = contrast(top, blend(bottom, new nodes.RGBA(255, 255, 255, 1))) - , max = Math.max(onBlack, onWhite); - function processChannel(topChannel, bottomChannel) { - return Math.min(Math.max(0, (topChannel - bottomChannel * bottom.a) / (1 - bottom.a)), 255); - } - var closest = new nodes.RGBA( - processChannel(top.r, bottom.r), - processChannel(top.g, bottom.g), - processChannel(top.b, bottom.b), - 1 - ); - var min = contrast(top, blend(bottom, closest)); - - result.set('ratio', new nodes.Unit(Math.round((min + max) * 50) / 100)); - result.set('error', new nodes.Unit(Math.round((max - min) * 50) / 100)); - result.set('min', new nodes.Unit(min)); - result.set('max', new nodes.Unit(max)); - } - return result; -} -contrast.params = ['top', 'bottom']; -module.exports = contrast; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/convert-angle.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/convert-angle.js deleted file mode 100644 index f834943b..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/convert-angle.js +++ /dev/null @@ -1,19 +0,0 @@ - -/** - * Convert given value's base into the parameter unitName - * - * @param {Double} value - * @param {String} unitName - * @return {Double} - * @api private - */ - -module.exports = function convertAngle(value, unitName) { - var factors = { - "rad" : 1, - "deg" : 180 / Math.PI, - "turn": 0.5 / Math.PI, - "grad": 200 / Math.PI - } - return value * factors[unitName]; -} diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/convert.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/convert.js deleted file mode 100644 index 22ca8c35..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/convert.js +++ /dev/null @@ -1,17 +0,0 @@ -var utils = require('../utils'); - -/** - * Like `unquote` but tries to convert - * the given `str` to a Stylus node. - * - * @param {String} str - * @return {Node} - * @api public - */ - -function convert(str){ - utils.assertString(str, 'str'); - return utils.parseString(str.string); -}; -convert.params = ['str']; -module.exports = convert; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/current-media.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/current-media.js deleted file mode 100644 index 595a7e69..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/current-media.js +++ /dev/null @@ -1,22 +0,0 @@ -var nodes = require('../nodes'); - -/** - * Returns the @media string for the current block - * - * @return {String} - * @api public - */ - -module.exports = function currentMedia(){ - var self = this; - return new nodes.String(lookForMedia(this.closestBlock.node) || ''); - - function lookForMedia(node){ - if ('media' == node.nodeName) { - node.val = self.visit(node.val); - return node.toString(); - } else if (node.block.parent.node) { - return lookForMedia(node.block.parent.node); - } - } -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/define.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/define.js deleted file mode 100644 index 74cd9c14..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/define.js +++ /dev/null @@ -1,25 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes'); - -/** - * Set a variable `name` on current scope. - * - * @param {String} name - * @param {Expression} expr - * @param {Boolean} [global] - * @api public - */ - -function define(name, expr, global){ - utils.assertType(name, 'string', 'name'); - expr = utils.unwrap(expr); - var scope = this.currentScope; - if (global && global.toBoolean().isTrue) { - scope = this.global.scope; - } - var node = new nodes.Ident(name.val, expr); - scope.add(node); - return nodes.null; -}; -define.params = ['name', 'expr', 'global']; -module.exports = define; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/dirname.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/dirname.js deleted file mode 100644 index db2eecdb..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/dirname.js +++ /dev/null @@ -1,17 +0,0 @@ -var utils = require('../utils') - , path = require('path'); - -/** - * Return the dirname of `path`. - * - * @param {String} path - * @return {String} - * @api public - */ - -function dirname(p){ - utils.assertString(p, 'path'); - return path.dirname(p.val).replace(/\\/g, '/'); -}; -dirname.params = ['p']; -module.exports = dirname; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/error.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/error.js deleted file mode 100644 index 953cd652..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/error.js +++ /dev/null @@ -1,17 +0,0 @@ -var utils = require('../utils'); - -/** - * Throw an error with the given `msg`. - * - * @param {String} msg - * @api public - */ - -function error(msg){ - utils.assertType(msg, 'string', 'msg'); - var err = new Error(msg.val); - err.fromStylus = true; - throw err; -}; -error.params = ['msg']; -module.exports = error; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/extname.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/extname.js deleted file mode 100644 index 3b4497a3..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/extname.js +++ /dev/null @@ -1,17 +0,0 @@ -var utils = require('../utils') - , path = require('path'); - -/** - * Return the extname of `path`. - * - * @param {String} path - * @return {String} - * @api public - */ - -function extname(p){ - utils.assertString(p, 'path'); - return path.extname(p.val); -}; -extname.params = ['p']; -module.exports = extname; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/green.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/green.js deleted file mode 100644 index 3c7fa5f4..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/green.js +++ /dev/null @@ -1,35 +0,0 @@ -var nodes = require('../nodes') - , rgba = require('./rgba'); - -/** - * Return the green component of the given `color`, - * or set the green component to the optional second `value` argument. - * - * Examples: - * - * green(#0c0) - * // => 204 - * - * green(#000, 255) - * // => #0f0 - * - * @param {RGBA|HSLA} color - * @param {Unit} [value] - * @return {Unit|RGBA} - * @api public - */ - -function green(color, value){ - color = color.rgba; - if (value) { - return rgba( - new nodes.Unit(color.r), - value, - new nodes.Unit(color.b), - new nodes.Unit(color.a) - ); - } - return new nodes.Unit(color.g, ''); -}; -green.params = ['color', 'value']; -module.exports = green; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/hsl.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/hsl.js deleted file mode 100644 index 4a3465e5..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/hsl.js +++ /dev/null @@ -1,37 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes') - , hsla = require('./hsla'); - -/** - * Convert the given `color` to an `HSLA` node, - * or h,s,l component values. - * - * Examples: - * - * hsl(10, 50, 30) - * // => HSLA - * - * hsl(#ffcc00) - * // => HSLA - * - * @param {Unit|HSLA|RGBA} hue - * @param {Unit} saturation - * @param {Unit} lightness - * @return {HSLA} - * @api public - */ - -function hsl(hue, saturation, lightness){ - if (1 == arguments.length) { - utils.assertColor(hue, 'color'); - return hue.hsla; - } else { - return hsla( - hue - , saturation - , lightness - , new nodes.Unit(1)); - } -}; -hsl.params = ['hue', 'saturation', 'lightness']; -module.exports = hsl; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/hsla.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/hsla.js deleted file mode 100644 index 7c65c414..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/hsla.js +++ /dev/null @@ -1,55 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes'); - -/** - * Convert the given `color` to an `HSLA` node, - * or h,s,l,a component values. - * - * Examples: - * - * hsla(10deg, 50%, 30%, 0.5) - * // => HSLA - * - * hsla(#ffcc00) - * // => HSLA - * - * @param {RGBA|HSLA|Unit} hue - * @param {Unit} saturation - * @param {Unit} lightness - * @param {Unit} alpha - * @return {HSLA} - * @api public - */ - -function hsla(hue, saturation, lightness, alpha){ - switch (arguments.length) { - case 1: - utils.assertColor(hue); - return hue.hsla; - case 2: - utils.assertColor(hue); - var color = hue.hsla; - utils.assertType(saturation, 'unit', 'alpha'); - var alpha = saturation.clone(); - if ('%' == alpha.type) alpha.val /= 100; - return new nodes.HSLA( - color.h - , color.s - , color.l - , alpha.val); - default: - utils.assertType(hue, 'unit', 'hue'); - utils.assertType(saturation, 'unit', 'saturation'); - utils.assertType(lightness, 'unit', 'lightness'); - utils.assertType(alpha, 'unit', 'alpha'); - var alpha = alpha.clone(); - if (alpha && '%' == alpha.type) alpha.val /= 100; - return new nodes.HSLA( - hue.val - , saturation.val - , lightness.val - , alpha.val); - } -}; -hsla.params = ['hue', 'saturation', 'lightness', 'alpha']; -module.exports = hsla; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/hue.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/hue.js deleted file mode 100644 index 874adaa2..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/hue.js +++ /dev/null @@ -1,36 +0,0 @@ -var nodes = require('../nodes') - , hsla = require('./hsla') - , component = require('./component'); - -/** - * Return the hue component of the given `color`, - * or set the hue component to the optional second `value` argument. - * - * Examples: - * - * hue(#00c) - * // => 240deg - * - * hue(#00c, 90deg) - * // => #6c0 - * - * @param {RGBA|HSLA} color - * @param {Unit} [value] - * @return {Unit|RGBA} - * @api public - */ - -function hue(color, value){ - if (value) { - var hslaColor = color.hsla; - return hsla( - value, - new nodes.Unit(hslaColor.s), - new nodes.Unit(hslaColor.l), - new nodes.Unit(hslaColor.a) - ) - } - return component(color, new nodes.String('hue')); -}; -hue.params = ['color', 'value']; -module.exports = hue; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/image-size.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/image-size.js deleted file mode 100644 index beecc1de..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/image-size.js +++ /dev/null @@ -1,60 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes') - , Image = require('./image'); - -/** - * Return the width and height of the given `img` path. - * - * Examples: - * - * image-size('foo.png') - * // => 200px 100px - * - * image-size('foo.png')[0] - * // => 200px - * - * image-size('foo.png')[1] - * // => 100px - * - * Can be used to test if the image exists, - * using an optional argument set to `true` - * (without this argument this function throws error - * if there is no such image). - * - * Example: - * - * image-size('nosuchimage.png', true)[0] - * // => 0 - * - * @param {String} img - * @param {Boolean} ignoreErr - * @return {Expression} - * @api public - */ - -function imageSize(img, ignoreErr) { - utils.assertType(img, 'string', 'img'); - try { - var img = new Image(this, img.string); - } catch (err) { - if (ignoreErr) { - return [new nodes.Unit(0), new nodes.Unit(0)]; - } else { - throw err; - } - } - - // Read size - img.open(); - var size = img.size(); - img.close(); - - // Return (w h) - var expr = []; - expr.push(new nodes.Unit(size[0], 'px')); - expr.push(new nodes.Unit(size[1], 'px')); - - return expr; -}; -imageSize.params = ['img', 'ignoreErr']; -module.exports = imageSize; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/image.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/image.js deleted file mode 100644 index 70d242f4..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/image.js +++ /dev/null @@ -1,162 +0,0 @@ - - -/*! - * Stylus - plugin - url - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../utils') - , Buffer = require('buffer').Buffer - , fs = require('fs') - , path = require('path') - , sax = require('sax'); - -/** - * Initialize a new `Image` with the given `ctx` and `path. - * - * @param {Evaluator} ctx - * @param {String} path - * @api private - */ - -var Image = module.exports = function Image(ctx, path) { - this.ctx = ctx; - this.path = utils.lookup(path, ctx.paths); - if (!this.path) throw new Error('failed to locate file ' + path); -}; - -/** - * Open the image for reading. - * - * @api private - */ - -Image.prototype.open = function(){ - this.fd = fs.openSync(this.path, 'r'); - this.length = fs.fstatSync(this.fd).size; - this.extname = path.extname(this.path).slice(1); -}; - -/** - * Close the file. - * - * @api private - */ - -Image.prototype.close = function(){ - if (this.fd) fs.closeSync(this.fd); -}; - -/** - * Return the type of image, supports: - * - * - gif - * - png - * - jpeg - * - svg - * - * @return {String} - * @api private - */ - -Image.prototype.type = function(){ - var type - , buf = Buffer.alloc(4); - - fs.readSync(this.fd, buf, 0, 4, 0); - - // GIF - if (0x47 == buf[0] && 0x49 == buf[1] && 0x46 == buf[2]) type = 'gif'; - - // PNG - else if (0x50 == buf[1] && 0x4E == buf[2] && 0x47 == buf[3]) type = 'png'; - - // JPEG - else if (0xff == buf[0] && 0xd8 == buf[1]) type = 'jpeg'; - - // SVG - else if ('svg' == this.extname) type = this.extname; - - return type; -}; - -/** - * Return image dimensions `[width, height]`. - * - * @return {Array} - * @api private - */ - -Image.prototype.size = function(){ - var type = this.type() - , width - , height - , buf - , offset - , blockSize - , parser; - - function uint16(b) { return b[1] << 8 | b[0]; } - function uint32(b) { return b[0] << 24 | b[1] << 16 | b[2] << 8 | b[3]; } - - // Determine dimensions - switch (type) { - case 'jpeg': - buf = Buffer.alloc(this.length); - fs.readSync(this.fd, buf, 0, this.length, 0); - offset = 4; - blockSize = buf[offset] << 8 | buf[offset + 1]; - - while (offset < this.length) { - offset += blockSize; - if (offset >= this.length || 0xff != buf[offset]) break; - // SOF0 or SOF2 (progressive) - if (0xc0 == buf[offset + 1] || 0xc2 == buf[offset + 1]) { - height = buf[offset + 5] << 8 | buf[offset + 6]; - width = buf[offset + 7] << 8 | buf[offset + 8]; - } else { - offset += 2; - blockSize = buf[offset] << 8 | buf[offset + 1]; - } - } - break; - case 'png': - buf = Buffer.alloc(8); - // IHDR chunk width / height uint32_t big-endian - fs.readSync(this.fd, buf, 0, 8, 16); - width = uint32(buf); - height = uint32(buf.slice(4, 8)); - break; - case 'gif': - buf = Buffer.alloc(4); - // width / height uint16_t little-endian - fs.readSync(this.fd, buf, 0, 4, 6); - width = uint16(buf); - height = uint16(buf.slice(2, 4)); - break; - case 'svg': - offset = Math.min(this.length, 1024); - buf = Buffer.alloc(offset); - fs.readSync(this.fd, buf, 0, offset, 0); - buf = buf.toString('utf8'); - parser = sax.parser(true); - parser.onopentag = function(node) { - if ('svg' == node.name && node.attributes.width && node.attributes.height) { - width = parseInt(node.attributes.width, 10); - height = parseInt(node.attributes.height, 10); - } - }; - parser.write(buf).close(); - break; - } - - if ('number' != typeof width) throw new Error('failed to find width of "' + this.path + '"'); - if ('number' != typeof height) throw new Error('failed to find height of "' + this.path + '"'); - - return [width, height]; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/index.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/index.js deleted file mode 100644 index 3c5aa2de..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/index.js +++ /dev/null @@ -1,72 +0,0 @@ - -/*! - * Stylus - Evaluator - built-in functions - * Copyright (c) Automattic - * MIT Licensed - */ - -exports['add-property'] = require('./add-property'); -exports.adjust = require('./adjust'); -exports.alpha = require('./alpha'); -exports['base-convert'] = require('./base-convert'); -exports.basename = require('./basename'); -exports.blend = require('./blend'); -exports.blue = require('./blue'); -exports.clone = require('./clone'); -exports.component = require('./component'); -exports.contrast = require('./contrast'); -exports.convert = require('./convert'); -exports['current-media'] = require('./current-media'); -exports.define = require('./define'); -exports.dirname = require('./dirname'); -exports.error = require('./error'); -exports.extname = require('./extname'); -exports.green = require('./green'); -exports.hsl = require('./hsl'); -exports.hsla = require('./hsla'); -exports.hue = require('./hue'); -exports['image-size'] = require('./image-size'); -exports.json = require('./json'); -exports.length = require('./length'); -exports.lightness = require('./lightness'); -exports['list-separator'] = require('./list-separator'); -exports.lookup = require('./lookup'); -exports.luminosity = require('./luminosity'); -exports.match = require('./match'); -exports.math = require('./math'); -exports.merge = exports.extend = require('./merge'); -exports.operate = require('./operate'); -exports['opposite-position'] = require('./opposite-position'); -exports.p = require('./p'); -exports.pathjoin = require('./pathjoin'); -exports.pop = require('./pop'); -exports.push = exports.append = require('./push'); -exports.range = require('./range'); -exports.red = require('./red'); -exports.remove = require('./remove'); -exports.replace = require('./replace'); -exports.rgb = require('./rgb'); -exports.atan = require('./atan'); -exports.asin = require('./asin'); -exports.acos = require('./acos'); -exports.rgba = require('./rgba'); -exports.s = require('./s'); -exports.saturation = require('./saturation'); -exports['selector-exists'] = require('./selector-exists'); -exports.selector = require('./selector'); -exports.selectors = require('./selectors'); -exports.shift = require('./shift'); -exports.split = require('./split'); -exports.substr = require('./substr'); -exports.slice = require('./slice'); -exports.tan = require('./tan'); -exports.trace = require('./trace'); -exports.transparentify = require('./transparentify'); -exports.type = exports.typeof = exports['type-of'] = require('./type'); -exports.unit = require('./unit'); -exports.unquote = require('./unquote'); -exports.unshift = exports.prepend = require('./unshift'); -exports.use = require('./use'); -exports.warn = require('./warn'); -exports['-math-prop'] = require('./math-prop'); -exports['-prefix-classes'] = require('./prefix-classes'); diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/index.styl b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/index.styl deleted file mode 100644 index 6df88d56..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/index.styl +++ /dev/null @@ -1,297 +0,0 @@ -called-from = () - -vendors = moz webkit o ms official - -// stringify the given arg - --string(arg) - type(arg) + ' ' + arg - -// require a color - -require-color(color) - unless color is a 'color' - error('RGB or HSL value expected, got a ' + -string(color)) - -// require a unit - -require-unit(n) - unless n is a 'unit' - error('unit expected, got a ' + -string(n)) - -// require a string - -require-string(str) - unless str is a 'string' or str is a 'ident' - error('string expected, got a ' + -string(str)) - -// Math functions - -abs(n) { math(n, 'abs') } -min(a, b) { a < b ? a : b } -max(a, b) { a > b ? a : b } - -// Trigonometrics -PI = -math-prop('PI') - -radians-to-degrees(angle) - angle * (180 / PI) - -degrees-to-radians(angle) - angle * (PI / 180) - -sin(n) - n = unit(n) == 'deg' ? degrees-to-radians(unit(n, '')) : unit(n, '') - round(math(n, 'sin'), 9) - -cos(n) - n = unit(n) == 'deg' ? degrees-to-radians(unit(n, '')) : unit(n, '') - round(math(n, 'cos'), 9) - -// Rounding Math functions - -ceil(n, precision = 0) - multiplier = 10 ** precision - math(n * multiplier, 'ceil') / multiplier - -floor(n, precision = 0) - multiplier = 10 ** precision - math(n * multiplier, 'floor') / multiplier - -round(n, precision = 0) - multiplier = 10 ** precision - math(n * multiplier, 'round') / multiplier - -// return the sum of the given numbers - -sum(nums) - sum = 0 - sum += n for n in nums - -// return the average of the given numbers - -avg(nums) - sum(nums) / length(nums) - -// return a unitless number, or pass through - -remove-unit(n) - if typeof(n) is "unit" - unit(n, "") - else - n - -// convert a percent to a decimal, or pass through - -percent-to-decimal(n) - if unit(n) is "%" - remove-unit(n) / 100 - else - n - -// check if n is an odd number - -odd(n) - 1 == n % 2 - -// check if n is an even number - -even(n) - 0 == n % 2 - -// check if color is light - -light(color) - lightness(color) >= 50% - -// check if color is dark - -dark(color) - lightness(color) < 50% - -// desaturate color by amount - -desaturate(color, amount) - adjust(color, 'saturation', - amount) - -// saturate color by amount - -saturate(color = '', amount = 100%) - if color is a 'color' - adjust(color, 'saturation', amount) - else - unquote( "saturate(" + color + ")" ) - -// darken by the given amount - -darken(color, amount) - adjust(color, 'lightness', - amount) - -// lighten by the given amount - -lighten(color, amount) - adjust(color, 'lightness', amount) - -// decrease opacity by amount - -fade-out(color, amount) - color - rgba(black, percent-to-decimal(amount)) - -// increase opacity by amount - -fade-in(color, amount) - color + rgba(black, percent-to-decimal(amount)) - -// spin hue by a given amount - -spin(color, amount) - color + unit(amount, deg) - -// mix two colors by a given amount - -mix(color1, color2, weight = 50%) - unless weight in 0..100 - error("Weight must be between 0% and 100%") - - if length(color1) == 2 - weight = color1[0] - color1 = color1[1] - - else if length(color2) == 2 - weight = 100 - color2[0] - color2 = color2[1] - - require-color(color1) - require-color(color2) - - p = unit(weight / 100, '') - w = p * 2 - 1 - - a = alpha(color1) - alpha(color2) - - w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2 - w2 = 1 - w1 - - channels = (red(color1) red(color2)) (green(color1) green(color2)) (blue(color1) blue(color2)) - rgb = () - - for pair in channels - push(rgb, floor(pair[0] * w1 + pair[1] * w2)) - - a1 = alpha(color1) * p - a2 = alpha(color2) * (1 - p) - alpha = a1 + a2 - - rgba(rgb[0], rgb[1], rgb[2], alpha) - -// invert colors, leave alpha intact - -invert(color = '') - if color is a 'color' - rgba(#fff - color, alpha(color)) - else - unquote( "invert(" + color + ")" ) - -// give complement of the given color - -complement( color ) - spin( color, 180 ) - -// give grayscale of the given color - -grayscale( color = '' ) - if color is a 'color' - desaturate( color, 100% ) - else - unquote( "grayscale(" + color + ")" ) - -// mix the given color with white - -tint( color, percent ) - mix( white, color, percent ) - -// mix the given color with black - -shade( color, percent ) - mix( black, color, percent ) - -// return the last value in the given expr - -last(expr) - expr[length(expr) - 1] - -// return keys in the given pairs or object - -keys(pairs) - ret = () - if type(pairs) == 'object' - for key in pairs - push(ret, key) - else - for pair in pairs - push(ret, pair[0]); - ret - -// return values in the given pairs or object - -values(pairs) - ret = () - if type(pairs) == 'object' - for key, val in pairs - push(ret, val) - else - for pair in pairs - push(ret, pair[1]); - ret - -// join values with the given delimiter - -join(delim, vals...) - buf = '' - vals = vals[0] if length(vals) == 1 - for val, i in vals - buf += i ? delim + val : val - -// add a CSS rule to the containing block - -// - This definition allows add-property to be used as a mixin -// - It has the same effect as interpolation but allows users -// to opt for a functional style - -add-property-function = add-property -add-property(name, expr) - if mixin - {name} expr - else - add-property-function(name, expr) - -prefix-classes(prefix) - -prefix-classes(prefix, block) - -// Caching mixin, use inside your functions to enable caching by extending. - -$stylus_mixin_cache = {} -cache() - $key = (current-media() or 'no-media') + '__' + called-from[0] + '__' + arguments - if $key in $stylus_mixin_cache - @extend {"$cache_placeholder_for_" + $stylus_mixin_cache[$key]} - else if 'cache' in called-from - {block} - else - $id = length($stylus_mixin_cache) - - &, - /$cache_placeholder_for_{$id} - $stylus_mixin_cache[$key] = $id - {block} - -// Percentage function to convert a number, e.g. ".45", into a percentage, e.g. "45%" - -percentage(num) - return unit(num * 100, '%') - -// Returns the position of a `value` within a `list` - -index(list, value) - for val, i in list - return i if val == value diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/json.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/json.js deleted file mode 100644 index 85623683..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/json.js +++ /dev/null @@ -1,118 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes') - , readFile = require('fs').readFileSync; - -/** - * Convert a .json file into stylus variables or object. - * Nested variable object keys are joined with a dash (-) - * - * Given this sample media-queries.json file: - * { - * "small": "screen and (max-width:400px)", - * "tablet": { - * "landscape": "screen and (min-width:600px) and (orientation:landscape)", - * "portrait": "screen and (min-width:600px) and (orientation:portrait)" - * } - * } - * - * Examples: - * - * json('media-queries.json') - * - * @media small - * // => @media screen and (max-width:400px) - * - * @media tablet-landscape - * // => @media screen and (min-width:600px) and (orientation:landscape) - * - * vars = json('vars.json', { hash: true }) - * body - * width: vars.width - * - * @param {String} path - * @param {Boolean} [local] - * @param {String} [namePrefix] - * @api public -*/ - -function json(path, local, namePrefix){ - utils.assertString(path, 'path'); - - // lookup - path = path.string; - var found = utils.lookup(path, this.options.paths, this.options.filename) - , options = (local && 'object' == local.nodeName) && local; - - if (!found) { - // optional JSON file - if (options && options.get('optional').toBoolean().isTrue) { - return nodes.null; - } - throw new Error('failed to locate .json file ' + path); - } - - // read - var json = JSON.parse(readFile(found, 'utf8')); - - if (options) { - return convert(json, options); - } else { - oldJson.call(this, json, local, namePrefix); - } - - function convert(obj, options){ - var ret = new nodes.Object() - , leaveStrings = options.get('leave-strings').toBoolean(); - - for (var key in obj) { - var val = obj[key]; - if ('object' == typeof val) { - ret.set(key, convert(val, options)); - } else { - val = utils.coerce(val); - if ('string' == val.nodeName && leaveStrings.isFalse) { - val = utils.parseString(val.string); - } - ret.set(key, val); - } - } - return ret; - } -}; -json.params = ['path', 'local', 'namePrefix']; -module.exports = json; - -/** - * Old `json` BIF. - * - * @api private - */ - -function oldJson(json, local, namePrefix){ - if (namePrefix) { - utils.assertString(namePrefix, 'namePrefix'); - namePrefix = namePrefix.val; - } else { - namePrefix = ''; - } - local = local ? local.toBoolean() : new nodes.Boolean(local); - var scope = local.isTrue ? this.currentScope : this.global.scope; - - convert(json); - return; - - function convert(obj, prefix){ - prefix = prefix ? prefix + '-' : ''; - for (var key in obj){ - var val = obj[key]; - var name = prefix + key; - if ('object' == typeof val) { - convert(val, name); - } else { - val = utils.coerce(val); - if ('string' == val.nodeName) val = utils.parseString(val.string); - scope.add({ name: namePrefix + name, val: val }); - } - } - } -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/length.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/length.js deleted file mode 100644 index 3fb21c70..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/length.js +++ /dev/null @@ -1,27 +0,0 @@ -var utils = require('../utils'); - -/** - * Return length of the given `expr`. - * - * @param {Expression} expr - * @return {Unit} - * @api public - */ - -(module.exports = function length(expr){ - if (expr) { - if (expr.nodes) { - var nodes = utils.unwrap(expr).nodes; - if (1 == nodes.length && 'object' == nodes[0].nodeName) { - return nodes[0].length; - } else if (1 == nodes.length && 'string' == nodes[0].nodeName) { - return nodes[0].val.length; - } else { - return nodes.length; - } - } else { - return 1; - } - } - return 0; -}).raw = true; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/lightness.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/lightness.js deleted file mode 100644 index a15365cb..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/lightness.js +++ /dev/null @@ -1,36 +0,0 @@ -var nodes = require('../nodes') - , hsla = require('./hsla') - , component = require('./component'); - -/** - * Return the lightness component of the given `color`, - * or set the lightness component to the optional second `value` argument. - * - * Examples: - * - * lightness(#00c) - * // => 100% - * - * lightness(#00c, 80%) - * // => #99f - * - * @param {RGBA|HSLA} color - * @param {Unit} [value] - * @return {Unit|RGBA} - * @api public - */ - -function lightness(color, value){ - if (value) { - var hslaColor = color.hsla; - return hsla( - new nodes.Unit(hslaColor.h), - new nodes.Unit(hslaColor.s), - value, - new nodes.Unit(hslaColor.a) - ) - } - return component(color, new nodes.String('lightness')); -}; -lightness.params = ['color', 'value']; -module.exports = lightness; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/list-separator.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/list-separator.js deleted file mode 100644 index 735ebf7a..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/list-separator.js +++ /dev/null @@ -1,25 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes'); - -/** - * Return the separator of the given `list`. - * - * Examples: - * - * list1 = a b c - * list-separator(list1) - * // => ' ' - * - * list2 = a, b, c - * list-separator(list2) - * // => ',' - * - * @param {Experssion} list - * @return {String} - * @api public - */ - -(module.exports = function listSeparator(list){ - list = utils.unwrap(list); - return new nodes.String(list.isList ? ',' : ' '); -}).raw = true; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/lookup.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/lookup.js deleted file mode 100644 index c931b47b..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/lookup.js +++ /dev/null @@ -1,19 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes'); - -/** - * Lookup variable `name` or return Null. - * - * @param {String} name - * @return {Mixed} - * @api public - */ - -function lookup(name){ - utils.assertType(name, 'string', 'name'); - var node = this.lookup(name.val); - if (!node) return nodes.null; - return this.visit(node); -} -lookup.params = ['name']; -module.exports = lookup; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/luminosity.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/luminosity.js deleted file mode 100644 index 3e373f2b..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/luminosity.js +++ /dev/null @@ -1,40 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes'); - -/** - * Returns the relative luminance of the given `color`, - * see http://www.w3.org/TR/WCAG20/#relativeluminancedef - * - * Examples: - * - * luminosity(white) - * // => 1 - * - * luminosity(#000) - * // => 0 - * - * luminosity(red) - * // => 0.2126 - * - * @param {RGBA|HSLA} color - * @return {Unit} - * @api public - */ - -function luminosity(color){ - utils.assertColor(color); - color = color.rgba; - function processChannel(channel) { - channel = channel / 255; - return (0.03928 > channel) - ? channel / 12.92 - : Math.pow(((channel + 0.055) / 1.055), 2.4); - } - return new nodes.Unit( - 0.2126 * processChannel(color.r) - + 0.7152 * processChannel(color.g) - + 0.0722 * processChannel(color.b) - ); -}; -luminosity.params = ['color']; -module.exports = luminosity; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/match.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/match.js deleted file mode 100644 index 18ef7043..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/match.js +++ /dev/null @@ -1,45 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes'); - -var VALID_FLAGS = 'igm'; - -/** - * retrieves the matches when matching a `val`(string) - * against a `pattern`(regular expression). - * - * Examples: - * $regex = '^(height|width)?([<>=]{1,})(.*)' - * - * match($regex,'height>=sm') - * // => ('height>=sm' 'height' '>=' 'sm') - * // => also truthy - * - * match($regex, 'lorem ipsum') - * // => null - * - * @param {String} pattern - * @param {String|Ident} val - * @param {String|Ident} [flags=''] - * @return {String|Null} - * @api public - */ - -function match(pattern, val, flags){ - utils.assertType(pattern, 'string', 'pattern'); - utils.assertString(val, 'val'); - var re = new RegExp(pattern.val, validateFlags(flags) ? flags.string : ''); - return val.string.match(re); -} -match.params = ['pattern', 'val', 'flags']; -module.exports = match; - -function validateFlags(flags) { - flags = flags && flags.string; - - if (flags) { - return flags.split('').every(function(flag) { - return ~VALID_FLAGS.indexOf(flag); - }); - } - return false; -} diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/math-prop.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/math-prop.js deleted file mode 100644 index b345d40e..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/math-prop.js +++ /dev/null @@ -1,15 +0,0 @@ -var nodes = require('../nodes'); - -/** - * Get Math `prop`. - * - * @param {String} prop - * @return {Unit} - * @api private - */ - -function math(prop){ - return new nodes.Unit(Math[prop.string]); -} -math.params = ['prop']; -module.exports = math; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/math.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/math.js deleted file mode 100644 index 09f742eb..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/math.js +++ /dev/null @@ -1,19 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes'); - -/** - * Apply Math `fn` to `n`. - * - * @param {Unit} n - * @param {String} fn - * @return {Unit} - * @api private - */ - -function math(n, fn){ - utils.assertType(n, 'unit', 'n'); - utils.assertString(fn, 'fn'); - return new nodes.Unit(Math[fn.string](n.val), n.type); -} -math.params = ['n', 'fn']; -module.exports = math; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/merge.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/merge.js deleted file mode 100644 index 2558aa12..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/merge.js +++ /dev/null @@ -1,24 +0,0 @@ -var utils = require('../utils'); - -/** - * Merge the object `dest` with the given args. - * - * @param {Object} dest - * @param {Object} ... - * @return {Object} dest - * @api public - */ - -(module.exports = function merge(dest){ - utils.assertPresent(dest, 'dest'); - dest = utils.unwrap(dest).first; - utils.assertType(dest, 'object', 'dest'); - - var last = utils.unwrap(arguments[arguments.length - 1]).first - , deep = (true === last.val); - - for (var i = 1, len = arguments.length - deep; i < len; ++i) { - utils.merge(dest.vals, utils.unwrap(arguments[i]).first.vals, deep); - } - return dest; -}).raw = true; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/operate.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/operate.js deleted file mode 100644 index b03a2a06..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/operate.js +++ /dev/null @@ -1,20 +0,0 @@ -var utils = require('../utils'); - -/** - * Perform `op` on the `left` and `right` operands. - * - * @param {String} op - * @param {Node} left - * @param {Node} right - * @return {Node} - * @api public - */ - -function operate(op, left, right){ - utils.assertType(op, 'string', 'op'); - utils.assertPresent(left, 'left'); - utils.assertPresent(right, 'right'); - return left.operate(op.val, right); -} -operate.params = ['op', 'left', 'right']; -module.exports = operate; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/opposite-position.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/opposite-position.js deleted file mode 100644 index 146e18f5..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/opposite-position.js +++ /dev/null @@ -1,32 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes'); - -/** - * Return the opposites of the given `positions`. - * - * Examples: - * - * opposite-position(top left) - * // => bottom right - * - * @param {Expression} positions - * @return {Expression} - * @api public - */ - -(module.exports = function oppositePosition(positions){ - var expr = []; - utils.unwrap(positions).nodes.forEach(function(pos, i){ - utils.assertString(pos, 'position ' + i); - pos = (function(){ switch (pos.string) { - case 'top': return 'bottom'; - case 'bottom': return 'top'; - case 'left': return 'right'; - case 'right': return 'left'; - case 'center': return 'center'; - default: throw new Error('invalid position ' + pos); - }})(); - expr.push(new nodes.Literal(pos)); - }); - return expr; -}).raw = true; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/p.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/p.js deleted file mode 100644 index 2e73521d..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/p.js +++ /dev/null @@ -1,18 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes'); - -/** - * Inspect the given `expr`. - * - * @param {Expression} expr - * @api public - */ - -(module.exports = function p(){ - [].slice.call(arguments).forEach(function(expr){ - expr = utils.unwrap(expr); - if (!expr.nodes.length) return; - console.log('\u001b[90minspect:\u001b[0m %s', expr.toString().replace(/^\(|\)$/g, '')); - }) - return nodes.null; -}).raw = true; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/pathjoin.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/pathjoin.js deleted file mode 100644 index 98413274..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/pathjoin.js +++ /dev/null @@ -1,16 +0,0 @@ -var path = require('path'); - -/** - * Peform a path join. - * - * @param {String} path - * @return {String} - * @api public - */ - -(module.exports = function pathjoin(){ - var paths = [].slice.call(arguments).map(function(path){ - return path.first.string; - }); - return path.join.apply(null, paths).replace(/\\/g, '/'); -}).raw = true; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/pop.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/pop.js deleted file mode 100644 index d0b7033b..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/pop.js +++ /dev/null @@ -1,14 +0,0 @@ -var utils = require('../utils'); - -/** - * Pop a value from `expr`. - * - * @param {Expression} expr - * @return {Node} - * @api public - */ - -(module.exports = function pop(expr) { - expr = utils.unwrap(expr); - return expr.nodes.pop(); -}).raw = true; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/prefix-classes.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/prefix-classes.js deleted file mode 100644 index c7bf77f9..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/prefix-classes.js +++ /dev/null @@ -1,24 +0,0 @@ -var utils = require('../utils'); - -/** - * Prefix css classes in a block - * - * @param {String} prefix - * @param {Block} block - * @return {Block} - * @api private - */ - -function prefixClasses(prefix, block){ - utils.assertString(prefix, 'prefix'); - utils.assertType(block, 'block', 'block'); - - var _prefix = this.prefix; - - this.options.prefix = this.prefix = prefix.string; - block = this.visit(block); - this.options.prefix = this.prefix = _prefix; - return block; -} -prefixClasses.params = ['prefix', 'block']; -module.exports = prefixClasses; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/push.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/push.js deleted file mode 100644 index 7f9f4e67..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/push.js +++ /dev/null @@ -1,18 +0,0 @@ -var utils = require('../utils'); - -/** - * Push the given args to `expr`. - * - * @param {Expression} expr - * @param {Node} ... - * @return {Unit} - * @api public - */ - -(module.exports = function(expr){ - expr = utils.unwrap(expr); - for (var i = 1, len = arguments.length; i < len; ++i) { - expr.nodes.push(utils.unwrap(arguments[i]).clone()); - } - return expr.nodes.length; -}).raw = true; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/range.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/range.js deleted file mode 100644 index 8a51c884..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/range.js +++ /dev/null @@ -1,34 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes'); - -/** - * Returns a list of units from `start` to `stop` - * by `step`. If `step` argument is omitted, - * it defaults to 1. - * - * @param {Unit} start - * @param {Unit} stop - * @param {Unit} [step] - * @return {Expression} - * @api public - */ - -function range(start, stop, step){ - utils.assertType(start, 'unit', 'start'); - utils.assertType(stop, 'unit', 'stop'); - if (step) { - utils.assertType(step, 'unit', 'step'); - if (0 == step.val) { - throw new Error('ArgumentError: "step" argument must not be zero'); - } - } else { - step = new nodes.Unit(1); - } - var list = new nodes.Expression; - for (var i = start.val; i <= stop.val; i += step.val) { - list.push(new nodes.Unit(i, start.type)); - } - return list; -} -range.params = ['start', 'stop', 'step']; -module.exports = range; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/red.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/red.js deleted file mode 100644 index 50692018..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/red.js +++ /dev/null @@ -1,35 +0,0 @@ -var nodes = require('../nodes') - , rgba = require('./rgba'); - -/** - * Return the red component of the given `color`, - * or set the red component to the optional second `value` argument. - * - * Examples: - * - * red(#c00) - * // => 204 - * - * red(#000, 255) - * // => #f00 - * - * @param {RGBA|HSLA} color - * @param {Unit} [value] - * @return {Unit|RGBA} - * @api public - */ - -function red(color, value){ - color = color.rgba; - if (value) { - return rgba( - value, - new nodes.Unit(color.g), - new nodes.Unit(color.b), - new nodes.Unit(color.a) - ); - } - return new nodes.Unit(color.r, ''); -} -red.params = ['color', 'value']; -module.exports = red; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/remove.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/remove.js deleted file mode 100644 index 25ab7aaa..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/remove.js +++ /dev/null @@ -1,19 +0,0 @@ -var utils = require('../utils'); - -/** - * Remove the given `key` from the `object`. - * - * @param {Object} object - * @param {String} key - * @return {Object} - * @api public - */ - -function remove(object, key){ - utils.assertType(object, 'object', 'object'); - utils.assertString(key, 'key'); - delete object.vals[key.string]; - return object; -} -remove.params = ['object', 'key']; -module.exports = remove; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/replace.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/replace.js deleted file mode 100644 index 67fa9560..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/replace.js +++ /dev/null @@ -1,25 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes'); - -/** - * Returns string with all matches of `pattern` replaced by `replacement` in given `val` - * - * @param {String} pattern - * @param {String} replacement - * @param {String|Ident} val - * @return {String|Ident} - * @api public - */ - -function replace(pattern, replacement, val){ - utils.assertString(pattern, 'pattern'); - utils.assertString(replacement, 'replacement'); - utils.assertString(val, 'val'); - pattern = new RegExp(pattern.string, 'g'); - var res = val.string.replace(pattern, replacement.string); - return val instanceof nodes.Ident - ? new nodes.Ident(res) - : new nodes.String(res); -} -replace.params = ['pattern', 'replacement', 'val']; -module.exports = replace; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/resolver.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/resolver.js deleted file mode 100644 index e3980ae1..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/resolver.js +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Module dependencies. - */ - -var Compiler = require('../visitor/compiler') - , nodes = require('../nodes') - , parse = require('url').parse - , relative = require('path').relative - , join = require('path').join - , dirname = require('path').dirname - , extname = require('path').extname - , sep = require('path').sep; - -/** - * Return a url() function which resolves urls. - * - * Options: - * - * - `paths` resolution path(s), merged with general lookup paths - * - `nocheck` don't check file existence - * - * Examples: - * - * stylus(str) - * .set('filename', __dirname + '/css/test.styl') - * .define('url', stylus.resolver({ nocheck: true })) - * .render(function(err, css){ ... }) - * - * @param {Object} [options] - * @return {Function} - * @api public - */ - -module.exports = function(options) { - options = options || {}; - - function resolver(url) { - // Compile the url - var compiler = new Compiler(url) - , filename = url.filename; - compiler.isURL = true; - url = parse(url.nodes.map(function(node){ - return compiler.visit(node); - }).join('')); - - // Parse literal - var literal = new nodes.Literal('url("' + url.href + '")') - , path = url.pathname - , dest = this.options.dest - , tail = '' - , res; - - // Absolute or hash - if (url.protocol || !path || '/' == path[0]) return literal; - - // Check that file exists - if (!options.nocheck) { - var _paths = options.paths || []; - path = require('../utils').lookup(path, _paths.concat(this.paths)); - if (!path) return literal; - } - - if (this.includeCSS && extname(path) == '.css') - return new nodes.Literal(url.href); - - if (url.search) tail += url.search; - if (url.hash) tail += url.hash; - - if (dest && extname(dest) == '.css') - dest = dirname(dest); - - res = relative(dest || dirname(this.filename), options.nocheck - ? join(dirname(filename), path) - : path) + tail; - - if ('\\' == sep) res = res.replace(/\\/g, '/'); - - return new nodes.Literal('url("' + res + '")'); - }; - - // Expose options to Evaluator - resolver.options = options; - resolver.raw = true; - return resolver; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/rgb.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/rgb.js deleted file mode 100644 index f0a2ef92..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/rgb.js +++ /dev/null @@ -1,42 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes') - , rgba = require('./rgba'); - -/** - * Return a `RGBA` from the r,g,b channels. - * - * Examples: - * - * rgb(255,204,0) - * // => #ffcc00 - * - * rgb(#fff) - * // => #fff - * - * @param {Unit|RGBA|HSLA} red - * @param {Unit} green - * @param {Unit} blue - * @return {RGBA} - * @api public - */ - -function rgb(red, green, blue){ - switch (arguments.length) { - case 1: - utils.assertColor(red); - var color = red.rgba; - return new nodes.RGBA( - color.r - , color.g - , color.b - , 1); - default: - return rgba( - red - , green - , blue - , new nodes.Unit(1)); - } -} -rgb.params = ['red', 'green', 'blue']; -module.exports = rgb; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/rgba.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/rgba.js deleted file mode 100644 index f4a7e642..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/rgba.js +++ /dev/null @@ -1,61 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes'); - -/** - * Return a `RGBA` from the r,g,b,a channels. - * - * Examples: - * - * rgba(255,0,0,0.5) - * // => rgba(255,0,0,0.5) - * - * rgba(255,0,0,1) - * // => #ff0000 - * - * rgba(#ffcc00, 50%) - * // rgba(255,204,0,0.5) - * - * @param {Unit|RGBA|HSLA} red - * @param {Unit} green - * @param {Unit} blue - * @param {Unit} alpha - * @return {RGBA} - * @api public - */ - -function rgba(red, green, blue, alpha){ - switch (arguments.length) { - case 1: - utils.assertColor(red); - return red.rgba; - case 2: - utils.assertColor(red); - var color = red.rgba; - utils.assertType(green, 'unit', 'alpha'); - alpha = green.clone(); - if ('%' == alpha.type) alpha.val /= 100; - return new nodes.RGBA( - color.r - , color.g - , color.b - , alpha.val); - default: - utils.assertType(red, 'unit', 'red'); - utils.assertType(green, 'unit', 'green'); - utils.assertType(blue, 'unit', 'blue'); - utils.assertType(alpha, 'unit', 'alpha'); - var r = '%' == red.type ? Math.round(red.val * 2.55) : red.val - , g = '%' == green.type ? Math.round(green.val * 2.55) : green.val - , b = '%' == blue.type ? Math.round(blue.val * 2.55) : blue.val; - - alpha = alpha.clone(); - if (alpha && '%' == alpha.type) alpha.val /= 100; - return new nodes.RGBA( - r - , g - , b - , alpha.val); - } -} -rgba.params = ['red', 'green', 'blue', 'alpha']; -module.exports = rgba; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/s.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/s.js deleted file mode 100644 index 45dc9056..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/s.js +++ /dev/null @@ -1,37 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes') - , Compiler = require('../visitor/compiler'); - -/** - * Return a `Literal` with the given `fmt`, and - * variable number of arguments. - * - * @param {String} fmt - * @param {Node} ... - * @return {Literal} - * @api public - */ - -(module.exports = function s(fmt){ - fmt = utils.unwrap(fmt).nodes[0]; - utils.assertString(fmt); - var self = this - , str = fmt.string - , args = arguments - , i = 1; - - // format - str = str.replace(/%(s|d)/g, function(_, specifier){ - var arg = args[i++] || nodes.null; - switch (specifier) { - case 's': - return new Compiler(arg, self.options).compile(); - case 'd': - arg = utils.unwrap(arg).first; - if ('unit' != arg.nodeName) throw new Error('%d requires a unit'); - return arg.val; - } - }); - - return new nodes.Literal(str); -}).raw = true; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/saturation.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/saturation.js deleted file mode 100644 index a7ee23e4..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/saturation.js +++ /dev/null @@ -1,36 +0,0 @@ -var nodes = require('../nodes') - , hsla = require('./hsla') - , component = require('./component'); - -/** - * Return the saturation component of the given `color`, - * or set the saturation component to the optional second `value` argument. - * - * Examples: - * - * saturation(#00c) - * // => 100% - * - * saturation(#00c, 50%) - * // => #339 - * - * @param {RGBA|HSLA} color - * @param {Unit} [value] - * @return {Unit|RGBA} - * @api public - */ - -function saturation(color, value){ - if (value) { - var hslaColor = color.hsla; - return hsla( - new nodes.Unit(hslaColor.h), - value, - new nodes.Unit(hslaColor.l), - new nodes.Unit(hslaColor.a) - ) - } - return component(color, new nodes.String('saturation')); -} -saturation.params = ['color', 'value']; -module.exports = saturation; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/selector-exists.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/selector-exists.js deleted file mode 100644 index 52f9d378..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/selector-exists.js +++ /dev/null @@ -1,25 +0,0 @@ -var utils = require('../utils'); - -/** - * Returns true if the given selector exists. - * - * @param {String} sel - * @return {Boolean} - * @api public - */ - -function selectorExists(sel) { - utils.assertString(sel, 'selector'); - - if (!this.__selectorsMap__) { - var Normalizer = require('../visitor/normalizer') - , visitor = new Normalizer(this.root.clone()); - visitor.visit(visitor.root); - - this.__selectorsMap__ = visitor.map; - } - - return sel.string in this.__selectorsMap__; -} -selectorExists.params = ['sel']; -module.exports = selectorExists; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/selector.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/selector.js deleted file mode 100644 index b87ec28d..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/selector.js +++ /dev/null @@ -1,71 +0,0 @@ -var utils = require('../utils'); - -/** - * Return the current selector or compile - * selector from a string or a list. - * - * @param {String|Expression} - * @return {String} - * @api public - */ - -(module.exports = function selector(){ - var stack = this.selectorStack - , args = [].slice.call(arguments); - - if (1 == args.length) { - var expr = utils.unwrap(args[0]) - , len = expr.nodes.length; - - // selector('.a') - if (1 == len) { - utils.assertString(expr.first, 'selector'); - var SelectorParser = require('../selector-parser') - , val = expr.first.string - , parsed = new SelectorParser(val).parse().val; - - if (parsed == val) return val; - - stack.push(parse(val)); - } else if (len > 1) { - // selector-list = '.a', '.b', '.c' - // selector(selector-list) - if (expr.isList) { - pushToStack(expr.nodes, stack); - // selector('.a' '.b' '.c') - } else { - stack.push(parse(expr.nodes.map(function(node){ - utils.assertString(node, 'selector'); - return node.string; - }).join(' '))); - } - } - // selector('.a', '.b', '.c') - } else if (args.length > 1) { - pushToStack(args, stack); - } - - return stack.length ? utils.compileSelectors(stack).join(',') : '&'; -}).raw = true; - -function pushToStack(selectors, stack) { - selectors.forEach(function(sel) { - sel = sel.first; - utils.assertString(sel, 'selector'); - stack.push(parse(sel.string)); - }); -} - -function parse(selector) { - var Parser = new require('../parser') - , parser = new Parser(selector) - , nodes; - parser.state.push('selector-parts'); - nodes = parser.selector(); - nodes.forEach(function(node) { - node.val = node.segments.map(function(seg){ - return seg.toString(); - }).join(''); - }); - return nodes; -} diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/selectors.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/selectors.js deleted file mode 100644 index 6dd82a3b..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/selectors.js +++ /dev/null @@ -1,43 +0,0 @@ -var nodes = require('../nodes') - , Parser = require('../selector-parser'); - -/** - * Return a list with raw selectors parts - * of the current group. - * - * For example: - * - * .a, .b - * .c - * .d - * test: selectors() // => '.a,.b', '& .c', '& .d' - * - * @return {Expression} - * @api public - */ - -module.exports = function selectors(){ - var stack = this.selectorStack - , expr = new nodes.Expression(true); - - if (stack.length) { - for (var i = 0; i < stack.length; i++) { - var group = stack[i] - , nested; - - if (group.length > 1) { - expr.push(new nodes.String(group.map(function(selector) { - nested = new Parser(selector.val).parse().nested; - return (nested && i ? '& ' : '') + selector.val; - }).join(','))) - } else { - var selector = group[0].val - nested = new Parser(selector).parse().nested; - expr.push(new nodes.String((nested && i ? '& ' : '') + selector)); - } - } - } else { - expr.push(new nodes.String('&')); - } - return expr; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/shift.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/shift.js deleted file mode 100644 index ecfaf8f4..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/shift.js +++ /dev/null @@ -1,15 +0,0 @@ -var utils = require('../utils'); - -/** - * Shift an element from `expr`. - * - * @param {Expression} expr - * @return {Node} - * @api public - */ - - (module.exports = function(expr){ - expr = utils.unwrap(expr); - return expr.nodes.shift(); - }).raw = true; - diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/slice.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/slice.js deleted file mode 100644 index 107ec4b4..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/slice.js +++ /dev/null @@ -1,28 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes'); - -/** - * This is a helper function for the slice method - * - * @param {String|Ident} vals - * @param {Unit} start [0] - * @param {Unit} end [vals.length] - * @return {String|Literal|Null} - * @api public -*/ -(module.exports = function slice(val, start, end) { - start = start && start.nodes[0].val; - end = end && end.nodes[0].val; - - val = utils.unwrap(val).nodes; - - if (val.length > 1) { - return utils.coerce(val.slice(start, end), true); - } - - var result = val[0].string.slice(start, end); - - return val[0] instanceof nodes.Ident - ? new nodes.Ident(result) - : new nodes.String(result); -}).raw = true; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/split.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/split.js deleted file mode 100644 index f128ee8e..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/split.js +++ /dev/null @@ -1,27 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes'); - -/** - * Splits the given `val` by `delim` - * - * @param {String} delim - * @param {String|Ident} val - * @return {Expression} - * @api public - */ - -function split(delim, val){ - utils.assertString(delim, 'delimiter'); - utils.assertString(val, 'val'); - var splitted = val.string.split(delim.string); - var expr = new nodes.Expression(); - var ItemNode = val instanceof nodes.Ident - ? nodes.Ident - : nodes.String; - for (var i = 0, len = splitted.length; i < len; ++i) { - expr.nodes.push(new ItemNode(splitted[i])); - } - return expr; -} -split.params = ['delim', 'val']; -module.exports = split; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/substr.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/substr.js deleted file mode 100644 index 90c55bff..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/substr.js +++ /dev/null @@ -1,24 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes'); - -/** - * Returns substring of the given `val`. - * - * @param {String|Ident} val - * @param {Number} start - * @param {Number} [length] - * @return {String|Ident} - * @api public - */ - -function substr(val, start, length){ - utils.assertString(val, 'val'); - utils.assertType(start, 'unit', 'start'); - length = length && length.val; - var res = val.string.substr(start.val, length); - return val instanceof nodes.Ident - ? new nodes.Ident(res) - : new nodes.String(res); -} -substr.params = ['val', 'start', 'length']; -module.exports = substr; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/tan.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/tan.js deleted file mode 100644 index 172324a5..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/tan.js +++ /dev/null @@ -1,30 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes'); - -/** - * Return the tangent of the given `angle`. - * - * @param {Unit} angle - * @return {Unit} - * @api public - */ - -function tan(angle) { - utils.assertType(angle, 'unit', 'angle'); - - var radians = angle.val; - - if (angle.type === 'deg') { - radians *= Math.PI / 180; - } - - var m = Math.pow(10, 9); - - var sin = Math.round(Math.sin(radians) * m) / m - , cos = Math.round(Math.cos(radians) * m) / m - , tan = Math.round(m * sin / cos ) / m; - - return new nodes.Unit(tan, ''); -} -tan.params = ['angle']; -module.exports = tan; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/trace.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/trace.js deleted file mode 100644 index ddae02f0..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/trace.js +++ /dev/null @@ -1,12 +0,0 @@ -var nodes = require('../nodes'); - -/** - * Output stack trace. - * - * @api public - */ - -module.exports = function trace(){ - console.log(this.stack); - return nodes.null; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/transparentify.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/transparentify.js deleted file mode 100644 index 65c8cf27..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/transparentify.js +++ /dev/null @@ -1,65 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes'); - -/** - * Returns the transparent version of the given `top` color, - * as if it was blend over the given `bottom` color. - * - * Examples: - * - * transparentify(#808080) - * => rgba(0,0,0,0.5) - * - * transparentify(#414141, #000) - * => rgba(255,255,255,0.25) - * - * transparentify(#91974C, #F34949, 0.5) - * => rgba(47,229,79,0.5) - * - * @param {RGBA|HSLA} top - * @param {RGBA|HSLA} [bottom=#fff] - * @param {Unit} [alpha] - * @return {RGBA} - * @api public - */ - -function transparentify(top, bottom, alpha){ - utils.assertColor(top); - top = top.rgba; - // Handle default arguments - bottom = bottom || new nodes.RGBA(255, 255, 255, 1); - if (!alpha && bottom && !bottom.rgba) { - alpha = bottom; - bottom = new nodes.RGBA(255, 255, 255, 1); - } - utils.assertColor(bottom); - bottom = bottom.rgba; - var bestAlpha = ['r', 'g', 'b'].map(function(channel){ - return (top[channel] - bottom[channel]) / ((0 < (top[channel] - bottom[channel]) ? 255 : 0) - bottom[channel]); - }).sort(function(a, b){return b - a;})[0]; - if (alpha) { - utils.assertType(alpha, 'unit', 'alpha'); - if ('%' == alpha.type) { - bestAlpha = alpha.val / 100; - } else if (!alpha.type) { - bestAlpha = alpha = alpha.val; - } - } - bestAlpha = Math.max(Math.min(bestAlpha, 1), 0); - // Calculate the resulting color - function processChannel(channel) { - if (0 == bestAlpha) { - return bottom[channel] - } else { - return bottom[channel] + (top[channel] - bottom[channel]) / bestAlpha - } - } - return new nodes.RGBA( - processChannel('r'), - processChannel('g'), - processChannel('b'), - Math.round(bestAlpha * 100) / 100 - ); -} -transparentify.params = ['top', 'bottom', 'alpha']; -module.exports = transparentify; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/type.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/type.js deleted file mode 100644 index 185e4156..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/type.js +++ /dev/null @@ -1,32 +0,0 @@ -var utils = require('../utils'); - -/** - * Return type of `node`. - * - * Examples: - * - * type(12) - * // => 'unit' - * - * type(#fff) - * // => 'color' - * - * type(type) - * // => 'function' - * - * type(unbound) - * typeof(unbound) - * type-of(unbound) - * // => 'ident' - * - * @param {Node} node - * @return {String} - * @api public - */ - -function type(node){ - utils.assertPresent(node, 'expression'); - return node.nodeName; -} -type.params = ['node']; -module.exports = type; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/unit.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/unit.js deleted file mode 100644 index f655a832..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/unit.js +++ /dev/null @@ -1,25 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes'); - -/** - * Assign `type` to the given `unit` or return `unit`'s type. - * - * @param {Unit} unit - * @param {String|Ident} type - * @return {Unit} - * @api public - */ - -function unit(unit, type){ - utils.assertType(unit, 'unit', 'unit'); - - // Assign - if (type) { - utils.assertString(type, 'type'); - return new nodes.Unit(unit.val, type.string); - } else { - return unit.type || ''; - } -} -unit.params = ['unit', 'type']; -module.exports = unit; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/unquote.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/unquote.js deleted file mode 100644 index ef50bdd1..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/unquote.js +++ /dev/null @@ -1,25 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes'); - -/** - * Unquote the given `string`. - * - * Examples: - * - * unquote("sans-serif") - * // => sans-serif - * - * unquote(sans-serif) - * // => sans-serif - * - * @param {String|Ident} string - * @return {Literal} - * @api public - */ - -function unquote(string){ - utils.assertString(string, 'string'); - return new nodes.Literal(string.string); -} -unquote.params = ['string']; -module.exports = unquote; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/unshift.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/unshift.js deleted file mode 100644 index 19a3660b..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/unshift.js +++ /dev/null @@ -1,18 +0,0 @@ -var utils = require('../utils'); - -/** - * Unshift the given args to `expr`. - * - * @param {Expression} expr - * @param {Node} ... - * @return {Unit} - * @api public - */ - -(module.exports = function(expr){ - expr = utils.unwrap(expr); - for (var i = 1, len = arguments.length; i < len; ++i) { - expr.nodes.unshift(utils.unwrap(arguments[i])); - } - return expr.nodes.length; -}).raw = true; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/url.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/url.js deleted file mode 100644 index 46d250d5..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/url.js +++ /dev/null @@ -1,142 +0,0 @@ - -/*! - * Stylus - plugin - url - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Compiler = require('../visitor/compiler') - , events = require('../renderer').events - , nodes = require('../nodes') - , parse = require('url').parse - , extname = require('path').extname - , utils = require('../utils') - , fs = require('fs'); - -/** - * Mime table. - */ - -var defaultMimes = { - '.gif': 'image/gif' - , '.png': 'image/png' - , '.jpg': 'image/jpeg' - , '.jpeg': 'image/jpeg' - , '.svg': 'image/svg+xml' - , '.webp': 'image/webp' - , '.ttf': 'application/x-font-ttf' - , '.eot': 'application/vnd.ms-fontobject' - , '.woff': 'application/font-woff' - , '.woff2': 'application/font-woff2' -}; - -/** - * Supported encoding types - */ -var encodingTypes = { - BASE_64: 'base64', - UTF8: 'charset=utf-8' -} - -/** - * Return a url() function with the given `options`. - * - * Options: - * - * - `limit` bytesize limit defaulting to 30Kb - * - `paths` image resolution path(s), merged with general lookup paths - * - * Examples: - * - * stylus(str) - * .set('filename', __dirname + '/css/test.styl') - * .define('url', stylus.url({ paths: [__dirname + '/public'] })) - * .render(function(err, css) { ... }) - * - * @param {Object} options - * @return {Function} - * @api public - */ - -module.exports = function(options) { - options = options || {}; - - var _paths = options.paths || []; - var sizeLimit = null != options.limit ? options.limit : 30000; - var mimes = options.mimes || defaultMimes; - - /** - * @param {object} url - The path to the image you want to encode. - * @param {object} enc - The encoding for the image. Defaults to base64, the - * other valid option is `utf8`. - */ - function fn(url, enc) { - // Compile the url - var compiler = new Compiler(url) - , encoding = encodingTypes.BASE_64; - - compiler.isURL = true; - url = url.nodes.map(function(node) { - return compiler.visit(node); - }).join(''); - - // Parse literal - url = parse(url); - var ext = extname(url.pathname || '') - , mime = mimes[ext] - , hash = url.hash || '' - , literal = new nodes.Literal('url("' + url.href + '")') - , paths = _paths.concat(this.paths) - , buf - , result; - - // Not supported - if(!mime) return literal; - - // Absolute - if(url.protocol) return literal; - - // Lookup - var found = utils.lookup(url.pathname, paths); - - // Failed to lookup - if(!found) { - events.emit( - 'file not found' - , 'File ' + literal + ' could not be found, literal url retained!' - ); - - return literal; - } - - // Read data - buf = fs.readFileSync(found); - - // Too large - if(false !== sizeLimit && buf.length > sizeLimit) return literal; - - if(enc && 'utf8' == enc.first.val.toLowerCase()) { - encoding = encodingTypes.UTF8; - result = buf.toString().replace(/\s+/g, ' ') - .replace(/[{}\|\\\^~\[\]`"<>#%]/g, function(match) { - return '%' + match[0].charCodeAt(0).toString(16).toUpperCase(); - }).trim(); - } else { - result = buf.toString(encoding) + hash; - } - - // Encode - return new nodes.Literal('url("data:' + mime + ';' + encoding + ',' + result + '")'); - }; - - fn.raw = true; - return fn; -}; - -// Exporting default mimes so we could easily access them -module.exports.mimes = defaultMimes; - diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/use.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/use.js deleted file mode 100644 index e8459b77..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/use.js +++ /dev/null @@ -1,76 +0,0 @@ -var utils = require('../utils') - , path = require('path'); - -/** -* Use the given `plugin` -* -* Examples: -* -* use("plugins/add.js") -* -* width add(10, 100) -* // => width: 110 -*/ - -function use(plugin, options){ - utils.assertString(plugin, 'plugin'); - - if (options) { - utils.assertType(options, 'object', 'options'); - options = parseObject(options); - } - - // lookup - plugin = plugin.string; - var found = utils.lookup(plugin, this.options.paths, this.options.filename); - if (!found) throw new Error('failed to locate plugin file "' + plugin + '"'); - - // use - var fn = require(path.resolve(found)); - if ('function' != typeof fn) { - throw new Error('plugin "' + plugin + '" does not export a function'); - } - this.renderer.use(fn(options || this.options)); -} -use.params = ['plugin', 'options']; -module.exports = use; - -/** - * Attempt to parse object node to the javascript object. - * - * @param {Object} obj - * @return {Object} - * @api private - */ - -function parseObject(obj){ - obj = obj.vals; - for (var key in obj) { - var nodes = obj[key].nodes[0].nodes; - if (nodes && nodes.length) { - obj[key] = []; - for (var i = 0, len = nodes.length; i < len; ++i) { - obj[key].push(convert(nodes[i])); - } - } else { - obj[key] = convert(obj[key].first); - } - } - return obj; - - function convert(node){ - switch (node.nodeName) { - case 'object': - return parseObject(node); - case 'boolean': - return node.isTrue; - case 'unit': - return node.type ? node.toString() : +node.val; - case 'string': - case 'literal': - return node.val; - default: - return node.toString(); - } - } -} diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/warn.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/warn.js deleted file mode 100644 index 9a35d198..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/functions/warn.js +++ /dev/null @@ -1,17 +0,0 @@ -var utils = require('../utils') - , nodes = require('../nodes'); - -/** - * Warn with the given `msg` prefixed by "Warning: ". - * - * @param {String} msg - * @api public - */ - -function warn(msg){ - utils.assertType(msg, 'string', 'msg'); - console.warn('Warning: %s', msg.val); - return nodes.null; -} -warn.params = ['msg']; -module.exports = warn; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/lexer.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/lexer.js deleted file mode 100644 index abde6bba..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/lexer.js +++ /dev/null @@ -1,897 +0,0 @@ - -/*! - * Stylus - Lexer - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Token = require('./token') - , nodes = require('./nodes') - , errors = require('./errors'); - -/** - * Expose `Lexer`. - */ - -exports = module.exports = Lexer; - -/** - * Operator aliases. - */ - -var alias = { - 'and': '&&' - , 'or': '||' - , 'is': '==' - , 'isnt': '!=' - , 'is not': '!=' - , ':=': '?=' -}; - -/** - * Initialize a new `Lexer` with the given `str` and `options`. - * - * @param {String} str - * @param {Object} options - * @api private - */ - -function Lexer(str, options) { - options = options || {}; - this.stash = []; - this.indentStack = []; - this.indentRe = null; - this.lineno = 1; - this.column = 1; - - // HACK! - function comment(str, val, offset, s) { - var inComment = s.lastIndexOf('/*', offset) > s.lastIndexOf('*/', offset) - , commentIdx = s.lastIndexOf('//', offset) - , i = s.lastIndexOf('\n', offset) - , double = 0 - , single = 0; - - if (~commentIdx && commentIdx > i) { - while (i != offset) { - if ("'" == s[i]) single ? single-- : single++; - if ('"' == s[i]) double ? double-- : double++; - - if ('/' == s[i] && '/' == s[i + 1]) { - inComment = !single && !double; - break; - } - ++i; - } - } - - return inComment - ? str - : ((val === ',' && /^[,\t\n]+$/.test(str)) ? str.replace(/\n/, '\r') : val + '\r'); - }; - - // Remove UTF-8 BOM. - if ('\uFEFF' == str.charAt(0)) str = str.slice(1); - - this.str = str - .replace(/\s+$/, '\n') - .replace(/\r\n?/g, '\n') - .replace(/\\ *\n/g, '\r') - .replace(/([,(:](?!\/\/[^ ])) *(?:\/\/[^\n]*|\/\*.*?\*\/)?\n\s*/g, comment) - .replace(/\s*\n[ \t]*([,)])/g, comment); -}; - -/** - * Lexer prototype. - */ - -Lexer.prototype = { - - /** - * Custom inspect. - */ - - inspect: function(){ - var tok - , tmp = this.str - , buf = []; - while ('eos' != (tok = this.next()).type) { - buf.push(tok.inspect()); - } - this.str = tmp; - return buf.concat(tok.inspect()).join('\n'); - }, - - /** - * Lookahead `n` tokens. - * - * @param {Number} n - * @return {Object} - * @api private - */ - - lookahead: function(n){ - var fetch = n - this.stash.length; - while (fetch-- > 0) this.stash.push(this.advance()); - return this.stash[--n]; - }, - - /** - * Consume the given `len`. - * - * @param {Number|Array} len - * @api private - */ - - skip: function(len){ - var chunk = len[0]; - len = chunk ? chunk.length : len; - this.str = this.str.substr(len); - if (chunk) { - this.move(chunk); - } else { - this.column += len; - } - }, - - /** - * Move current line and column position. - * - * @param {String} str - * @api private - */ - - move: function(str){ - var lines = str.match(/\n/g) - , idx = str.lastIndexOf('\n'); - - if (lines) this.lineno += lines.length; - this.column = ~idx - ? str.length - idx - : this.column + str.length; - }, - - /** - * Fetch next token including those stashed by peek. - * - * @return {Token} - * @api private - */ - - next: function() { - var tok = this.stashed() || this.advance(); - this.prev = tok; - return tok; - }, - - /** - * Check if the current token is a part of selector. - * - * @return {Boolean} - * @api private - */ - - isPartOfSelector: function() { - var tok = this.stash[this.stash.length - 1] || this.prev; - switch (tok && tok.type) { - // #for - case 'color': - return 2 == tok.val.raw.length; - // .or - case '.': - // [is] - case '[': - return true; - } - return false; - }, - - /** - * Fetch next token. - * - * @return {Token} - * @api private - */ - - advance: function() { - var column = this.column - , line = this.lineno - , tok = this.eos() - || this.null() - || this.sep() - || this.keyword() - || this.urlchars() - || this.comment() - || this.newline() - || this.escaped() - || this.important() - || this.literal() - || this.anonFunc() - || this.atrule() - || this.function() - || this.brace() - || this.paren() - || this.color() - || this.string() - || this.unit() - || this.namedop() - || this.boolean() - || this.unicode() - || this.ident() - || this.op() - || (function () { - var token = this.eol(); - - if (token) { - column = token.column; - line = token.lineno; - } - - return token; - }).call(this) - || this.space() - || this.selector(); - - tok.lineno = line; - tok.column = column; - - return tok; - }, - - /** - * Lookahead a single token. - * - * @return {Token} - * @api private - */ - - peek: function() { - return this.lookahead(1); - }, - - /** - * Return the next possibly stashed token. - * - * @return {Token} - * @api private - */ - - stashed: function() { - return this.stash.shift(); - }, - - /** - * EOS | trailing outdents. - */ - - eos: function() { - if (this.str.length) return; - if (this.indentStack.length) { - this.indentStack.shift(); - return new Token('outdent'); - } else { - return new Token('eos'); - } - }, - - /** - * url char - */ - - urlchars: function() { - var captures; - if (!this.isURL) return; - if (captures = /^[\/:@.;?&=*!,<>#%0-9]+/.exec(this.str)) { - this.skip(captures); - return new Token('literal', new nodes.Literal(captures[0])); - } - }, - - /** - * ';' [ \t]* - */ - - sep: function() { - var captures; - if (captures = /^;[ \t]*/.exec(this.str)) { - this.skip(captures); - return new Token(';'); - } - }, - - /** - * '\r' - */ - - eol: function() { - if ('\r' == this.str[0]) { - ++this.lineno; - this.skip(1); - - this.column = 1; - while(this.space()); - - return this.advance(); - } - }, - - /** - * ' '+ - */ - - space: function() { - var captures; - if (captures = /^([ \t]+)/.exec(this.str)) { - this.skip(captures); - return new Token('space'); - } - }, - - /** - * '\\' . ' '* - */ - - escaped: function() { - var captures; - if (captures = /^\\(.)[ \t]*/.exec(this.str)) { - var c = captures[1]; - this.skip(captures); - return new Token('ident', new nodes.Literal(c)); - } - }, - - /** - * '@css' ' '* '{' .* '}' ' '* - */ - - literal: function() { - // HACK attack !!! - var captures; - if (captures = /^@css[ \t]*\{/.exec(this.str)) { - this.skip(captures); - var c - , braces = 1 - , css = '' - , node; - while (c = this.str[0]) { - this.str = this.str.substr(1); - switch (c) { - case '{': ++braces; break; - case '}': --braces; break; - case '\n': - case '\r': - ++this.lineno; - break; - } - css += c; - if (!braces) break; - } - css = css.replace(/\s*}$/, ''); - node = new nodes.Literal(css); - node.css = true; - return new Token('literal', node); - } - }, - - /** - * '!important' ' '* - */ - - important: function() { - var captures; - if (captures = /^!important[ \t]*/.exec(this.str)) { - this.skip(captures); - return new Token('ident', new nodes.Literal('!important')); - } - }, - - /** - * '{' | '}' - */ - - brace: function() { - var captures; - if (captures = /^([{}])/.exec(this.str)) { - this.skip(1); - var brace = captures[1]; - return new Token(brace, brace); - } - }, - - /** - * '(' | ')' ' '* - */ - - paren: function() { - var captures; - if (captures = /^([()])([ \t]*)/.exec(this.str)) { - var paren = captures[1]; - this.skip(captures); - if (')' == paren) this.isURL = false; - var tok = new Token(paren, paren); - tok.space = captures[2]; - return tok; - } - }, - - /** - * 'null' - */ - - null: function() { - var captures - , tok; - if (captures = /^(null)\b[ \t]*/.exec(this.str)) { - this.skip(captures); - if (this.isPartOfSelector()) { - tok = new Token('ident', new nodes.Ident(captures[0])); - } else { - tok = new Token('null', nodes.null); - } - return tok; - } - }, - - /** - * 'if' - * | 'else' - * | 'unless' - * | 'return' - * | 'for' - * | 'in' - */ - - keyword: function() { - var captures - , tok; - if (captures = /^(return|if|else|unless|for|in)\b(?!-)[ \t]*/.exec(this.str)) { - var keyword = captures[1]; - this.skip(captures); - if (this.isPartOfSelector()) { - tok = new Token('ident', new nodes.Ident(captures[0])); - } else { - tok = new Token(keyword, keyword); - } - return tok; - } - }, - - /** - * 'not' - * | 'and' - * | 'or' - * | 'is' - * | 'is not' - * | 'isnt' - * | 'is a' - * | 'is defined' - */ - - namedop: function() { - var captures - , tok; - if (captures = /^(not|and|or|is a|is defined|isnt|is not|is)(?!-)\b([ \t]*)/.exec(this.str)) { - var op = captures[1]; - this.skip(captures); - if (this.isPartOfSelector()) { - tok = new Token('ident', new nodes.Ident(captures[0])); - } else { - op = alias[op] || op; - tok = new Token(op, op); - } - tok.space = captures[2]; - return tok; - } - }, - - /** - * ',' - * | '+' - * | '+=' - * | '-' - * | '-=' - * | '*' - * | '*=' - * | '/' - * | '/=' - * | '%' - * | '%=' - * | '**' - * | '!' - * | '&' - * | '&&' - * | '||' - * | '>' - * | '>=' - * | '<' - * | '<=' - * | '=' - * | '==' - * | '!=' - * | '!' - * | '~' - * | '?=' - * | ':=' - * | '?' - * | ':' - * | '[' - * | ']' - * | '.' - * | '..' - * | '...' - */ - - op: function() { - var captures; - if (captures = /^([.]{1,3}|&&|\|\||[!<>=?:]=|\*\*|[-+*\/%]=?|[,=?:!~<>&\[\]])([ \t]*)/.exec(this.str)) { - var op = captures[1]; - this.skip(captures); - op = alias[op] || op; - var tok = new Token(op, op); - tok.space = captures[2]; - this.isURL = false; - return tok; - } - }, - - /** - * '@(' - */ - - anonFunc: function() { - var tok; - if ('@' == this.str[0] && '(' == this.str[1]) { - this.skip(2); - tok = new Token('function', new nodes.Ident('anonymous')); - tok.anonymous = true; - return tok; - } - }, - - /** - * '@' (-(\w+)-)?[a-zA-Z0-9-_]+ - */ - - atrule: function() { - var captures; - if (captures = /^@(?!apply)(?:-(\w+)-)?([a-zA-Z0-9-_]+)[ \t]*/.exec(this.str)) { - this.skip(captures); - var vendor = captures[1] - , type = captures[2] - , tok; - switch (type) { - case 'require': - case 'import': - case 'charset': - case 'namespace': - case 'media': - case 'scope': - case 'supports': - return new Token(type); - case 'document': - return new Token('-moz-document'); - case 'block': - return new Token('atblock'); - case 'extend': - case 'extends': - return new Token('extend'); - case 'keyframes': - return new Token(type, vendor); - default: - return new Token('atrule', (vendor ? '-' + vendor + '-' + type : type)); - } - } - }, - - /** - * '//' * - */ - - comment: function() { - // Single line - if ('/' == this.str[0] && '/' == this.str[1]) { - var end = this.str.indexOf('\n'); - if (-1 == end) end = this.str.length; - this.skip(end); - return this.advance(); - } - - // Multi-line - if ('/' == this.str[0] && '*' == this.str[1]) { - var end = this.str.indexOf('*/'); - if (-1 == end) end = this.str.length; - var str = this.str.substr(0, end + 2) - , lines = str.split(/\n|\r/).length - 1 - , suppress = true - , inline = false; - this.lineno += lines; - this.skip(end + 2); - // output - if ('!' == str[2]) { - str = str.replace('*!', '*'); - suppress = false; - } - if (this.prev && ';' == this.prev.type) inline = true; - return new Token('comment', new nodes.Comment(str, suppress, inline)); - } - }, - - /** - * 'true' | 'false' - */ - - boolean: function() { - var captures; - if (captures = /^(true|false)\b([ \t]*)/.exec(this.str)) { - var val = nodes.Boolean('true' == captures[1]); - this.skip(captures); - var tok = new Token('boolean', val); - tok.space = captures[2]; - return tok; - } - }, - - /** - * 'U+' [0-9A-Fa-f?]{1,6}(?:-[0-9A-Fa-f]{1,6})? - */ - - unicode: function() { - var captures; - if (captures = /^u\+[0-9a-f?]{1,6}(?:-[0-9a-f]{1,6})?/i.exec(this.str)) { - this.skip(captures); - return new Token('literal', new nodes.Literal(captures[0])); - } - }, - - /** - * -*[_a-zA-Z$] [-\w\d$]* '(' - */ - - function: function() { - var captures; - if (captures = /^(-*[_a-zA-Z$][-\w\d$]*)\(([ \t]*)/.exec(this.str)) { - var name = captures[1]; - this.skip(captures); - this.isURL = 'url' == name; - var tok = new Token('function', new nodes.Ident(name)); - tok.space = captures[2]; - return tok; - } - }, - - /** - * -*[_a-zA-Z$] [-\w\d$]* - */ - - ident: function() { - var captures; - if (captures = /^-*([_a-zA-Z$]|@apply)[-\w\d$]*/.exec(this.str)) { - this.skip(captures); - return new Token('ident', new nodes.Ident(captures[0])); - } - }, - - /** - * '\n' ' '+ - */ - - newline: function() { - var captures, re; - - // we have established the indentation regexp - if (this.indentRe){ - captures = this.indentRe.exec(this.str); - // figure out if we are using tabs or spaces - } else { - // try tabs - re = /^\n([\t]*)[ \t]*/; - captures = re.exec(this.str); - - // nope, try spaces - if (captures && !captures[1].length) { - re = /^\n([ \t]*)/; - captures = re.exec(this.str); - } - - // established - if (captures && captures[1].length) this.indentRe = re; - } - - - if (captures) { - var tok - , indents = captures[1].length; - - this.skip(captures); - if (this.str[0] === ' ' || this.str[0] === '\t') { - throw new errors.SyntaxError('Invalid indentation. You can use tabs or spaces to indent, but not both.'); - } - - // Blank line - if ('\n' == this.str[0]) return this.advance(); - - // Outdent - if (this.indentStack.length && indents < this.indentStack[0]) { - while (this.indentStack.length && this.indentStack[0] > indents) { - this.stash.push(new Token('outdent')); - this.indentStack.shift(); - } - tok = this.stash.pop(); - // Indent - } else if (indents && indents != this.indentStack[0]) { - this.indentStack.unshift(indents); - tok = new Token('indent'); - // Newline - } else { - tok = new Token('newline'); - } - - return tok; - } - }, - - /** - * '-'? (digit+ | digit* '.' digit+) unit - */ - - unit: function() { - var captures; - if (captures = /^(-)?(\d+\.\d+|\d+|\.\d+)(%|[a-zA-Z]+)?[ \t]*/.exec(this.str)) { - this.skip(captures); - var n = parseFloat(captures[2]); - if ('-' == captures[1]) n = -n; - var node = new nodes.Unit(n, captures[3]); - node.raw = captures[0]; - return new Token('unit', node); - } - }, - - /** - * '"' [^"]+ '"' | "'"" [^']+ "'" - */ - - string: function() { - var captures; - if (captures = /^("[^"]*"|'[^']*')[ \t]*/.exec(this.str)) { - var str = captures[1] - , quote = captures[0][0]; - this.skip(captures); - str = str.slice(1,-1).replace(/\\n/g, '\n'); - return new Token('string', new nodes.String(str, quote)); - } - }, - - /** - * #rrggbbaa | #rrggbb | #rgba | #rgb | #nn | #n - */ - - color: function() { - return this.rrggbbaa() - || this.rrggbb() - || this.rgba() - || this.rgb() - || this.nn() - || this.n() - }, - - /** - * #n - */ - - n: function() { - var captures; - if (captures = /^#([a-fA-F0-9]{1})[ \t]*/.exec(this.str)) { - this.skip(captures); - var n = parseInt(captures[1] + captures[1], 16) - , color = new nodes.RGBA(n, n, n, 1); - color.raw = captures[0]; - return new Token('color', color); - } - }, - - /** - * #nn - */ - - nn: function() { - var captures; - if (captures = /^#([a-fA-F0-9]{2})[ \t]*/.exec(this.str)) { - this.skip(captures); - var n = parseInt(captures[1], 16) - , color = new nodes.RGBA(n, n, n, 1); - color.raw = captures[0]; - return new Token('color', color); - } - }, - - /** - * #rgb - */ - - rgb: function() { - var captures; - if (captures = /^#([a-fA-F0-9]{3})[ \t]*/.exec(this.str)) { - this.skip(captures); - var rgb = captures[1] - , r = parseInt(rgb[0] + rgb[0], 16) - , g = parseInt(rgb[1] + rgb[1], 16) - , b = parseInt(rgb[2] + rgb[2], 16) - , color = new nodes.RGBA(r, g, b, 1); - color.raw = captures[0]; - return new Token('color', color); - } - }, - - /** - * #rgba - */ - - rgba: function() { - var captures; - if (captures = /^#([a-fA-F0-9]{4})[ \t]*/.exec(this.str)) { - this.skip(captures); - var rgb = captures[1] - , r = parseInt(rgb[0] + rgb[0], 16) - , g = parseInt(rgb[1] + rgb[1], 16) - , b = parseInt(rgb[2] + rgb[2], 16) - , a = parseInt(rgb[3] + rgb[3], 16) - , color = new nodes.RGBA(r, g, b, a/255); - color.raw = captures[0]; - return new Token('color', color); - } - }, - - /** - * #rrggbb - */ - - rrggbb: function() { - var captures; - if (captures = /^#([a-fA-F0-9]{6})[ \t]*/.exec(this.str)) { - this.skip(captures); - var rgb = captures[1] - , r = parseInt(rgb.substr(0, 2), 16) - , g = parseInt(rgb.substr(2, 2), 16) - , b = parseInt(rgb.substr(4, 2), 16) - , color = new nodes.RGBA(r, g, b, 1); - color.raw = captures[0]; - return new Token('color', color); - } - }, - - /** - * #rrggbbaa - */ - - rrggbbaa: function() { - var captures; - if (captures = /^#([a-fA-F0-9]{8})[ \t]*/.exec(this.str)) { - this.skip(captures); - var rgb = captures[1] - , r = parseInt(rgb.substr(0, 2), 16) - , g = parseInt(rgb.substr(2, 2), 16) - , b = parseInt(rgb.substr(4, 2), 16) - , a = parseInt(rgb.substr(6, 2), 16) - , color = new nodes.RGBA(r, g, b, a/255); - color.raw = captures[0]; - return new Token('color', color); - } - }, - - /** - * ^|[^\n,;]+ - */ - - selector: function() { - var captures; - if (captures = /^\^|.*?(?=\/\/(?![^\[]*\])|[,\n{])/.exec(this.str)) { - var selector = captures[0]; - this.skip(captures); - return new Token('selector', selector); - } - } -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/middleware.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/middleware.js deleted file mode 100644 index 4f218255..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/middleware.js +++ /dev/null @@ -1,256 +0,0 @@ -/*! - * Stylus - middleware - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var stylus = require('./stylus') - , fs = require('fs') - , url = require('url') - , dirname = require('path').dirname - , join = require('path').join - , sep = require('path').sep - , debug = require('debug')('stylus:middleware') - , mkdir = fs.mkdir; - -/** - * Import map. - */ - -var imports = {}; - -/** - * Return Connect middleware with the given `options`. - * - * Options: - * - * `force` Always re-compile - * `src` Source directory used to find .styl files, - * a string or function accepting `(path)` of request. - * `dest` Destination directory used to output .css files, - * a string or function accepting `(path)` of request, - * when undefined defaults to `src`. - * `compile` Custom compile function, accepting the arguments - * `(str, path)`. - * `compress` Whether the output .css files should be compressed - * `firebug` Emits debug infos in the generated CSS that can - * be used by the FireStylus Firebug plugin - * `linenos` Emits comments in the generated CSS indicating - * the corresponding Stylus line - * 'sourcemap' Generates a sourcemap in sourcemaps v3 format - * - * Examples: - * - * Here we set up the custom compile function so that we may - * set the `compress` option, or define additional functions. - * - * By default the compile function simply sets the `filename` - * and renders the CSS. - * - * function compile(str, path) { - * return stylus(str) - * .set('filename', path) - * .set('compress', true); - * } - * - * Pass the middleware to Connect, grabbing .styl files from this directory - * and saving .css files to _./public_. Also supplying our custom `compile` function. - * - * Following that we have a `static()` layer setup to serve the .css - * files generated by Stylus. - * - * var app = connect(); - * - * app.middleware({ - * src: __dirname - * , dest: __dirname + '/public' - * , compile: compile - * }) - * - * app.use(connect.static(__dirname + '/public')); - * - * @param {Object} options - * @return {Function} - * @api public - */ - -module.exports = function(options){ - options = options || {}; - - // Accept src/dest dir - if ('string' == typeof options) { - options = { src: options }; - } - - // Force compilation - var force = options.force; - - // Source dir required - var src = options.src; - if (!src) throw new Error('stylus.middleware() requires "src" directory'); - - // Default dest dir to source - var dest = options.dest || src; - - // Default compile callback - options.compile = options.compile || function(str, path){ - // inline sourcemap - if (options.sourcemap) { - if ('boolean' == typeof options.sourcemap) - options.sourcemap = {}; - options.sourcemap.inline = true; - } - - return stylus(str) - .set('filename', path) - .set('compress', options.compress) - .set('firebug', options.firebug) - .set('linenos', options.linenos) - .set('sourcemap', options.sourcemap); - }; - - // Middleware - return function stylus(req, res, next){ - if ('GET' != req.method && 'HEAD' != req.method) return next(); - var path = url.parse(req.url).pathname; - if (/\.css$/.test(path)) { - - if (typeof dest == 'string') { - // check for dest-path overlap - var overlap = compare(dest, path).length; - if ('/' == path.charAt(0)) overlap++; - path = path.slice(overlap); - } - - var cssPath, stylusPath; - cssPath = (typeof dest == 'function') - ? dest(path) - : join(dest, path); - stylusPath = (typeof src == 'function') - ? src(path) - : join(src, path.replace('.css', '.styl')); - - // Ignore ENOENT to fall through as 404 - function error(err) { - next('ENOENT' == err.code - ? null - : err); - } - - // Force - if (force) return compile(); - - // Compile to cssPath - function compile() { - debug('read %s', cssPath); - fs.readFile(stylusPath, 'utf8', function(err, str){ - if (err) return error(err); - var style = options.compile(str, stylusPath); - var paths = style.options._imports = []; - imports[stylusPath] = null; - style.render(function(err, css){ - if (err) return next(err); - debug('render %s', stylusPath); - imports[stylusPath] = paths; - mkdir(dirname(cssPath), { mode: parseInt('0700', 8), recursive: true }, function(err){ - if (err) return error(err); - fs.writeFile(cssPath, css, 'utf8', next); - }); - }); - }); - } - - // Re-compile on server restart, disregarding - // mtimes since we need to map imports - if (!imports[stylusPath]) return compile(); - - // Compare mtimes - fs.stat(stylusPath, function(err, stylusStats){ - if (err) return error(err); - fs.stat(cssPath, function(err, cssStats){ - // CSS has not been compiled, compile it! - if (err) { - if ('ENOENT' == err.code) { - debug('not found %s', cssPath); - compile(); - } else { - next(err); - } - } else { - // Source has changed, compile it - if (stylusStats.mtime > cssStats.mtime) { - debug('modified %s', cssPath); - compile(); - // Already compiled, check imports - } else { - checkImports(stylusPath, function(changed){ - if (debug && changed.length) { - changed.forEach(function(path) { - debug('modified import %s', path); - }); - } - changed.length ? compile() : next(); - }); - } - } - }); - }); - } else { - next(); - } - } -}; - -/** - * Check `path`'s imports to see if they have been altered. - * - * @param {String} path - * @param {Function} fn - * @api private - */ - -function checkImports(path, fn) { - var nodes = imports[path]; - if (!nodes) return fn(); - if (!nodes.length) return fn(); - - var pending = nodes.length - , changed = []; - - nodes.forEach(function(imported){ - fs.stat(imported.path, function(err, stat){ - // error or newer mtime - if (err || !imported.mtime || stat.mtime > imported.mtime) { - changed.push(imported.path); - } - --pending || fn(changed); - }); - }); -} - -/** - * get the overlaping path from the end of path A, and the begining of path B. - * - * @param {String} pathA - * @param {String} pathB - * @return {String} - * @api private - */ - -function compare(pathA, pathB) { - pathA = pathA.split(sep); - pathB = pathB.split('/'); - if (!pathA[pathA.length - 1]) pathA.pop(); - if (!pathB[0]) pathB.shift(); - var overlap = []; - - while (pathA[pathA.length - 1] == pathB[0]) { - overlap.push(pathA.pop()); - pathB.shift(); - } - return overlap.join('/'); -} diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/arguments.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/arguments.js deleted file mode 100644 index 90abea28..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/arguments.js +++ /dev/null @@ -1,90 +0,0 @@ - -/*! - * Stylus - Arguments - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var nodes = require('../nodes'); - -/** - * Initialize a new `Arguments`. - * - * @api public - */ - -var Arguments = module.exports = function Arguments(){ - nodes.Expression.call(this); - this.map = {}; -}; - -/** - * Inherit from `nodes.Expression.prototype`. - */ - -Arguments.prototype.__proto__ = nodes.Expression.prototype; - -/** - * Initialize an `Arguments` object with the nodes - * from the given `expr`. - * - * @param {Expression} expr - * @return {Arguments} - * @api public - */ - -Arguments.fromExpression = function(expr){ - var args = new Arguments - , len = expr.nodes.length; - args.lineno = expr.lineno; - args.column = expr.column; - args.isList = expr.isList; - for (var i = 0; i < len; ++i) { - args.push(expr.nodes[i]); - } - return args; -}; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Arguments.prototype.clone = function(parent){ - var clone = nodes.Expression.prototype.clone.call(this, parent); - clone.map = {}; - for (var key in this.map) { - clone.map[key] = this.map[key].clone(parent, clone); - } - clone.isList = this.isList; - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - return clone; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Arguments.prototype.toJSON = function(){ - return { - __type: 'Arguments', - map: this.map, - isList: this.isList, - preserve: this.preserve, - lineno: this.lineno, - column: this.column, - filename: this.filename, - nodes: this.nodes - }; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/atblock.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/atblock.js deleted file mode 100644 index a5dba7b3..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/atblock.js +++ /dev/null @@ -1,79 +0,0 @@ -/*! - * Stylus - @block - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `@block` node. - * - * @api public - */ - -var Atblock = module.exports = function Atblock(){ - Node.call(this); -}; - -/** - * Return `block` nodes. - */ - -Atblock.prototype.__defineGetter__('nodes', function(){ - return this.block.nodes; -}); - -/** - * Inherit from `Node.prototype`. - */ - -Atblock.prototype.__proto__ = Node.prototype; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Atblock.prototype.clone = function(parent){ - var clone = new Atblock; - clone.block = this.block.clone(parent, clone); - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - return clone; -}; - -/** - * Return @block. - * - * @return {String} - * @api public - */ - -Atblock.prototype.toString = function(){ - return '@block'; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Atblock.prototype.toJSON = function(){ - return { - __type: 'Atblock', - block: this.block, - lineno: this.lineno, - column: this.column, - fileno: this.fileno - }; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/atrule.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/atrule.js deleted file mode 100644 index 102be9fd..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/atrule.js +++ /dev/null @@ -1,136 +0,0 @@ -/*! - * Stylus - at-rule - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new at-rule node. - * - * @param {String} type - * @api public - */ - -var Atrule = module.exports = function Atrule(type){ - Node.call(this); - this.type = type; -}; - -/** - * Inherit from `Node.prototype`. - */ - -Atrule.prototype.__proto__ = Node.prototype; - -/** - * Check if at-rule's block has only properties. - * - * @return {Boolean} - * @api public - */ - -Atrule.prototype.__defineGetter__('hasOnlyProperties', function(){ - if (!this.block) return false; - - var nodes = this.block.nodes; - for (var i = 0, len = nodes.length; i < len; ++i) { - var nodeName = nodes[i].nodeName; - switch(nodes[i].nodeName) { - case 'property': - case 'expression': - case 'comment': - continue; - default: - return false; - } - } - return true; -}); - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Atrule.prototype.clone = function(parent){ - var clone = new Atrule(this.type); - if (this.block) clone.block = this.block.clone(parent, clone); - clone.segments = this.segments.map(function(node){ return node.clone(parent, clone); }); - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - return clone; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Atrule.prototype.toJSON = function(){ - var json = { - __type: 'Atrule', - type: this.type, - segments: this.segments, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; - if (this.block) json.block = this.block; - return json; -}; - -/** - * Return @. - * - * @return {String} - * @api public - */ - -Atrule.prototype.toString = function(){ - return '@' + this.type; -}; - -/** - * Check if the at-rule's block has output nodes. - * - * @return {Boolean} - * @api public - */ - -Atrule.prototype.__defineGetter__('hasOutput', function(){ - return !!this.block && hasOutput(this.block); -}); - -function hasOutput(block) { - var nodes = block.nodes; - - // only placeholder selectors - if (nodes.every(function(node){ - return 'group' == node.nodeName && node.hasOnlyPlaceholders; - })) return false; - - // something visible - return nodes.some(function(node) { - switch (node.nodeName) { - case 'property': - case 'literal': - case 'import': - return true; - case 'block': - return hasOutput(node); - default: - if (node.block) return hasOutput(node.block); - } - }); -} diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/binop.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/binop.js deleted file mode 100644 index c30833e7..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/binop.js +++ /dev/null @@ -1,83 +0,0 @@ - -/*! - * Stylus - BinOp - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `BinOp` with `op`, `left` and `right`. - * - * @param {String} op - * @param {Node} left - * @param {Node} right - * @api public - */ - -var BinOp = module.exports = function BinOp(op, left, right){ - Node.call(this); - this.op = op; - this.left = left; - this.right = right; -}; - -/** - * Inherit from `Node.prototype`. - */ - -BinOp.prototype.__proto__ = Node.prototype; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -BinOp.prototype.clone = function(parent){ - var clone = new BinOp(this.op); - clone.left = this.left.clone(parent, clone); - clone.right = this.right && this.right.clone(parent, clone); - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - if (this.val) clone.val = this.val.clone(parent, clone); - return clone; -}; - -/** - * Return - * - * @return {String} - * @api public - */ -BinOp.prototype.toString = function() { - return this.left.toString() + ' ' + this.op + ' ' + this.right.toString(); -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -BinOp.prototype.toJSON = function(){ - var json = { - __type: 'BinOp', - left: this.left, - right: this.right, - op: this.op, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; - if (this.val) json.val = this.val; - return json; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/block.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/block.js deleted file mode 100644 index 25e54094..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/block.js +++ /dev/null @@ -1,127 +0,0 @@ - -/*! - * Stylus - Block - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `Block` node with `parent` Block. - * - * @param {Block} parent - * @api public - */ - -var Block = module.exports = function Block(parent, node){ - Node.call(this); - this.nodes = []; - this.parent = parent; - this.node = node; - this.scope = true; -}; - -/** - * Inherit from `Node.prototype`. - */ - -Block.prototype.__proto__ = Node.prototype; - -/** - * Check if this block has properties.. - * - * @return {Boolean} - * @api public - */ - -Block.prototype.__defineGetter__('hasProperties', function(){ - for (var i = 0, len = this.nodes.length; i < len; ++i) { - if ('property' == this.nodes[i].nodeName) { - return true; - } - } -}); - -/** - * Check if this block has @media nodes. - * - * @return {Boolean} - * @api public - */ - -Block.prototype.__defineGetter__('hasMedia', function(){ - for (var i = 0, len = this.nodes.length; i < len; ++i) { - var nodeName = this.nodes[i].nodeName; - if ('media' == nodeName) { - return true; - } - } - return false; -}); - -/** - * Check if this block is empty. - * - * @return {Boolean} - * @api public - */ - -Block.prototype.__defineGetter__('isEmpty', function(){ - return !this.nodes.length || this.nodes.every(function(n){return n.nodeName == 'comment'}); -}); - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Block.prototype.clone = function(parent, node){ - parent = parent || this.parent; - var clone = new Block(parent, node || this.node); - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - clone.scope = this.scope; - this.nodes.forEach(function(node){ - clone.push(node.clone(clone, clone)); - }); - return clone; -}; - -/** - * Push a `node` to this block. - * - * @param {Node} node - * @api public - */ - -Block.prototype.push = function(node){ - this.nodes.push(node); -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Block.prototype.toJSON = function(){ - return { - __type: 'Block', - // parent: this.parent, - // node: this.node, - scope: this.scope, - lineno: this.lineno, - column: this.column, - filename: this.filename, - nodes: this.nodes - }; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/boolean.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/boolean.js deleted file mode 100644 index 2a4a5f93..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/boolean.js +++ /dev/null @@ -1,117 +0,0 @@ - -/*! - * Stylus - Boolean - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node') - , nodes = require('./'); - -/** - * Initialize a new `Boolean` node with the given `val`. - * - * @param {Boolean} val - * @api public - */ - -var Boolean = module.exports = function Boolean(val){ - Node.call(this); - if (this.nodeName) { - this.val = !!val; - } else { - return new Boolean(val); - } -}; - -/** - * Inherit from `Node.prototype`. - */ - -Boolean.prototype.__proto__ = Node.prototype; - -/** - * Return `this` node. - * - * @return {Boolean} - * @api public - */ - -Boolean.prototype.toBoolean = function(){ - return this; -}; - -/** - * Return `true` if this node represents `true`. - * - * @return {Boolean} - * @api public - */ - -Boolean.prototype.__defineGetter__('isTrue', function(){ - return this.val; -}); - -/** - * Return `true` if this node represents `false`. - * - * @return {Boolean} - * @api public - */ - -Boolean.prototype.__defineGetter__('isFalse', function(){ - return ! this.val; -}); - -/** - * Negate the value. - * - * @return {Boolean} - * @api public - */ - -Boolean.prototype.negate = function(){ - return new Boolean(!this.val); -}; - -/** - * Return 'Boolean'. - * - * @return {String} - * @api public - */ - -Boolean.prototype.inspect = function(){ - return '[Boolean ' + this.val + ']'; -}; - -/** - * Return 'true' or 'false'. - * - * @return {String} - * @api public - */ - -Boolean.prototype.toString = function(){ - return this.val - ? 'true' - : 'false'; -}; - -/** - * Return a JSON representaiton of this node. - * - * @return {Object} - * @api public - */ - -Boolean.prototype.toJSON = function(){ - return { - __type: 'Boolean', - val: this.val - }; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/call.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/call.js deleted file mode 100644 index 39b72665..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/call.js +++ /dev/null @@ -1,85 +0,0 @@ - -/*! - * Stylus - Call - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `Call` with `name` and `args`. - * - * @param {String} name - * @param {Expression} args - * @api public - */ - -var Call = module.exports = function Call(name, args){ - Node.call(this); - this.name = name; - this.args = args; -}; - -/** - * Inherit from `Node.prototype`. - */ - -Call.prototype.__proto__ = Node.prototype; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Call.prototype.clone = function(parent){ - var clone = new Call(this.name); - clone.args = this.args.clone(parent, clone); - if (this.block) clone.block = this.block.clone(parent, clone); - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - return clone; -}; - -/** - * Return (param1, param2, ...). - * - * @return {String} - * @api public - */ - -Call.prototype.toString = function(){ - var args = this.args.nodes.map(function(node) { - var str = node.toString(); - return str.slice(1, str.length - 1); - }).join(', '); - - return this.name + '(' + args + ')'; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Call.prototype.toJSON = function(){ - var json = { - __type: 'Call', - name: this.name, - args: this.args, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; - if (this.block) json.block = this.block; - return json; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/charset.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/charset.js deleted file mode 100644 index 4d072615..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/charset.js +++ /dev/null @@ -1,58 +0,0 @@ - -/*! - * Stylus - Charset - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `Charset` with the given `val` - * - * @param {String} val - * @api public - */ - -var Charset = module.exports = function Charset(val){ - Node.call(this); - this.val = val; -}; - -/** - * Inherit from `Node.prototype`. - */ - -Charset.prototype.__proto__ = Node.prototype; - -/** - * Return @charset "val". - * - * @return {String} - * @api public - */ - -Charset.prototype.toString = function(){ - return '@charset ' + this.val; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Charset.prototype.toJSON = function(){ - return { - __type: 'Charset', - val: this.val, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/comment.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/comment.js deleted file mode 100644 index 3fd44514..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/comment.js +++ /dev/null @@ -1,64 +0,0 @@ - -/*! - * Stylus - Comment - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `Comment` with the given `str`. - * - * @param {String} str - * @param {Boolean} suppress - * @param {Boolean} inline - * @api public - */ - -var Comment = module.exports = function Comment(str, suppress, inline){ - Node.call(this); - this.str = str; - this.suppress = suppress; - this.inline = inline; -}; - -/** - * Inherit from `Node.prototype`. - */ - -Comment.prototype.__proto__ = Node.prototype; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Comment.prototype.toJSON = function(){ - return { - __type: 'Comment', - str: this.str, - suppress: this.suppress, - inline: this.inline, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; - -/** - * Return comment. - * - * @return {String} - * @api public - */ - -Comment.prototype.toString = function(){ - return this.str; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/each.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/each.js deleted file mode 100644 index 5f2fe45f..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/each.js +++ /dev/null @@ -1,75 +0,0 @@ - -/*! - * Stylus - Each - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node') - , nodes = require('./'); - -/** - * Initialize a new `Each` node with the given `val` name, - * `key` name, `expr`, and `block`. - * - * @param {String} val - * @param {String} key - * @param {Expression} expr - * @param {Block} block - * @api public - */ - -var Each = module.exports = function Each(val, key, expr, block){ - Node.call(this); - this.val = val; - this.key = key; - this.expr = expr; - this.block = block; -}; - -/** - * Inherit from `Node.prototype`. - */ - -Each.prototype.__proto__ = Node.prototype; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Each.prototype.clone = function(parent){ - var clone = new Each(this.val, this.key); - clone.expr = this.expr.clone(parent, clone); - clone.block = this.block.clone(parent, clone); - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - return clone; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Each.prototype.toJSON = function(){ - return { - __type: 'Each', - val: this.val, - key: this.key, - expr: this.expr, - block: this.block, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/expression.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/expression.js deleted file mode 100644 index c1411a49..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/expression.js +++ /dev/null @@ -1,220 +0,0 @@ - -/*! - * Stylus - Expression - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node') - , nodes = require('../nodes') - , utils = require('../utils'); - -/** - * Initialize a new `Expression`. - * - * @param {Boolean} isList - * @api public - */ - -var Expression = module.exports = function Expression(isList){ - Node.call(this); - this.nodes = []; - this.isList = isList; -}; - -/** - * Check if the variable has a value. - * - * @return {Boolean} - * @api public - */ - -Expression.prototype.__defineGetter__('isEmpty', function(){ - return !this.nodes.length; -}); - -/** - * Return the first node in this expression. - * - * @return {Node} - * @api public - */ - -Expression.prototype.__defineGetter__('first', function(){ - return this.nodes[0] - ? this.nodes[0].first - : nodes.null; -}); - -/** - * Hash all the nodes in order. - * - * @return {String} - * @api public - */ - -Expression.prototype.__defineGetter__('hash', function(){ - return this.nodes.map(function(node){ - return node.hash; - }).join('::'); -}); - -/** - * Inherit from `Node.prototype`. - */ - -Expression.prototype.__proto__ = Node.prototype; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Expression.prototype.clone = function(parent){ - var clone = new this.constructor(this.isList); - clone.preserve = this.preserve; - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - clone.nodes = this.nodes.map(function(node) { - return node.clone(parent, clone); - }); - return clone; -}; - -/** - * Push the given `node`. - * - * @param {Node} node - * @api public - */ - -Expression.prototype.push = function(node){ - this.nodes.push(node); -}; - -/** - * Operate on `right` with the given `op`. - * - * @param {String} op - * @param {Node} right - * @return {Node} - * @api public - */ - -Expression.prototype.operate = function(op, right, val){ - switch (op) { - case '[]=': - var self = this - , range = utils.unwrap(right).nodes - , val = utils.unwrap(val) - , len - , node; - range.forEach(function(unit){ - len = self.nodes.length; - if ('unit' == unit.nodeName) { - var i = unit.val < 0 ? len + unit.val : unit.val - , n = i; - while (i-- > len) self.nodes[i] = nodes.null; - self.nodes[n] = val; - } else if (unit.string) { - node = self.nodes[0]; - if (node && 'object' == node.nodeName) node.set(unit.string, val.clone()); - } - }); - return val; - case '[]': - var expr = new nodes.Expression - , vals = utils.unwrap(this).nodes - , range = utils.unwrap(right).nodes - , node; - range.forEach(function(unit){ - if ('unit' == unit.nodeName) { - node = vals[unit.val < 0 ? vals.length + unit.val : unit.val]; - } else if ('object' == vals[0].nodeName) { - node = vals[0].get(unit.string); - } - if (node) expr.push(node); - }); - return expr.isEmpty - ? nodes.null - : utils.unwrap(expr); - case '||': - return this.toBoolean().isTrue - ? this - : right; - case 'in': - return Node.prototype.operate.call(this, op, right); - case '!=': - return this.operate('==', right, val).negate(); - case '==': - var len = this.nodes.length - , right = right.toExpression() - , a - , b; - if (len != right.nodes.length) return nodes.false; - for (var i = 0; i < len; ++i) { - a = this.nodes[i]; - b = right.nodes[i]; - if (a.operate(op, b).isTrue) continue; - return nodes.false; - } - return nodes.true; - break; - default: - return this.first.operate(op, right, val); - } -}; - -/** - * Expressions with length > 1 are truthy, - * otherwise the first value's toBoolean() - * method is invoked. - * - * @return {Boolean} - * @api public - */ - -Expression.prototype.toBoolean = function(){ - if (this.nodes.length > 1) return nodes.true; - return this.first.toBoolean(); -}; - -/** - * Return " " or ", , " if - * the expression represents a list. - * - * @return {String} - * @api public - */ - -Expression.prototype.toString = function(){ - return '(' + this.nodes.map(function(node){ - return node.toString(); - }).join(this.isList ? ', ' : ' ') + ')'; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Expression.prototype.toJSON = function(){ - return { - __type: 'Expression', - isList: this.isList, - preserve: this.preserve, - lineno: this.lineno, - column: this.column, - filename: this.filename, - nodes: this.nodes - }; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/extend.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/extend.js deleted file mode 100644 index 45d39b73..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/extend.js +++ /dev/null @@ -1,69 +0,0 @@ - -/*! - * Stylus - Extend - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `Extend` with the given `selectors` array. - * - * @param {Array} selectors array of the selectors - * @api public - */ - -var Extend = module.exports = function Extend(selectors){ - Node.call(this); - this.selectors = selectors; -}; - -/** - * Inherit from `Node.prototype`. - */ - -Extend.prototype.__proto__ = Node.prototype; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Extend.prototype.clone = function(){ - return new Extend(this.selectors); -}; - -/** - * Return `@extend selectors`. - * - * @return {String} - * @api public - */ - -Extend.prototype.toString = function(){ - return '@extend ' + this.selectors.join(', '); -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Extend.prototype.toJSON = function(){ - return { - __type: 'Extend', - selectors: this.selectors, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/feature.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/feature.js deleted file mode 100644 index c8e112a5..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/feature.js +++ /dev/null @@ -1,84 +0,0 @@ - -/*! - * Stylus - Feature - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `Feature` with the given `segs`. - * - * @param {Array} segs - * @api public - */ - -var Feature = module.exports = function Feature(segs){ - Node.call(this); - this.segments = segs; - this.expr = null; -}; - -/** - * Inherit from `Node.prototype`. - */ - -Feature.prototype.__proto__ = Node.prototype; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Feature.prototype.clone = function(parent){ - var clone = new Feature; - clone.segments = this.segments.map(function(node){ return node.clone(parent, clone); }); - if (this.expr) clone.expr = this.expr.clone(parent, clone); - if (this.name) clone.name = this.name; - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - return clone; -}; - -/** - * Return "" or "(: )" - * - * @return {String} - * @api public - */ - -Feature.prototype.toString = function(){ - if (this.expr) { - return '(' + this.segments.join('') + ': ' + this.expr.toString() + ')'; - } else { - return this.segments.join(''); - } -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Feature.prototype.toJSON = function(){ - var json = { - __type: 'Feature', - segments: this.segments, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; - if (this.expr) json.expr = this.expr; - if (this.name) json.name = this.name; - return json; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/function.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/function.js deleted file mode 100644 index 68168285..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/function.js +++ /dev/null @@ -1,128 +0,0 @@ - -/*! - * Stylus - Function - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `Function` with `name`, `params`, and `body`. - * - * @param {String} name - * @param {Params|Function} params - * @param {Block} body - * @api public - */ - -var Function = module.exports = function Function(name, params, body){ - Node.call(this); - this.name = name; - this.params = params; - this.block = body; - if ('function' == typeof params) this.fn = params; -}; - -/** - * Check function arity. - * - * @return {Boolean} - * @api public - */ - -Function.prototype.__defineGetter__('arity', function(){ - return this.params.length; -}); - -/** - * Inherit from `Node.prototype`. - */ - -Function.prototype.__proto__ = Node.prototype; - -/** - * Return hash. - * - * @return {String} - * @api public - */ - -Function.prototype.__defineGetter__('hash', function(){ - return 'function ' + this.name; -}); - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Function.prototype.clone = function(parent){ - if (this.fn) { - var clone = new Function( - this.name - , this.fn); - } else { - var clone = new Function(this.name); - clone.params = this.params.clone(parent, clone); - clone.block = this.block.clone(parent, clone); - } - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - return clone; -}; - -/** - * Return (param1, param2, ...). - * - * @return {String} - * @api public - */ - -Function.prototype.toString = function(){ - if (this.fn) { - return this.name - + '(' - + this.fn.toString() - .match(/^function *\w*\((.*?)\)/) - .slice(1) - .join(', ') - + ')'; - } else { - return this.name - + '(' - + this.params.nodes.join(', ') - + ')'; - } -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Function.prototype.toJSON = function(){ - var json = { - __type: 'Function', - name: this.name, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; - if (this.fn) { - json.fn = this.fn; - } else { - json.params = this.params; - json.block = this.block; - } - return json; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/group.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/group.js deleted file mode 100644 index 0ff2a901..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/group.js +++ /dev/null @@ -1,110 +0,0 @@ - -/*! - * Stylus - Group - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `Group`. - * - * @api public - */ - -var Group = module.exports = function Group(){ - Node.call(this); - this.nodes = []; - this.extends = []; -}; - -/** - * Inherit from `Node.prototype`. - */ - -Group.prototype.__proto__ = Node.prototype; - -/** - * Push the given `selector` node. - * - * @param {Selector} selector - * @api public - */ - -Group.prototype.push = function(selector){ - this.nodes.push(selector); -}; - -/** - * Return this set's `Block`. - */ - -Group.prototype.__defineGetter__('block', function(){ - return this.nodes[0].block; -}); - -/** - * Assign `block` to each selector in this set. - * - * @param {Block} block - * @api public - */ - -Group.prototype.__defineSetter__('block', function(block){ - for (var i = 0, len = this.nodes.length; i < len; ++i) { - this.nodes[i].block = block; - } -}); - -/** - * Check if this set has only placeholders. - * - * @return {Boolean} - * @api public - */ - -Group.prototype.__defineGetter__('hasOnlyPlaceholders', function(){ - return this.nodes.every(function(selector) { return selector.isPlaceholder; }); -}); - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Group.prototype.clone = function(parent){ - var clone = new Group; - clone.lineno = this.lineno; - clone.column = this.column; - this.nodes.forEach(function(node){ - clone.push(node.clone(parent, clone)); - }); - clone.filename = this.filename; - clone.block = this.block.clone(parent, clone); - return clone; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Group.prototype.toJSON = function(){ - return { - __type: 'Group', - nodes: this.nodes, - block: this.block, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/hsla.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/hsla.js deleted file mode 100644 index 8396834b..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/hsla.js +++ /dev/null @@ -1,277 +0,0 @@ - -/*! - * Stylus - HSLA - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node') - , nodes = require('./'); - -/** - * Initialize a new `HSLA` with the given h,s,l,a component values. - * - * @param {Number} h - * @param {Number} s - * @param {Number} l - * @param {Number} a - * @api public - */ - -var HSLA = exports = module.exports = function HSLA(h,s,l,a){ - Node.call(this); - this.h = clampDegrees(h); - this.s = clampPercentage(s); - this.l = clampPercentage(l); - this.a = clampAlpha(a); - this.hsla = this; -}; - -/** - * Inherit from `Node.prototype`. - */ - -HSLA.prototype.__proto__ = Node.prototype; - -/** - * Return hsla(n,n,n,n). - * - * @return {String} - * @api public - */ - -HSLA.prototype.toString = function(){ - return 'hsla(' - + this.h + ',' - + this.s.toFixed(0) + '%,' - + this.l.toFixed(0) + '%,' - + this.a + ')'; -}; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -HSLA.prototype.clone = function(parent){ - var clone = new HSLA( - this.h - , this.s - , this.l - , this.a); - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - return clone; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -HSLA.prototype.toJSON = function(){ - return { - __type: 'HSLA', - h: this.h, - s: this.s, - l: this.l, - a: this.a, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; - -/** - * Return rgba `RGBA` representation. - * - * @return {RGBA} - * @api public - */ - -HSLA.prototype.__defineGetter__('rgba', function(){ - return nodes.RGBA.fromHSLA(this); -}); - -/** - * Return hash. - * - * @return {String} - * @api public - */ - -HSLA.prototype.__defineGetter__('hash', function(){ - return this.rgba.toString(); -}); - -/** - * Add h,s,l to the current component values. - * - * @param {Number} h - * @param {Number} s - * @param {Number} l - * @return {HSLA} new node - * @api public - */ - -HSLA.prototype.add = function(h,s,l){ - return new HSLA( - this.h + h - , this.s + s - , this.l + l - , this.a); -}; - -/** - * Subtract h,s,l from the current component values. - * - * @param {Number} h - * @param {Number} s - * @param {Number} l - * @return {HSLA} new node - * @api public - */ - -HSLA.prototype.sub = function(h,s,l){ - return this.add(-h, -s, -l); -}; - -/** - * Operate on `right` with the given `op`. - * - * @param {String} op - * @param {Node} right - * @return {Node} - * @api public - */ - -HSLA.prototype.operate = function(op, right){ - switch (op) { - case '==': - case '!=': - case '<=': - case '>=': - case '<': - case '>': - case 'is a': - case '||': - case '&&': - return this.rgba.operate(op, right); - default: - return this.rgba.operate(op, right).hsla; - } -}; - -/** - * Return `HSLA` representation of the given `color`. - * - * @param {RGBA} color - * @return {HSLA} - * @api public - */ - -exports.fromRGBA = function(rgba){ - var r = rgba.r / 255 - , g = rgba.g / 255 - , b = rgba.b / 255 - , a = rgba.a; - - var min = Math.min(r,g,b) - , max = Math.max(r,g,b) - , l = (max + min) / 2 - , d = max - min - , h, s; - - switch (max) { - case min: h = 0; break; - case r: h = 60 * (g-b) / d; break; - case g: h = 60 * (b-r) / d + 120; break; - case b: h = 60 * (r-g) / d + 240; break; - } - - if (max == min) { - s = 0; - } else if (l < .5) { - s = d / (2 * l); - } else { - s = d / (2 - 2 * l); - } - - h %= 360; - s *= 100; - l *= 100; - - return new HSLA(h,s,l,a); -}; - -/** - * Adjust lightness by `percent`. - * - * @param {Number} percent - * @return {HSLA} for chaining - * @api public - */ - -HSLA.prototype.adjustLightness = function(percent){ - this.l = clampPercentage(this.l + this.l * (percent / 100)); - return this; -}; - -/** - * Adjust hue by `deg`. - * - * @param {Number} deg - * @return {HSLA} for chaining - * @api public - */ - -HSLA.prototype.adjustHue = function(deg){ - this.h = clampDegrees(this.h + deg); - return this; -}; - -/** - * Clamp degree `n` >= 0 and <= 360. - * - * @param {Number} n - * @return {Number} - * @api private - */ - -function clampDegrees(n) { - n = n % 360; - return n >= 0 ? n : 360 + n; -} - -/** - * Clamp percentage `n` >= 0 and <= 100. - * - * @param {Number} n - * @return {Number} - * @api private - */ - -function clampPercentage(n) { - return Math.max(0, Math.min(n, 100)); -} - -/** - * Clamp alpha `n` >= 0 and <= 1. - * - * @param {Number} n - * @return {Number} - * @api private - */ - -function clampAlpha(n) { - return Math.max(0, Math.min(n, 1)); -} diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/ident.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/ident.js deleted file mode 100644 index 44498aeb..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/ident.js +++ /dev/null @@ -1,156 +0,0 @@ - -/*! - * Stylus - Ident - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node') - , nodes = require('./'); - -/** - * Initialize a new `Ident` by `name` with the given `val` node. - * - * @param {String} name - * @param {Node} val - * @api public - */ - -var Ident = module.exports = function Ident(name, val, mixin){ - Node.call(this); - this.name = name; - this.string = name; - this.val = val || nodes.null; - this.mixin = !!mixin; -}; - -/** - * Check if the variable has a value. - * - * @return {Boolean} - * @api public - */ - -Ident.prototype.__defineGetter__('isEmpty', function(){ - return undefined == this.val; -}); - -/** - * Return hash. - * - * @return {String} - * @api public - */ - -Ident.prototype.__defineGetter__('hash', function(){ - return this.name; -}); - -/** - * Inherit from `Node.prototype`. - */ - -Ident.prototype.__proto__ = Node.prototype; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Ident.prototype.clone = function(parent){ - var clone = new Ident(this.name); - clone.val = this.val.clone(parent, clone); - clone.mixin = this.mixin; - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - clone.property = this.property; - clone.rest = this.rest; - return clone; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Ident.prototype.toJSON = function(){ - return { - __type: 'Ident', - name: this.name, - val: this.val, - mixin: this.mixin, - property: this.property, - rest: this.rest, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; - -/** - * Return . - * - * @return {String} - * @api public - */ - -Ident.prototype.toString = function(){ - return this.name; -}; - -/** - * Coerce `other` to an ident. - * - * @param {Node} other - * @return {String} - * @api public - */ - -Ident.prototype.coerce = function(other){ - switch (other.nodeName) { - case 'ident': - case 'string': - case 'literal': - return new Ident(other.string); - case 'unit': - return new Ident(other.toString()); - default: - return Node.prototype.coerce.call(this, other); - } -}; - -/** - * Operate on `right` with the given `op`. - * - * @param {String} op - * @param {Node} right - * @return {Node} - * @api public - */ - -Ident.prototype.operate = function(op, right){ - var val = right.first; - switch (op) { - case '-': - if ('unit' == val.nodeName) { - var expr = new nodes.Expression; - val = val.clone(); - val.val = -val.val; - expr.push(this); - expr.push(val); - return expr; - } - case '+': - return new nodes.Ident(this.string + this.coerce(val).string); - } - return Node.prototype.operate.call(this, op, right); -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/if.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/if.js deleted file mode 100644 index aa963865..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/if.js +++ /dev/null @@ -1,78 +0,0 @@ - -/*! - * Stylus - If - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `If` with the given `cond`. - * - * @param {Expression} cond - * @param {Boolean|Block} negate, block - * @api public - */ - -var If = module.exports = function If(cond, negate){ - Node.call(this); - this.cond = cond; - this.elses = []; - if (negate && negate.nodeName) { - this.block = negate; - } else { - this.negate = negate; - } -}; - -/** - * Inherit from `Node.prototype`. - */ - -If.prototype.__proto__ = Node.prototype; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -If.prototype.clone = function(parent){ - var clone = new If(); - clone.cond = this.cond.clone(parent, clone); - clone.block = this.block.clone(parent, clone); - clone.elses = this.elses.map(function(node){ return node.clone(parent, clone); }); - clone.negate = this.negate; - clone.postfix = this.postfix; - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - return clone; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -If.prototype.toJSON = function(){ - return { - __type: 'If', - cond: this.cond, - block: this.block, - elses: this.elses, - negate: this.negate, - postfix: this.postfix, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/import.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/import.js deleted file mode 100644 index 6f69ce19..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/import.js +++ /dev/null @@ -1,68 +0,0 @@ - -/*! - * Stylus - Import - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `Import` with the given `expr`. - * - * @param {Expression} expr - * @api public - */ - -var Import = module.exports = function Import(expr, once){ - Node.call(this); - this.path = expr; - this.once = once || false; -}; - -/** - * Inherit from `Node.prototype`. - */ - -Import.prototype.__proto__ = Node.prototype; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Import.prototype.clone = function(parent){ - var clone = new Import(); - clone.path = this.path.nodeName ? this.path.clone(parent, clone) : this.path; - clone.once = this.once; - clone.mtime = this.mtime; - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - return clone; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Import.prototype.toJSON = function(){ - return { - __type: 'Import', - path: this.path, - once: this.once, - mtime: this.mtime, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/index.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/index.js deleted file mode 100644 index bceab70c..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/index.js +++ /dev/null @@ -1,63 +0,0 @@ - -/*! - * Stylus - nodes - * Copyright (c) Automattic - * MIT Licensed - */ - -exports.lineno = null; -exports.column = null; -exports.filename = null; - -/** - * Constructors - */ - -exports.Node = require('./node'); -exports.Root = require('./root'); -exports.Null = require('./null'); -exports.Each = require('./each'); -exports.If = require('./if'); -exports.Call = require('./call'); -exports.UnaryOp = require('./unaryop'); -exports.BinOp = require('./binop'); -exports.Ternary = require('./ternary'); -exports.Block = require('./block'); -exports.Unit = require('./unit'); -exports.String = require('./string'); -exports.HSLA = require('./hsla'); -exports.RGBA = require('./rgba'); -exports.Ident = require('./ident'); -exports.Group = require('./group'); -exports.Literal = require('./literal'); -exports.Boolean = require('./boolean'); -exports.Return = require('./return'); -exports.Media = require('./media'); -exports.QueryList = require('./query-list'); -exports.Query = require('./query'); -exports.Feature = require('./feature'); -exports.Params = require('./params'); -exports.Comment = require('./comment'); -exports.Keyframes = require('./keyframes'); -exports.Member = require('./member'); -exports.Charset = require('./charset'); -exports.Namespace = require('./namespace'); -exports.Import = require('./import'); -exports.Extend = require('./extend'); -exports.Object = require('./object'); -exports.Function = require('./function'); -exports.Property = require('./property'); -exports.Selector = require('./selector'); -exports.Expression = require('./expression'); -exports.Arguments = require('./arguments'); -exports.Atblock = require('./atblock'); -exports.Atrule = require('./atrule'); -exports.Supports = require('./supports'); - -/** - * Singletons. - */ - -exports.true = new exports.Boolean(true); -exports.false = new exports.Boolean(false); -exports.null = new exports.Null; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/keyframes.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/keyframes.js deleted file mode 100644 index d84a2ee5..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/keyframes.js +++ /dev/null @@ -1,81 +0,0 @@ - -/*! - * Stylus - Keyframes - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Atrule = require('./atrule'); - -/** - * Initialize a new `Keyframes` with the given `segs`, - * and optional vendor `prefix`. - * - * @param {Array} segs - * @param {String} prefix - * @api public - */ - -var Keyframes = module.exports = function Keyframes(segs, prefix){ - Atrule.call(this, 'keyframes'); - this.segments = segs; - this.prefix = prefix || 'official'; -}; - -/** - * Inherit from `Atrule.prototype`. - */ - -Keyframes.prototype.__proto__ = Atrule.prototype; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Keyframes.prototype.clone = function(parent){ - var clone = new Keyframes; - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - clone.segments = this.segments.map(function(node) { return node.clone(parent, clone); }); - clone.prefix = this.prefix; - clone.block = this.block.clone(parent, clone); - return clone; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Keyframes.prototype.toJSON = function(){ - return { - __type: 'Keyframes', - segments: this.segments, - prefix: this.prefix, - block: this.block, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; - -/** - * Return `@keyframes name`. - * - * @return {String} - * @api public - */ - -Keyframes.prototype.toString = function(){ - return '@keyframes ' + this.segments.join(''); -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/literal.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/literal.js deleted file mode 100644 index 0c25c7f3..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/literal.js +++ /dev/null @@ -1,112 +0,0 @@ - -/*! - * Stylus - Literal - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node') - , nodes = require('./'); - -/** - * Initialize a new `Literal` with the given `str`. - * - * @param {String} str - * @api public - */ - -var Literal = module.exports = function Literal(str){ - Node.call(this); - this.val = str; - this.string = str; - this.prefixed = false; -}; - -/** - * Inherit from `Node.prototype`. - */ - -Literal.prototype.__proto__ = Node.prototype; - -/** - * Return hash. - * - * @return {String} - * @api public - */ - -Literal.prototype.__defineGetter__('hash', function(){ - return this.val; -}); - -/** - * Return literal value. - * - * @return {String} - * @api public - */ - -Literal.prototype.toString = function(){ - return this.val.toString(); -}; - -/** - * Coerce `other` to a literal. - * - * @param {Node} other - * @return {String} - * @api public - */ - -Literal.prototype.coerce = function(other){ - switch (other.nodeName) { - case 'ident': - case 'string': - case 'literal': - return new Literal(other.string); - default: - return Node.prototype.coerce.call(this, other); - } -}; - -/** - * Operate on `right` with the given `op`. - * - * @param {String} op - * @param {Node} right - * @return {Node} - * @api public - */ - -Literal.prototype.operate = function(op, right){ - var val = right.first; - switch (op) { - case '+': - return new nodes.Literal(this.string + this.coerce(val).string); - default: - return Node.prototype.operate.call(this, op, right); - } -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Literal.prototype.toJSON = function(){ - return { - __type: 'Literal', - val: this.val, - string: this.string, - prefixed: this.prefixed, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/media.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/media.js deleted file mode 100644 index 6633098d..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/media.js +++ /dev/null @@ -1,76 +0,0 @@ - -/*! - * Stylus - Media - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Atrule = require('./atrule'); - -/** - * Initialize a new `Media` with the given `val` - * - * @param {String} val - * @api public - */ - -var Media = module.exports = function Media(val){ - Atrule.call(this, 'media'); - this.val = val; -}; - -/** - * Inherit from `Atrule.prototype`. - */ - -Media.prototype.__proto__ = Atrule.prototype; - -/** - * Clone this node. - * - * @return {Media} - * @api public - */ - -Media.prototype.clone = function(parent){ - var clone = new Media; - clone.val = this.val.clone(parent, clone); - clone.block = this.block.clone(parent, clone); - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - return clone; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Media.prototype.toJSON = function(){ - return { - __type: 'Media', - val: this.val, - block: this.block, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; - -/** - * Return @media "val". - * - * @return {String} - * @api public - */ - -Media.prototype.toString = function(){ - return '@media ' + this.val; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/member.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/member.js deleted file mode 100644 index c66b749d..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/member.js +++ /dev/null @@ -1,82 +0,0 @@ - -/*! - * Stylus - Member - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `Member` with `left` and `right`. - * - * @param {Node} left - * @param {Node} right - * @api public - */ - -var Member = module.exports = function Member(left, right){ - Node.call(this); - this.left = left; - this.right = right; -}; - -/** - * Inherit from `Node.prototype`. - */ - -Member.prototype.__proto__ = Node.prototype; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Member.prototype.clone = function(parent){ - var clone = new Member; - clone.left = this.left.clone(parent, clone); - clone.right = this.right.clone(parent, clone); - if (this.val) clone.val = this.val.clone(parent, clone); - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - return clone; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Member.prototype.toJSON = function(){ - var json = { - __type: 'Member', - left: this.left, - right: this.right, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; - if (this.val) json.val = this.val; - return json; -}; - -/** - * Return a string representation of this node. - * - * @return {String} - * @api public - */ - -Member.prototype.toString = function(){ - return this.left.toString() - + '.' + this.right.toString(); -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/namespace.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/namespace.js deleted file mode 100644 index d44a0919..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/namespace.js +++ /dev/null @@ -1,60 +0,0 @@ -/*! - * Stylus - Namespace - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `Namespace` with the given `val` and `prefix` - * - * @param {String|Call} val - * @param {String} [prefix] - * @api public - */ - -var Namespace = module.exports = function Namespace(val, prefix){ - Node.call(this); - this.val = val; - this.prefix = prefix; -}; - -/** - * Inherit from `Node.prototype`. - */ - -Namespace.prototype.__proto__ = Node.prototype; - -/** - * Return @namespace "val". - * - * @return {String} - * @api public - */ - -Namespace.prototype.toString = function(){ - return '@namespace ' + (this.prefix ? this.prefix + ' ' : '') + this.val; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Namespace.prototype.toJSON = function(){ - return { - __type: 'Namespace', - val: this.val, - prefix: this.prefix, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/node.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/node.js deleted file mode 100644 index b9a93538..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/node.js +++ /dev/null @@ -1,252 +0,0 @@ - -/*! - * Stylus - Node - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Evaluator = require('../visitor/evaluator') - , utils = require('../utils') - , nodes = require('./'); - -/** - * Initialize a new `CoercionError` with the given `msg`. - * - * @param {String} msg - * @api private - */ - -function CoercionError(msg) { - this.name = 'CoercionError' - this.message = msg - if (Error.captureStackTrace) { - Error.captureStackTrace(this, CoercionError); - } -} - -/** - * Inherit from `Error.prototype`. - */ - -CoercionError.prototype.__proto__ = Error.prototype; - -/** - * Node constructor. - * - * @api public - */ - -var Node = module.exports = function Node(){ - this.lineno = nodes.lineno || 1; - this.column = nodes.column || 1; - this.filename = nodes.filename; -}; - -Node.prototype = { - constructor: Node, - - /** - * Return this node. - * - * @return {Node} - * @api public - */ - - get first() { - return this; - }, - - /** - * Return hash. - * - * @return {String} - * @api public - */ - - get hash() { - return this.val; - }, - - /** - * Return node name. - * - * @return {String} - * @api public - */ - - get nodeName() { - return this.constructor.name.toLowerCase(); - }, - - /** - * Return this node. - * - * @return {Node} - * @api public - */ - - clone: function(){ - return this; - }, - - /** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - - toJSON: function(){ - return { - lineno: this.lineno, - column: this.column, - filename: this.filename - }; - }, - - /** - * Nodes by default evaluate to themselves. - * - * @return {Node} - * @api public - */ - - eval: function(){ - return new Evaluator(this).evaluate(); - }, - - /** - * Return true. - * - * @return {Boolean} - * @api public - */ - - toBoolean: function(){ - return nodes.true; - }, - - /** - * Return the expression, or wrap this node in an expression. - * - * @return {Expression} - * @api public - */ - - toExpression: function(){ - if ('expression' == this.nodeName) return this; - var expr = new nodes.Expression; - expr.push(this); - return expr; - }, - - /** - * Return false if `op` is generally not coerced. - * - * @param {String} op - * @return {Boolean} - * @api private - */ - - shouldCoerce: function(op){ - switch (op) { - case 'is a': - case 'in': - case '||': - case '&&': - return false; - default: - return true; - } - }, - - /** - * Operate on `right` with the given `op`. - * - * @param {String} op - * @param {Node} right - * @return {Node} - * @api public - */ - - operate: function(op, right){ - switch (op) { - case 'is a': - if ('string' == right.first.nodeName) { - return nodes.Boolean(this.nodeName == right.val); - } else { - throw new Error('"is a" expects a string, got ' + right.toString()); - } - case '==': - return nodes.Boolean(this.hash == right.hash); - case '!=': - return nodes.Boolean(this.hash != right.hash); - case '>=': - return nodes.Boolean(this.hash >= right.hash); - case '<=': - return nodes.Boolean(this.hash <= right.hash); - case '>': - return nodes.Boolean(this.hash > right.hash); - case '<': - return nodes.Boolean(this.hash < right.hash); - case '||': - return this.toBoolean().isTrue - ? this - : right; - case 'in': - var vals = utils.unwrap(right).nodes - , len = vals && vals.length - , hash = this.hash; - if (!vals) throw new Error('"in" given invalid right-hand operand, expecting an expression'); - - // 'prop' in obj - if (1 == len && 'object' == vals[0].nodeName) { - return nodes.Boolean(vals[0].has(this.hash)); - } - - for (var i = 0; i < len; ++i) { - if (hash == vals[i].hash) { - return nodes.true; - } - } - return nodes.false; - case '&&': - var a = this.toBoolean() - , b = right.toBoolean(); - return a.isTrue && b.isTrue - ? right - : a.isFalse - ? this - : right; - default: - if ('[]' == op) { - var msg = 'cannot perform ' - + this - + '[' + right + ']'; - } else { - var msg = 'cannot perform' - + ' ' + this - + ' ' + op - + ' ' + right; - } - throw new Error(msg); - } - }, - - /** - * Default coercion throws. - * - * @param {Node} other - * @return {Node} - * @api public - */ - - coerce: function(other){ - if (other.nodeName == this.nodeName) return other; - throw new CoercionError('cannot coerce ' + other + ' to ' + this.nodeName); - } -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/null.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/null.js deleted file mode 100644 index 4dd53990..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/null.js +++ /dev/null @@ -1,88 +0,0 @@ - -/*! - * Stylus - Null - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node') - , nodes = require('./'); - -/** - * Initialize a new `Null` node. - * - * @api public - */ - -var Null = module.exports = function Null(){}; - -/** - * Inherit from `Node.prototype`. - */ - -Null.prototype.__proto__ = Node.prototype; - -/** - * Return 'Null'. - * - * @return {String} - * @api public - */ - -Null.prototype.inspect = -Null.prototype.toString = function(){ - return 'null'; -}; - -/** - * Return false. - * - * @return {Boolean} - * @api public - */ - -Null.prototype.toBoolean = function(){ - return nodes.false; -}; - -/** - * Check if the node is a null node. - * - * @return {Boolean} - * @api public - */ - -Null.prototype.__defineGetter__('isNull', function(){ - return true; -}); - -/** - * Return hash. - * - * @return {String} - * @api public - */ - -Null.prototype.__defineGetter__('hash', function(){ - return null; -}); - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Null.prototype.toJSON = function(){ - return { - __type: 'Null', - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/object.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/object.js deleted file mode 100644 index b17d3892..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/object.js +++ /dev/null @@ -1,244 +0,0 @@ - -/*! - * Stylus - Object - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node') - , nodes = require('./') - , nativeObj = {}.constructor; - -/** - * Initialize a new `Object`. - * - * @api public - */ - -var Object = module.exports = function Object(){ - Node.call(this); - this.vals = {}; - this.keys = {}; -}; - -/** - * Inherit from `Node.prototype`. - */ - -Object.prototype.__proto__ = Node.prototype; - -/** - * Set `key` to `val`. - * - * @param {String} key - * @param {Node} val - * @return {Object} for chaining - * @api public - */ - -Object.prototype.setValue = function(key, val){ - this.vals[key] = val; - return this; -}; - -/** - * Alias for `setValue` for compatible API - */ -Object.prototype.set = Object.prototype.setValue; - -/** - * Set `key` to `val`. - * - * @param {String} key - * @param {Node} val - * @return {Object} for chaining - * @api public - */ - -Object.prototype.setKey = function(key, val){ - this.keys[key] = val; - return this; -}; - -/** - * Return length. - * - * @return {Number} - * @api public - */ - -Object.prototype.__defineGetter__('length', function() { - return nativeObj.keys(this.vals).length; -}); - -/** - * Get `key`. - * - * @param {String} key - * @return {Node} - * @api public - */ - -Object.prototype.get = function(key){ - return this.vals[key] || nodes.null; -}; - -/** - * Has `key`? - * - * @param {String} key - * @return {Boolean} - * @api public - */ - -Object.prototype.has = function(key){ - return key in this.vals; -}; - -/** - * Operate on `right` with the given `op`. - * - * @param {String} op - * @param {Node} right - * @return {Node} - * @api public - */ - -Object.prototype.operate = function(op, right){ - switch (op) { - case '.': - case '[]': - return this.get(right.hash); - case '==': - var vals = this.vals - , a - , b; - if ('object' != right.nodeName || this.length != right.length) - return nodes.false; - for (var key in vals) { - a = vals[key]; - b = right.vals[key]; - if (a.operate(op, b).isFalse) - return nodes.false; - } - return nodes.true; - case '!=': - return this.operate('==', right).negate(); - default: - return Node.prototype.operate.call(this, op, right); - } -}; - -/** - * Return Boolean based on the length of this object. - * - * @return {Boolean} - * @api public - */ - -Object.prototype.toBoolean = function(){ - return nodes.Boolean(this.length); -}; - -/** - * Convert object to string with properties. - * - * @return {String} - * @api private - */ - -Object.prototype.toBlock = function(){ - var str = '{' - , key - , val; - - for (key in this.vals) { - val = this.get(key); - if ('object' == val.first.nodeName) { - str += key + ' ' + val.first.toBlock(); - } else { - switch (key) { - case '@charset': - str += key + ' ' + val.first.toString() + ';'; - break; - default: - str += key + ':' + toString(val) + ';'; - } - } - } - - str += '}'; - - return str; - - function toString(node) { - if (node.nodes) { - return node.nodes.map(toString).join(node.isList ? ',' : ' '); - } else if ('literal' == node.nodeName && ',' == node.val) { - return '\\,'; - } - return node.toString(); - } -}; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Object.prototype.clone = function(parent){ - var clone = new Object; - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - - var key; - for (key in this.vals) { - clone.vals[key] = this.vals[key].clone(parent, clone); - } - - for (key in this.keys) { - clone.keys[key] = this.keys[key].clone(parent, clone); - } - - return clone; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Object.prototype.toJSON = function(){ - return { - __type: 'Object', - vals: this.vals, - keys: this.keys, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; - -/** - * Return "{ : }" - * - * @return {String} - * @api public - */ - -Object.prototype.toString = function(){ - var obj = {}; - for (var prop in this.vals) { - obj[prop] = this.vals[prop].toString(); - } - return JSON.stringify(obj); -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/params.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/params.js deleted file mode 100644 index 4751e0e6..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/params.js +++ /dev/null @@ -1,90 +0,0 @@ - -/*! - * Stylus - Params - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `Params` with `name`, `params`, and `body`. - * - * @param {String} name - * @param {Params} params - * @param {Expression} body - * @api public - */ - -var Params = module.exports = function Params(){ - Node.call(this); - this.nodes = []; -}; - -/** - * Check function arity. - * - * @return {Boolean} - * @api public - */ - -Params.prototype.__defineGetter__('length', function(){ - return this.nodes.length; -}); - -/** - * Inherit from `Node.prototype`. - */ - -Params.prototype.__proto__ = Node.prototype; - -/** - * Push the given `node`. - * - * @param {Node} node - * @api public - */ - -Params.prototype.push = function(node){ - this.nodes.push(node); -}; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Params.prototype.clone = function(parent){ - var clone = new Params; - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - this.nodes.forEach(function(node){ - clone.push(node.clone(parent, clone)); - }); - return clone; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Params.prototype.toJSON = function(){ - return { - __type: 'Params', - nodes: this.nodes, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; - diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/property.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/property.js deleted file mode 100644 index 0fd729ca..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/property.js +++ /dev/null @@ -1,96 +0,0 @@ - -/*! - * Stylus - Property - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `Property` with the given `segs` and optional `expr`. - * - * @param {Array} segs - * @param {Expression} expr - * @api public - */ - -var Property = module.exports = function Property(segs, expr){ - Node.call(this); - this.segments = segs; - this.expr = expr; -}; - -/** - * Inherit from `Node.prototype`. - */ - -Property.prototype.__proto__ = Node.prototype; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Property.prototype.clone = function(parent){ - var clone = new Property(this.segments); - clone.name = this.name; - if (this.literal) clone.literal = this.literal; - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - clone.segments = this.segments.map(function(node){ return node.clone(parent, clone); }); - if (this.expr) clone.expr = this.expr.clone(parent, clone); - return clone; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Property.prototype.toJSON = function(){ - var json = { - __type: 'Property', - segments: this.segments, - name: this.name, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; - if (this.expr) json.expr = this.expr; - if (this.literal) json.literal = this.literal; - return json; -}; - -/** - * Return string representation of this node. - * - * @return {String} - * @api public - */ - -Property.prototype.toString = function(){ - return 'property(' + this.segments.join('') + ', ' + this.expr + ')'; -}; - -/** - * Operate on the property expression. - * - * @param {String} op - * @param {Node} right - * @return {Node} - * @api public - */ - -Property.prototype.operate = function(op, right, val){ - return this.expr.operate(op, right, val); -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/query-list.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/query-list.js deleted file mode 100644 index 9774bba0..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/query-list.js +++ /dev/null @@ -1,108 +0,0 @@ - -/*! - * Stylus - QueryList - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `QueryList`. - * - * @api public - */ - -var QueryList = module.exports = function QueryList(){ - Node.call(this); - this.nodes = []; -}; - -/** - * Inherit from `Node.prototype`. - */ - -QueryList.prototype.__proto__ = Node.prototype; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -QueryList.prototype.clone = function(parent){ - var clone = new QueryList; - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - for (var i = 0; i < this.nodes.length; ++i) { - clone.push(this.nodes[i].clone(parent, clone)); - } - return clone; -}; - -/** - * Push the given `node`. - * - * @param {Node} node - * @api public - */ - -QueryList.prototype.push = function(node){ - this.nodes.push(node); -}; - -/** - * Merges this query list with the `other`. - * - * @param {QueryList} other - * @return {QueryList} - * @api private - */ - -QueryList.prototype.merge = function(other){ - var list = new QueryList - , merged; - this.nodes.forEach(function(query){ - for (var i = 0, len = other.nodes.length; i < len; ++i){ - merged = query.merge(other.nodes[i]); - if (merged) list.push(merged); - } - }); - return list; -}; - -/** - * Return ", , " - * - * @return {String} - * @api public - */ - -QueryList.prototype.toString = function(){ - return '(' + this.nodes.map(function(node){ - return node.toString(); - }).join(', ') + ')'; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -QueryList.prototype.toJSON = function(){ - return { - __type: 'QueryList', - nodes: this.nodes, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/query.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/query.js deleted file mode 100644 index dd896541..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/query.js +++ /dev/null @@ -1,170 +0,0 @@ - -/*! - * Stylus - Query - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `Query`. - * - * @api public - */ - -var Query = module.exports = function Query(){ - Node.call(this); - this.nodes = []; - this.type = ''; - this.predicate = ''; -}; - -/** - * Inherit from `Node.prototype`. - */ - -Query.prototype.__proto__ = Node.prototype; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Query.prototype.clone = function(parent){ - var clone = new Query; - clone.predicate = this.predicate; - clone.type = this.type; - for (var i = 0, len = this.nodes.length; i < len; ++i) { - clone.push(this.nodes[i].clone(parent, clone)); - } - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - return clone; -}; - -/** - * Push the given `feature`. - * - * @param {Feature} feature - * @api public - */ - -Query.prototype.push = function(feature){ - this.nodes.push(feature); -}; - -/** - * Return resolved type of this query. - * - * @return {String} - * @api private - */ - -Query.prototype.__defineGetter__('resolvedType', function(){ - if (this.type) { - return this.type.nodeName - ? this.type.string - : this.type; - } -}); - -/** - * Return resolved predicate of this query. - * - * @return {String} - * @api private - */ - -Query.prototype.__defineGetter__('resolvedPredicate', function(){ - if (this.predicate) { - return this.predicate.nodeName - ? this.predicate.string - : this.predicate; - } -}); - -/** - * Merges this query with the `other`. - * - * @param {Query} other - * @return {Query} - * @api private - */ - -Query.prototype.merge = function(other){ - var query = new Query - , p1 = this.resolvedPredicate - , p2 = other.resolvedPredicate - , t1 = this.resolvedType - , t2 = other.resolvedType - , type, pred; - - // Stolen from Sass :D - t1 = t1 || t2; - t2 = t2 || t1; - if (('not' == p1) ^ ('not' == p2)) { - if (t1 == t2) return; - type = ('not' == p1) ? t2 : t1; - pred = ('not' == p1) ? p2 : p1; - } else if (('not' == p1) && ('not' == p2)) { - if (t1 != t2) return; - type = t1; - pred = 'not'; - } else if (t1 != t2) { - return; - } else { - type = t1; - pred = p1 || p2; - } - query.predicate = pred; - query.type = type; - query.nodes = this.nodes.concat(other.nodes); - return query; -}; - -/** - * Return " and and " - * - * @return {String} - * @api public - */ - -Query.prototype.toString = function(){ - var pred = this.predicate ? this.predicate + ' ' : '' - , type = this.type || '' - , len = this.nodes.length - , str = pred + type; - if (len) { - str += (type && ' and ') + this.nodes.map(function(expr){ - return expr.toString(); - }).join(' and '); - } - return str; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Query.prototype.toJSON = function(){ - return { - __type: 'Query', - predicate: this.predicate, - type: this.type, - nodes: this.nodes, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/return.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/return.js deleted file mode 100644 index 70c667db..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/return.js +++ /dev/null @@ -1,63 +0,0 @@ - -/*! - * Stylus - Return - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node') - , nodes = require('./'); - -/** - * Initialize a new `Return` node with the given `expr`. - * - * @param {Expression} expr - * @api public - */ - -var Return = module.exports = function Return(expr){ - this.expr = expr || nodes.null; -}; - -/** - * Inherit from `Node.prototype`. - */ - -Return.prototype.__proto__ = Node.prototype; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Return.prototype.clone = function(parent){ - var clone = new Return(); - clone.expr = this.expr.clone(parent, clone); - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - return clone; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Return.prototype.toJSON = function(){ - return { - __type: 'Return', - expr: this.expr, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/rgba.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/rgba.js deleted file mode 100644 index 39201771..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/rgba.js +++ /dev/null @@ -1,367 +0,0 @@ - -/*! - * Stylus - RGBA - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node') - , HSLA = require('./hsla') - , functions = require('../functions') - , adjust = functions.adjust - , nodes = require('./'); - -/** - * Initialize a new `RGBA` with the given r,g,b,a component values. - * - * @param {Number} r - * @param {Number} g - * @param {Number} b - * @param {Number} a - * @api public - */ - -var RGBA = exports = module.exports = function RGBA(r,g,b,a){ - Node.call(this); - this.r = clamp(r); - this.g = clamp(g); - this.b = clamp(b); - this.a = clampAlpha(a); - this.name = ''; - this.rgba = this; -}; - -/** - * Inherit from `Node.prototype`. - */ - -RGBA.prototype.__proto__ = Node.prototype; - -/** - * Return an `RGBA` without clamping values. - * - * @param {Number} r - * @param {Number} g - * @param {Number} b - * @param {Number} a - * @return {RGBA} - * @api public - */ - -RGBA.withoutClamping = function(r,g,b,a){ - var rgba = new RGBA(0,0,0,0); - rgba.r = r; - rgba.g = g; - rgba.b = b; - rgba.a = a; - return rgba; -}; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -RGBA.prototype.clone = function(){ - var clone = new RGBA( - this.r - , this.g - , this.b - , this.a); - clone.raw = this.raw; - clone.name = this.name; - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - return clone; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -RGBA.prototype.toJSON = function(){ - return { - __type: 'RGBA', - r: this.r, - g: this.g, - b: this.b, - a: this.a, - raw: this.raw, - name: this.name, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; - -/** - * Return true. - * - * @return {Boolean} - * @api public - */ - -RGBA.prototype.toBoolean = function(){ - return nodes.true; -}; - -/** - * Return `HSLA` representation. - * - * @return {HSLA} - * @api public - */ - -RGBA.prototype.__defineGetter__('hsla', function(){ - return HSLA.fromRGBA(this); -}); - -/** - * Return hash. - * - * @return {String} - * @api public - */ - -RGBA.prototype.__defineGetter__('hash', function(){ - return this.toString(); -}); - -/** - * Add r,g,b,a to the current component values. - * - * @param {Number} r - * @param {Number} g - * @param {Number} b - * @param {Number} a - * @return {RGBA} new node - * @api public - */ - -RGBA.prototype.add = function(r,g,b,a){ - return new RGBA( - this.r + r - , this.g + g - , this.b + b - , this.a + a); -}; - -/** - * Subtract r,g,b,a from the current component values. - * - * @param {Number} r - * @param {Number} g - * @param {Number} b - * @param {Number} a - * @return {RGBA} new node - * @api public - */ - -RGBA.prototype.sub = function(r,g,b,a){ - return new RGBA( - this.r - r - , this.g - g - , this.b - b - , a == 1 ? this.a : this.a - a); -}; - -/** - * Multiply rgb components by `n`. - * - * @param {String} n - * @return {RGBA} new node - * @api public - */ - -RGBA.prototype.multiply = function(n){ - return new RGBA( - this.r * n - , this.g * n - , this.b * n - , this.a); -}; - -/** - * Divide rgb components by `n`. - * - * @param {String} n - * @return {RGBA} new node - * @api public - */ - -RGBA.prototype.divide = function(n){ - return new RGBA( - this.r / n - , this.g / n - , this.b / n - , this.a); -}; - -/** - * Operate on `right` with the given `op`. - * - * @param {String} op - * @param {Node} right - * @return {Node} - * @api public - */ - -RGBA.prototype.operate = function(op, right){ - if ('in' != op) right = right.first - - switch (op) { - case 'is a': - if ('string' == right.nodeName && 'color' == right.string) { - return nodes.true; - } - break; - case '+': - switch (right.nodeName) { - case 'unit': - var n = right.val; - switch (right.type) { - case '%': return adjust(this, new nodes.String('lightness'), right); - case 'deg': return this.hsla.adjustHue(n).rgba; - default: return this.add(n,n,n,0); - } - case 'rgba': - return this.add(right.r, right.g, right.b, right.a); - case 'hsla': - return this.hsla.add(right.h, right.s, right.l); - } - break; - case '-': - switch (right.nodeName) { - case 'unit': - var n = right.val; - switch (right.type) { - case '%': return adjust(this, new nodes.String('lightness'), new nodes.Unit(-n, '%')); - case 'deg': return this.hsla.adjustHue(-n).rgba; - default: return this.sub(n,n,n,0); - } - case 'rgba': - return this.sub(right.r, right.g, right.b, right.a); - case 'hsla': - return this.hsla.sub(right.h, right.s, right.l); - } - break; - case '*': - switch (right.nodeName) { - case 'unit': - return this.multiply(right.val); - } - break; - case '/': - switch (right.nodeName) { - case 'unit': - return this.divide(right.val); - } - break; - } - return Node.prototype.operate.call(this, op, right); -}; - -/** - * Return #nnnnnn, #nnn, or rgba(n,n,n,n) string representation of the color. - * - * @return {String} - * @api public - */ - -RGBA.prototype.toString = function(){ - function pad(n) { - return n < 16 - ? '0' + n.toString(16) - : n.toString(16); - } - - // special case for transparent named color - if ('transparent' == this.name) - return this.name; - - if (1 == this.a) { - var r = pad(this.r) - , g = pad(this.g) - , b = pad(this.b); - - // Compress - if (r[0] == r[1] && g[0] == g[1] && b[0] == b[1]) { - return '#' + r[0] + g[0] + b[0]; - } else { - return '#' + r + g + b; - } - } else { - return 'rgba(' - + this.r + ',' - + this.g + ',' - + this.b + ',' - + (+this.a.toFixed(3)) + ')'; - } -}; - -/** - * Return a `RGBA` from the given `hsla`. - * - * @param {HSLA} hsla - * @return {RGBA} - * @api public - */ - -exports.fromHSLA = function(hsla){ - var h = hsla.h / 360 - , s = hsla.s / 100 - , l = hsla.l / 100 - , a = hsla.a; - - var m2 = l <= .5 ? l * (s + 1) : l + s - l * s - , m1 = l * 2 - m2; - - var r = hue(h + 1/3) * 0xff - , g = hue(h) * 0xff - , b = hue(h - 1/3) * 0xff; - - function hue(h) { - if (h < 0) ++h; - if (h > 1) --h; - if (h * 6 < 1) return m1 + (m2 - m1) * h * 6; - if (h * 2 < 1) return m2; - if (h * 3 < 2) return m1 + (m2 - m1) * (2/3 - h) * 6; - return m1; - } - - return new RGBA(r,g,b,a); -}; - -/** - * Clamp `n` >= 0 and <= 255. - * - * @param {Number} n - * @return {Number} - * @api private - */ - -function clamp(n) { - return Math.max(0, Math.min(n.toFixed(0), 255)); -} - -/** - * Clamp alpha `n` >= 0 and <= 1. - * - * @param {Number} n - * @return {Number} - * @api private - */ - -function clampAlpha(n) { - return Math.max(0, Math.min(n, 1)); -} diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/root.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/root.js deleted file mode 100644 index d61f5dbe..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/root.js +++ /dev/null @@ -1,96 +0,0 @@ - -/*! - * Stylus - Root - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `Root` node. - * - * @api public - */ - -var Root = module.exports = function Root(){ - this.nodes = []; -}; - -/** - * Inherit from `Node.prototype`. - */ - -Root.prototype.__proto__ = Node.prototype; - -/** - * Push a `node` to this block. - * - * @param {Node} node - * @api public - */ - -Root.prototype.push = function(node){ - this.nodes.push(node); -}; - -/** - * Unshift a `node` to this block. - * - * @param {Node} node - * @api public - */ - -Root.prototype.unshift = function(node){ - this.nodes.unshift(node); -}; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Root.prototype.clone = function(){ - var clone = new Root(); - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - this.nodes.forEach(function(node){ - clone.push(node.clone(clone, clone)); - }); - return clone; -}; - -/** - * Return "root". - * - * @return {String} - * @api public - */ - -Root.prototype.toString = function(){ - return '[Root]'; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Root.prototype.toJSON = function(){ - return { - __type: 'Root', - nodes: this.nodes, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/selector.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/selector.js deleted file mode 100644 index c63d2eba..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/selector.js +++ /dev/null @@ -1,94 +0,0 @@ - -/*! - * Stylus - Selector - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Block = require('./block') - , Node = require('./node'); - -/** - * Initialize a new `Selector` with the given `segs`. - * - * @param {Array} segs - * @api public - */ - -var Selector = module.exports = function Selector(segs){ - Node.call(this); - this.inherits = true; - this.segments = segs; - this.optional = false; -}; - -/** - * Inherit from `Node.prototype`. - */ - -Selector.prototype.__proto__ = Node.prototype; - -/** - * Return the selector string. - * - * @return {String} - * @api public - */ - -Selector.prototype.toString = function(){ - return this.segments.join('') + (this.optional ? ' !optional' : ''); -}; - -/** - * Check if this is placeholder selector. - * - * @return {Boolean} - * @api public - */ - -Selector.prototype.__defineGetter__('isPlaceholder', function(){ - return this.val && ~this.val.substr(0, 2).indexOf('$'); -}); - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Selector.prototype.clone = function(parent){ - var clone = new Selector; - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - clone.inherits = this.inherits; - clone.val = this.val; - clone.segments = this.segments.map(function(node){ return node.clone(parent, clone); }); - clone.optional = this.optional; - return clone; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Selector.prototype.toJSON = function(){ - return { - __type: 'Selector', - inherits: this.inherits, - segments: this.segments, - optional: this.optional, - val: this.val, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/string.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/string.js deleted file mode 100644 index 98968da4..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/string.js +++ /dev/null @@ -1,147 +0,0 @@ -/*! - * Stylus - String - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node') - , sprintf = require('../functions').s - , utils = require('../utils') - , nodes = require('./'); - -/** - * Initialize a new `String` with the given `val`. - * - * @param {String} val - * @param {String} quote - * @api public - */ - -var String = module.exports = function String(val, quote){ - Node.call(this); - this.val = val; - this.string = val; - this.prefixed = false; - if (typeof quote !== 'string') { - this.quote = "'"; - } else { - this.quote = quote; - } -}; - -/** - * Inherit from `Node.prototype`. - */ - -String.prototype.__proto__ = Node.prototype; - -/** - * Return quoted string. - * - * @return {String} - * @api public - */ - -String.prototype.toString = function(){ - return this.quote + this.val + this.quote; -}; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -String.prototype.clone = function(){ - var clone = new String(this.val, this.quote); - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - return clone; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -String.prototype.toJSON = function(){ - return { - __type: 'String', - val: this.val, - quote: this.quote, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; - -/** - * Return Boolean based on the length of this string. - * - * @return {Boolean} - * @api public - */ - -String.prototype.toBoolean = function(){ - return nodes.Boolean(this.val.length); -}; - -/** - * Coerce `other` to a string. - * - * @param {Node} other - * @return {String} - * @api public - */ - -String.prototype.coerce = function(other){ - switch (other.nodeName) { - case 'string': - return other; - case 'expression': - return new String(other.nodes.map(function(node){ - return this.coerce(node).val; - }, this).join(' ')); - default: - return new String(other.toString()); - } -}; - -/** - * Operate on `right` with the given `op`. - * - * @param {String} op - * @param {Node} right - * @return {Node} - * @api public - */ - -String.prototype.operate = function(op, right){ - switch (op) { - case '%': - var expr = new nodes.Expression; - expr.push(this); - - // constructargs - var args = 'expression' == right.nodeName - ? utils.unwrap(right).nodes - : [right]; - - // apply - return sprintf.apply(null, [expr].concat(args)); - case '+': - var expr = new nodes.Expression; - expr.push(new String(this.val + this.coerce(right).val)); - return expr; - default: - return Node.prototype.operate.call(this, op, right); - } -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/supports.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/supports.js deleted file mode 100644 index 53bc03ee..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/supports.js +++ /dev/null @@ -1,75 +0,0 @@ -/*! - * Stylus - supports - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Atrule = require('./atrule'); - -/** - * Initialize a new supports node. - * - * @param {Expression} condition - * @api public - */ - -var Supports = module.exports = function Supports(condition){ - Atrule.call(this, 'supports'); - this.condition = condition; -}; - -/** - * Inherit from `Atrule.prototype`. - */ - -Supports.prototype.__proto__ = Atrule.prototype; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Supports.prototype.clone = function(parent){ - var clone = new Supports; - clone.condition = this.condition.clone(parent, clone); - clone.block = this.block.clone(parent, clone); - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - return clone; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Supports.prototype.toJSON = function(){ - return { - __type: 'Supports', - condition: this.condition, - block: this.block, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; - -/** - * Return @supports - * - * @return {String} - * @api public - */ - -Supports.prototype.toString = function(){ - return '@supports ' + this.condition; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/ternary.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/ternary.js deleted file mode 100644 index a62bf400..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/ternary.js +++ /dev/null @@ -1,71 +0,0 @@ - -/*! - * Stylus - Ternary - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `Ternary` with `cond`, `trueExpr` and `falseExpr`. - * - * @param {Expression} cond - * @param {Expression} trueExpr - * @param {Expression} falseExpr - * @api public - */ - -var Ternary = module.exports = function Ternary(cond, trueExpr, falseExpr){ - Node.call(this); - this.cond = cond; - this.trueExpr = trueExpr; - this.falseExpr = falseExpr; -}; - -/** - * Inherit from `Node.prototype`. - */ - -Ternary.prototype.__proto__ = Node.prototype; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Ternary.prototype.clone = function(parent){ - var clone = new Ternary(); - clone.cond = this.cond.clone(parent, clone); - clone.trueExpr = this.trueExpr.clone(parent, clone); - clone.falseExpr = this.falseExpr.clone(parent, clone); - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - return clone; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Ternary.prototype.toJSON = function(){ - return { - __type: 'Ternary', - cond: this.cond, - trueExpr: this.trueExpr, - falseExpr: this.falseExpr, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/unaryop.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/unaryop.js deleted file mode 100644 index 85684f5e..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/unaryop.js +++ /dev/null @@ -1,66 +0,0 @@ - -/*! - * Stylus - UnaryOp - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `UnaryOp` with `op`, and `expr`. - * - * @param {String} op - * @param {Node} expr - * @api public - */ - -var UnaryOp = module.exports = function UnaryOp(op, expr){ - Node.call(this); - this.op = op; - this.expr = expr; -}; - -/** - * Inherit from `Node.prototype`. - */ - -UnaryOp.prototype.__proto__ = Node.prototype; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -UnaryOp.prototype.clone = function(parent){ - var clone = new UnaryOp(this.op); - clone.expr = this.expr.clone(parent, clone); - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - return clone; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -UnaryOp.prototype.toJSON = function(){ - return { - __type: 'UnaryOp', - op: this.op, - expr: this.expr, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/unit.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/unit.js deleted file mode 100644 index 81c25dd6..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/nodes/unit.js +++ /dev/null @@ -1,214 +0,0 @@ - -/*! - * Stylus - Unit - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node') - , nodes = require('./'); - -/** - * Unit conversion table. - */ - -var FACTOR_TABLE = { - 'mm': {val: 1, label: 'mm'}, - 'cm': {val: 10, label: 'mm'}, - 'in': {val: 25.4, label: 'mm'}, - 'pt': {val: 25.4/72, label: 'mm'}, - 'ms': {val: 1, label: 'ms'}, - 's': {val: 1000, label: 'ms'}, - 'Hz': {val: 1, label: 'Hz'}, - 'kHz': {val: 1000, label: 'Hz'} -}; - -/** - * Initialize a new `Unit` with the given `val` and unit `type` - * such as "px", "pt", "in", etc. - * - * @param {String} val - * @param {String} type - * @api public - */ - -var Unit = module.exports = function Unit(val, type){ - Node.call(this); - this.val = val; - this.type = type; -}; - -/** - * Inherit from `Node.prototype`. - */ - -Unit.prototype.__proto__ = Node.prototype; - -/** - * Return Boolean based on the unit value. - * - * @return {Boolean} - * @api public - */ - -Unit.prototype.toBoolean = function(){ - return nodes.Boolean(this.type - ? true - : this.val); -}; - -/** - * Return unit string. - * - * @return {String} - * @api public - */ - -Unit.prototype.toString = function(){ - return this.val + (this.type || ''); -}; - -/** - * Return a clone of this node. - * - * @return {Node} - * @api public - */ - -Unit.prototype.clone = function(){ - var clone = new Unit(this.val, this.type); - clone.lineno = this.lineno; - clone.column = this.column; - clone.filename = this.filename; - return clone; -}; - -/** - * Return a JSON representation of this node. - * - * @return {Object} - * @api public - */ - -Unit.prototype.toJSON = function(){ - return { - __type: 'Unit', - val: this.val, - type: this.type, - lineno: this.lineno, - column: this.column, - filename: this.filename - }; -}; - -/** - * Operate on `right` with the given `op`. - * - * @param {String} op - * @param {Node} right - * @return {Node} - * @api public - */ - -Unit.prototype.operate = function(op, right){ - var type = this.type || right.first.type; - - // swap color - if ('rgba' == right.nodeName || 'hsla' == right.nodeName) { - return right.operate(op, this); - } - - // operate - if (this.shouldCoerce(op)) { - right = right.first; - // percentages - if ('%' != this.type && ('-' == op || '+' == op) && '%' == right.type) { - right = new Unit(this.val * (right.val / 100), '%'); - } else { - right = this.coerce(right); - } - - switch (op) { - case '-': - return new Unit(this.val - right.val, type); - case '+': - // keyframes interpolation - type = type || (right.type == '%' && right.type); - return new Unit(this.val + right.val, type); - case '/': - return new Unit(this.val / right.val, type); - case '*': - return new Unit(this.val * right.val, type); - case '%': - return new Unit(this.val % right.val, type); - case '**': - return new Unit(Math.pow(this.val, right.val), type); - case '..': - case '...': - var start = this.val - , end = right.val - , expr = new nodes.Expression - , inclusive = '..' == op; - if (start < end) { - do { - expr.push(new nodes.Unit(start)); - } while (inclusive ? ++start <= end : ++start < end); - } else { - do { - expr.push(new nodes.Unit(start)); - } while (inclusive ? --start >= end : --start > end); - } - return expr; - } - } - - return Node.prototype.operate.call(this, op, right); -}; - -/** - * Coerce `other` unit to the same type as `this` unit. - * - * Supports: - * - * mm -> cm | in - * cm -> mm | in - * in -> mm | cm - * - * ms -> s - * s -> ms - * - * Hz -> kHz - * kHz -> Hz - * - * @param {Unit} other - * @return {Unit} - * @api public - */ - -Unit.prototype.coerce = function(other){ - if ('unit' == other.nodeName) { - var a = this - , b = other - , factorA = FACTOR_TABLE[a.type] - , factorB = FACTOR_TABLE[b.type]; - - if (factorA && factorB && (factorA.label == factorB.label)) { - var bVal = b.val * (factorB.val / factorA.val); - return new nodes.Unit(bVal, a.type); - } else { - return new nodes.Unit(b.val, a.type); - } - } else if ('string' == other.nodeName) { - // keyframes interpolation - if ('%' == other.val) return new nodes.Unit(0, '%'); - var val = parseFloat(other.val); - if (isNaN(val)) Node.prototype.coerce.call(this, other); - return new nodes.Unit(val); - } else { - return Node.prototype.coerce.call(this, other); - } -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/parser.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/parser.js deleted file mode 100644 index a0b63fc6..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/parser.js +++ /dev/null @@ -1,2297 +0,0 @@ -/*! - * Stylus - Parser - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Lexer = require('./lexer') - , nodes = require('./nodes') - , Token = require('./token') - , units = require('./units') - , errors = require('./errors') - , cache = require('./cache'); - -// debuggers - -var debug = { - lexer: require('debug')('stylus:lexer') - , selector: require('debug')('stylus:parser:selector') -}; - -/** - * Selector composite tokens. - */ - -var selectorTokens = [ - 'ident' - , 'string' - , 'selector' - , 'function' - , 'comment' - , 'boolean' - , 'space' - , 'color' - , 'unit' - , 'for' - , 'in' - , '[' - , ']' - , '(' - , ')' - , '+' - , '-' - , '*' - , '*=' - , '<' - , '>' - , '=' - , ':' - , '&' - , '&&' - , '~' - , '{' - , '}' - , '.' - , '..' - , '/' -]; - -/** - * CSS pseudo-classes and pseudo-elements. - * See http://dev.w3.org/csswg/selectors4/ - */ - -var pseudoSelectors = [ - // https://www.w3.org/TR/selectors-4/#logical-combination - // Logical Combinations - 'is' - , 'has' - , 'where' - , 'not' - - // Linguistic Pseudo-classes - , 'dir' - , 'lang' - - // Location Pseudo-classes - , 'any-link' - , 'link' - , 'visited' - , 'local-link' - , 'target' - , 'scope' - - // User Action Pseudo-classes - , 'hover' - , 'active' - , 'focus' - , 'drop' - - // Time-dimensional Pseudo-classes - , 'current' - , 'past' - , 'future' - - // The Input Pseudo-classes - , 'enabled' - , 'disabled' - , 'read-only' - , 'read-write' - , 'placeholder-shown' - , 'checked' - , 'indeterminate' - , 'valid' - , 'invalid' - , 'in-range' - , 'out-of-range' - , 'required' - , 'optional' - , 'user-error' - - // Tree-Structural pseudo-classes - , 'root' - , 'empty' - , 'blank' - , 'nth-child' - , 'nth-last-child' - , 'first-child' - , 'last-child' - , 'only-child' - , 'nth-of-type' - , 'nth-last-of-type' - , 'first-of-type' - , 'last-of-type' - , 'only-of-type' - , 'nth-match' - , 'nth-last-match' - - // Grid-Structural Selectors - , 'nth-column' - , 'nth-last-column' - - // Pseudo-elements - , 'first-line' - , 'first-letter' - , 'before' - , 'after' - - // Non-standard - , 'selection' -]; - -/** - * Initialize a new `Parser` with the given `str` and `options`. - * - * @param {String} str - * @param {Object} options - * @api private - */ - -var Parser = module.exports = function Parser(str, options) { - var self = this; - options = options || {}; - Parser.cache = Parser.cache || Parser.getCache(options); - this.hash = Parser.cache.key(str, options); - this.lexer = {}; - if (!Parser.cache.has(this.hash)) { - this.lexer = new Lexer(str, options); - } - this.prefix = options.prefix || ''; - this.root = options.root || new nodes.Root; - this.state = ['root']; - this.stash = []; - this.parens = 0; - this.css = 0; - this.state.pop = function(){ - self.prevState = [].pop.call(this); - }; -}; - -/** - * Get cache instance. - * - * @param {Object} options - * @return {Object} - * @api private - */ - -Parser.getCache = function(options) { - return false === options.cache - ? cache(false) - : cache(options.cache || 'memory', options); -}; - -/** - * Parser prototype. - */ - -Parser.prototype = { - - /** - * Constructor. - */ - - constructor: Parser, - - /** - * Return current state. - * - * @return {String} - * @api private - */ - - currentState: function() { - return this.state[this.state.length - 1]; - }, - - /** - * Return previous state. - * - * @return {String} - * @api private - */ - - previousState: function() { - return this.state[this.state.length - 2]; - }, - - /** - * Parse the input, then return the root node. - * - * @return {Node} - * @api private - */ - - parse: function(){ - var block = this.parent = this.root; - if (Parser.cache.has(this.hash)) { - block = Parser.cache.get(this.hash); - // normalize cached imports - if ('block' == block.nodeName) block.constructor = nodes.Root; - } else { - while ('eos' != this.peek().type) { - this.skipWhitespace(); - if ('eos' == this.peek().type) break; - var stmt = this.statement(); - this.accept(';'); - if (!stmt) this.error('unexpected token {peek}, not allowed at the root level'); - block.push(stmt); - } - Parser.cache.set(this.hash, block); - } - return block; - }, - - /** - * Throw an `Error` with the given `msg`. - * - * @param {String} msg - * @api private - */ - - error: function(msg){ - var type = this.peek().type - , val = undefined == this.peek().val - ? '' - : ' ' + this.peek().toString(); - if (val.trim() == type.trim()) val = ''; - throw new errors.ParseError(msg.replace('{peek}', '"' + type + val + '"')); - }, - - /** - * Accept the given token `type`, and return it, - * otherwise return `undefined`. - * - * @param {String} type - * @return {Token} - * @api private - */ - - accept: function(type){ - if (type == this.peek().type) { - return this.next(); - } - }, - - /** - * Expect token `type` and return it, throw otherwise. - * - * @param {String} type - * @return {Token} - * @api private - */ - - expect: function(type){ - if (type != this.peek().type) { - this.error('expected "' + type + '", got {peek}'); - } - return this.next(); - }, - - /** - * Get the next token. - * - * @return {Token} - * @api private - */ - - next: function() { - var tok = this.stash.length - ? this.stash.pop() - : this.lexer.next() - , line = tok.lineno - , column = tok.column || 1; - - if (tok.val && tok.val.nodeName) { - tok.val.lineno = line; - tok.val.column = column; - } - nodes.lineno = line; - nodes.column = column; - debug.lexer('%s %s', tok.type, tok.val || ''); - return tok; - }, - - /** - * Peek with lookahead(1). - * - * @return {Token} - * @api private - */ - - peek: function() { - return this.lexer.peek(); - }, - - /** - * Lookahead `n` tokens. - * - * @param {Number} n - * @return {Token} - * @api private - */ - - lookahead: function(n){ - return this.lexer.lookahead(n); - }, - - /** - * Check if the token at `n` is a valid selector token. - * - * @param {Number} n - * @return {Boolean} - * @api private - */ - - isSelectorToken: function(n) { - var la = this.lookahead(n).type; - switch (la) { - case 'for': - return this.bracketed; - case '[': - this.bracketed = true; - return true; - case ']': - this.bracketed = false; - return true; - default: - return ~selectorTokens.indexOf(la); - } - }, - - /** - * Check if the token at `n` is a pseudo selector. - * - * @param {Number} n - * @return {Boolean} - * @api private - */ - - isPseudoSelector: function(n){ - var val = this.lookahead(n).val; - return val && ~pseudoSelectors.indexOf(val.name); - }, - - /** - * Check if the current line contains `type`. - * - * @param {String} type - * @return {Boolean} - * @api private - */ - - lineContains: function(type){ - var i = 1 - , la; - - while (la = this.lookahead(i++)) { - if (~['indent', 'outdent', 'newline', 'eos'].indexOf(la.type)) return; - if (type == la.type) return true; - } - }, - - /** - * Valid selector tokens. - */ - - selectorToken: function() { - if (this.isSelectorToken(1)) { - if ('{' == this.peek().type) { - // unclosed, must be a block - if (!this.lineContains('}')) return; - // check if ':' is within the braces. - // though not required by Stylus, chances - // are if someone is using {} they will - // use CSS-style props, helping us with - // the ambiguity in this case - var i = 0 - , la; - while (la = this.lookahead(++i)) { - if ('}' == la.type) { - // Check empty block. - if (i == 2 || (i == 3 && this.lookahead(i - 1).type == 'space')) - return; - break; - } - if (':' == la.type) return; - } - } - return this.next(); - } - }, - - /** - * Skip the given `tokens`. - * - * @param {Array} tokens - * @api private - */ - - skip: function(tokens) { - while (~tokens.indexOf(this.peek().type)) - this.next(); - }, - - /** - * Consume whitespace. - */ - - skipWhitespace: function() { - this.skip(['space', 'indent', 'outdent', 'newline']); - }, - - /** - * Consume newlines. - */ - - skipNewlines: function() { - while ('newline' == this.peek().type) - this.next(); - }, - - /** - * Consume spaces. - */ - - skipSpaces: function() { - while ('space' == this.peek().type) - this.next(); - }, - - /** - * Consume spaces and comments. - */ - - skipSpacesAndComments: function() { - while ('space' == this.peek().type - || 'comment' == this.peek().type) - this.next(); - }, - - /** - * Check if the following sequence of tokens - * forms a function definition, ie trailing - * `{` or indentation. - */ - - looksLikeFunctionDefinition: function(i) { - return 'indent' == this.lookahead(i).type - || '{' == this.lookahead(i).type; - }, - - /** - * Check if the following sequence of tokens - * forms a selector. - * - * @param {Boolean} [fromProperty] - * @return {Boolean} - * @api private - */ - - looksLikeSelector: function(fromProperty) { - var i = 1 - , node - , brace; - - // Real property - if (fromProperty && ':' == this.lookahead(i + 1).type - && (this.lookahead(i + 1).space || 'indent' == this.lookahead(i + 2).type)) - return false; - - // Assume selector when an ident is - // followed by a selector - while ('ident' == this.lookahead(i).type - && ('newline' == this.lookahead(i + 1).type - || ',' == this.lookahead(i + 1).type)) i += 2; - - while (this.isSelectorToken(i) - || ',' == this.lookahead(i).type) { - - if ('selector' == this.lookahead(i).type) - return true; - - if ('&' == this.lookahead(i + 1).type) - return true; - - // Hash values inside properties - if ( - i > 1 && - 'ident' === this.lookahead(i - 1).type && - '.' === this.lookahead(i).type && - 'ident' === this.lookahead(i + 1).type - ) { - while ((node = this.lookahead(i + 2))) { - if ([ - 'indent', - 'outdent', - '{', - ';', - 'eos', - 'selector', - 'media', - 'if', - 'atrule', - ')', - '}', - 'unit', - '[', - 'for', - 'function' - ].indexOf(node.type) !== -1) { - if (node.type === '[') { - while ((node = this.lookahead(i + 3)) && node.type !== ']') { - if (~['.', 'unit'].indexOf(node.type)) { - return false; - } - i += 1 - } - } else { - if (this.isPseudoSelector(i + 2)) { - return true; - } - - if (node.type === ')' && this.lookahead(i + 3) && this.lookahead(i + 3).type === '}') { - break; - } - - return [ - 'outdent', - ';', - 'eos', - 'media', - 'if', - 'atrule', - ')', - '}', - 'unit', - 'for', - 'function' - ].indexOf(node.type) === -1; - } - } - - i += 1 - } - - return true; - } - - if ('.' == this.lookahead(i).type && 'ident' == this.lookahead(i + 1).type) { - return true; - } - - if ('*' == this.lookahead(i).type && 'newline' == this.lookahead(i + 1).type) - return true; - - // Pseudo-elements - if (':' == this.lookahead(i).type - && ':' == this.lookahead(i + 1).type) - return true; - - // #a after an ident and newline - if ('color' == this.lookahead(i).type - && 'newline' == this.lookahead(i - 1).type) - return true; - - if (this.looksLikeAttributeSelector(i)) - return true; - - if (('=' == this.lookahead(i).type || 'function' == this.lookahead(i).type) - && '{' == this.lookahead(i + 1).type) - return false; - - // Hash values inside properties - if (':' == this.lookahead(i).type - && !this.isPseudoSelector(i + 1) - && this.lineContains('.')) - return false; - - // the ':' token within braces signifies - // a selector. ex: "foo{bar:'baz'}" - if ('{' == this.lookahead(i).type) brace = true; - else if ('}' == this.lookahead(i).type) brace = false; - if (brace && ':' == this.lookahead(i).type) return true; - - // '{' preceded by a space is considered a selector. - // for example "foo{bar}{baz}" may be a property, - // however "foo{bar} {baz}" is a selector - if ('space' == this.lookahead(i).type - && '{' == this.lookahead(i + 1).type) - return true; - - // Assume pseudo selectors are NOT properties - // as 'td:th-child(1)' may look like a property - // and function call to the parser otherwise - if (':' == this.lookahead(i++).type - && !this.lookahead(i-1).space - && this.isPseudoSelector(i)) - return true; - - // Trailing space - if ('space' == this.lookahead(i).type - && 'newline' == this.lookahead(i + 1).type - && '{' == this.lookahead(i + 2).type) - return true; - - if (',' == this.lookahead(i).type - && 'newline' == this.lookahead(i + 1).type) - return true; - } - - // Trailing comma - if (',' == this.lookahead(i).type - && 'newline' == this.lookahead(i + 1).type) - return true; - - // Trailing brace - if ('{' == this.lookahead(i).type - && 'newline' == this.lookahead(i + 1).type) - return true; - - // css-style mode, false on ; } - if (this.css) { - if (';' == this.lookahead(i).type || - '}' == this.lookahead(i - 1).type) - return false; - } - - // Trailing separators - while (!~[ - 'indent' - , 'outdent' - , 'newline' - , 'for' - , 'if' - , ';' - , '}' - , 'eos'].indexOf(this.lookahead(i).type)) - ++i; - - if ('indent' == this.lookahead(i).type) - return true; - }, - - /** - * Check if the following sequence of tokens - * forms an attribute selector. - */ - - looksLikeAttributeSelector: function(n) { - var type = this.lookahead(n).type; - if ('=' == type && this.bracketed) return true; - return ('ident' == type || 'string' == type) - && ']' == this.lookahead(n + 1).type - && ('newline' == this.lookahead(n + 2).type || this.isSelectorToken(n + 2)) - && !this.lineContains(':') - && !this.lineContains('='); - }, - - /** - * Check if the following sequence of tokens - * forms a keyframe block. - */ - - looksLikeKeyframe: function() { - var i = 2 - , type; - switch (this.lookahead(i).type) { - case '{': - case 'indent': - case ',': - return true; - case 'newline': - while ('unit' == this.lookahead(++i).type - || 'newline' == this.lookahead(i).type) ; - type = this.lookahead(i).type; - return 'indent' == type || '{' == type; - } - }, - - /** - * Check if the current state supports selectors. - */ - - stateAllowsSelector: function() { - switch (this.currentState()) { - case 'root': - case 'atblock': - case 'selector': - case 'conditional': - case 'function': - case 'atrule': - case 'for': - return true; - } - }, - - /** - * Try to assign @block to the node. - * - * @param {Expression} expr - * @private - */ - - assignAtblock: function(expr) { - try { - expr.push(this.atblock(expr)); - } catch(err) { - this.error('invalid right-hand side operand in assignment, got {peek}'); - } - }, - - /** - * statement - * | statement 'if' expression - * | statement 'unless' expression - */ - - statement: function() { - var stmt = this.stmt() - , state = this.prevState - , block - , op; - - // special-case statements since it - // is not an expression. We could - // implement postfix conditionals at - // the expression level, however they - // would then fail to enclose properties - if (this.allowPostfix) { - this.allowPostfix = false; - state = 'expression'; - } - - switch (state) { - case 'assignment': - case 'expression': - case 'function arguments': - while (op = - this.accept('if') - || this.accept('unless') - || this.accept('for')) { - switch (op.type) { - case 'if': - case 'unless': - stmt = new nodes.If(this.expression(), stmt); - stmt.postfix = true; - stmt.negate = 'unless' == op.type; - this.accept(';'); - break; - case 'for': - var key - , val = this.id().name; - if (this.accept(',')) key = this.id().name; - this.expect('in'); - var each = new nodes.Each(val, key, this.expression()); - block = new nodes.Block(this.parent, each); - block.push(stmt); - each.block = block; - stmt = each; - } - } - } - - return stmt; - }, - - /** - * ident - * | selector - * | literal - * | charset - * | namespace - * | import - * | require - * | media - * | atrule - * | scope - * | keyframes - * | mozdocument - * | for - * | if - * | unless - * | comment - * | expression - * | 'return' expression - */ - - stmt: function() { - var tok = this.peek(), selector; - switch (tok.type) { - case 'keyframes': - return this.keyframes(); - case '-moz-document': - return this.mozdocument(); - case 'comment': - case 'selector': - case 'literal': - case 'charset': - case 'namespace': - case 'import': - case 'require': - case 'extend': - case 'media': - case 'atrule': - case 'ident': - case 'scope': - case 'supports': - case 'unless': - case 'function': - case 'for': - case 'if': - return this[tok.type](); - case 'return': - return this.return(); - case '{': - return this.property(); - default: - // Contextual selectors - if (this.stateAllowsSelector()) { - switch (tok.type) { - case 'color': - case '~': - case '>': - case '<': - case ':': - case '&': - case '&&': - case '[': - case '.': - case '/': - selector = this.selector(); - selector.column = tok.column; - selector.lineno = tok.lineno; - return selector; - // relative reference - case '..': - if ('/' == this.lookahead(2).type) - return this.selector(); - case '+': - return 'function' == this.lookahead(2).type - ? this.functionCall() - : this.selector(); - case '*': - return this.property(); - // keyframe blocks (10%, 20% { ... }) - case 'unit': - if (this.looksLikeKeyframe()) { - selector = this.selector(); - selector.column = tok.column; - selector.lineno = tok.lineno; - return selector; - } - case '-': - if ('{' == this.lookahead(2).type) - return this.property(); - } - } - - // Expression fallback - var expr = this.expression(); - if (expr.isEmpty) this.error('unexpected {peek}'); - return expr; - } - }, - - /** - * indent (!outdent)+ outdent - */ - - block: function(node, scope) { - var delim - , stmt - , next - , block = this.parent = new nodes.Block(this.parent, node); - - if (false === scope) block.scope = false; - - this.accept('newline'); - - // css-style - if (this.accept('{')) { - this.css++; - delim = '}'; - this.skipWhitespace(); - } else { - delim = 'outdent'; - this.expect('indent'); - } - - while (delim != this.peek().type) { - // css-style - if (this.css) { - if (this.accept('newline') || this.accept('indent')) continue; - stmt = this.statement(); - this.accept(';'); - this.skipWhitespace(); - } else { - if (this.accept('newline')) continue; - // skip useless indents and comments - next = this.lookahead(2).type; - if ('indent' == this.peek().type - && ~['outdent', 'newline', 'comment'].indexOf(next)) { - this.skip(['indent', 'outdent']); - continue; - } - if ('eos' == this.peek().type) return block; - stmt = this.statement(); - this.accept(';'); - } - if (!stmt) this.error('unexpected token {peek} in block'); - block.push(stmt); - } - - // css-style - if (this.css) { - this.skipWhitespace(); - this.expect('}'); - this.skipSpaces(); - this.css--; - } else { - this.expect('outdent'); - } - - this.parent = block.parent; - return block; - }, - - /** - * comment space* - */ - - comment: function(){ - var node = this.next().val; - this.skipSpaces(); - return node; - }, - - /** - * for val (',' key) in expr - */ - - for: function() { - this.expect('for'); - var key - , val = this.id().name; - if (this.accept(',')) key = this.id().name; - this.expect('in'); - this.state.push('for'); - this.cond = true; - var each = new nodes.Each(val, key, this.expression()); - this.cond = false; - each.block = this.block(each, false); - this.state.pop(); - return each; - }, - - /** - * return expression - */ - - return: function() { - this.expect('return'); - var expr = this.expression(); - return expr.isEmpty - ? new nodes.Return - : new nodes.Return(expr); - }, - - /** - * unless expression block - */ - - unless: function() { - this.expect('unless'); - this.state.push('conditional'); - this.cond = true; - var node = new nodes.If(this.expression(), true); - this.cond = false; - node.block = this.block(node, false); - this.state.pop(); - return node; - }, - - /** - * if expression block (else block)? - */ - - if: function() { - var token = this.expect('if'); - - this.state.push('conditional'); - this.cond = true; - var node = new nodes.If(this.expression()) - , cond - , block - , item; - - node.column = token.column; - - this.cond = false; - node.block = this.block(node, false); - this.skip(['newline', 'comment']); - while (this.accept('else')) { - token = this.accept('if'); - if (token) { - this.cond = true; - cond = this.expression(); - this.cond = false; - block = this.block(node, false); - item = new nodes.If(cond, block); - - item.column = token.column; - - node.elses.push(item); - } else { - node.elses.push(this.block(node, false)); - break; - } - this.skip(['newline', 'comment']); - } - this.state.pop(); - return node; - }, - - /** - * @block - * - * @param {Expression} [node] - */ - - atblock: function(node){ - if (!node) this.expect('atblock'); - node = new nodes.Atblock; - this.state.push('atblock'); - node.block = this.block(node, false); - this.state.pop(); - return node; - }, - - /** - * atrule selector? block? - */ - - atrule: function(){ - var type = this.expect('atrule').val - , node = new nodes.Atrule(type) - , tok; - this.skipSpacesAndComments(); - node.segments = this.selectorParts(); - this.skipSpacesAndComments(); - tok = this.peek().type; - if ('indent' == tok || '{' == tok || ('newline' == tok - && '{' == this.lookahead(2).type)) { - this.state.push('atrule'); - node.block = this.block(node); - this.state.pop(); - } - return node; - }, - - /** - * scope - */ - - scope: function(){ - this.expect('scope'); - var selector = this.selectorParts() - .map(function(selector) { return selector.val; }) - .join(''); - this.selectorScope = selector.trim(); - return nodes.null; - }, - - /** - * supports - */ - - supports: function(){ - this.expect('supports'); - var node = new nodes.Supports(this.supportsCondition()); - this.state.push('atrule'); - node.block = this.block(node); - this.state.pop(); - return node; - }, - - /** - * supports negation - * | supports op - * | expression - */ - - supportsCondition: function(){ - var node = this.supportsNegation() - || this.supportsOp(); - if (!node) { - this.cond = true; - node = this.expression(); - this.cond = false; - } - return node; - }, - - /** - * 'not' supports feature - */ - - supportsNegation: function(){ - if (this.accept('not')) { - var node = new nodes.Expression; - node.push(new nodes.Literal('not')); - node.push(this.supportsFeature()); - return node; - } - }, - - /** - * supports feature (('and' | 'or') supports feature)+ - */ - - supportsOp: function(){ - var feature = this.supportsFeature() - , op - , expr; - if (feature) { - expr = new nodes.Expression; - expr.push(feature); - while (op = this.accept('&&') || this.accept('||')) { - expr.push(new nodes.Literal('&&' == op.val ? 'and' : 'or')); - expr.push(this.supportsFeature()); - } - return expr; - } - }, - - /** - * ('(' supports condition ')') - * | feature - */ - - supportsFeature: function(){ - this.skipSpacesAndComments(); - if ('(' == this.peek().type) { - var la = this.lookahead(2).type; - - if ('ident' == la || '{' == la) { - return this.feature(); - } else { - this.expect('('); - var node = new nodes.Expression; - node.push(new nodes.Literal('(')); - node.push(this.supportsCondition()); - this.expect(')') - node.push(new nodes.Literal(')')); - this.skipSpacesAndComments(); - return node; - } - } - }, - - /** - * extend - */ - - extend: function(){ - var tok = this.expect('extend') - , selectors = [] - , sel - , node - , arr; - - do { - arr = this.selectorParts(); - - if (!arr.length) continue; - - sel = new nodes.Selector(arr); - selectors.push(sel); - - if ('!' !== this.peek().type) continue; - - tok = this.lookahead(2); - if ('ident' !== tok.type || 'optional' !== tok.val.name) continue; - - this.skip(['!', 'ident']); - sel.optional = true; - } while(this.accept(',')); - - node = new nodes.Extend(selectors); - node.lineno = tok.lineno; - node.column = tok.column; - return node; - }, - - /** - * media queries - */ - - media: function() { - this.expect('media'); - this.state.push('atrule'); - var media = new nodes.Media(this.queries()); - media.block = this.block(media); - this.state.pop(); - return media; - }, - - /** - * query (',' query)* - */ - - queries: function() { - var queries = new nodes.QueryList - , skip = ['comment', 'newline', 'space']; - - do { - this.skip(skip); - queries.push(this.query()); - this.skip(skip); - } while (this.accept(',')); - return queries; - }, - - /** - * expression - * | (ident | 'not')? ident ('and' feature)* - * | feature ('and' feature)* - */ - - query: function() { - var query = new nodes.Query - , expr - , pred - , id; - - // hash values support - if ('ident' == this.peek().type - && ('.' == this.lookahead(2).type - || '[' == this.lookahead(2).type)) { - this.cond = true; - expr = this.expression(); - this.cond = false; - query.push(new nodes.Feature(expr.nodes)); - return query; - } - - if (pred = this.accept('ident') || this.accept('not')) { - pred = new nodes.Literal(pred.val.string || pred.val); - - this.skipSpacesAndComments(); - if (id = this.accept('ident')) { - query.type = id.val; - query.predicate = pred; - } else { - query.type = pred; - } - this.skipSpacesAndComments(); - - if (!this.accept('&&')) return query; - } - - do { - query.push(this.feature()); - } while (this.accept('&&')); - - return query; - }, - - /** - * '(' ident ( ':'? expression )? ')' - */ - - feature: function() { - this.skipSpacesAndComments(); - this.expect('('); - this.skipSpacesAndComments(); - var node = new nodes.Feature(this.interpolate()); - this.skipSpacesAndComments(); - this.accept(':') - this.skipSpacesAndComments(); - this.inProperty = true; - node.expr = this.list(); - this.inProperty = false; - this.skipSpacesAndComments(); - this.expect(')'); - this.skipSpacesAndComments(); - return node; - }, - - /** - * @-moz-document call (',' call)* block - */ - - mozdocument: function(){ - this.expect('-moz-document'); - var mozdocument = new nodes.Atrule('-moz-document') - , calls = []; - do { - this.skipSpacesAndComments(); - calls.push(this.functionCall()); - this.skipSpacesAndComments(); - } while (this.accept(',')); - mozdocument.segments = [new nodes.Literal(calls.join(', '))]; - this.state.push('atrule'); - mozdocument.block = this.block(mozdocument, false); - this.state.pop(); - return mozdocument; - }, - - /** - * import expression - */ - - import: function() { - this.expect('import'); - this.allowPostfix = true; - return new nodes.Import(this.expression(), false); - }, - - /** - * require expression - */ - - require: function() { - this.expect('require'); - this.allowPostfix = true; - return new nodes.Import(this.expression(), true); - }, - - /** - * charset string - */ - - charset: function() { - this.expect('charset'); - var str = this.expect('string').val; - this.allowPostfix = true; - return new nodes.Charset(str); - }, - - /** - * namespace ident? (string | url) - */ - - namespace: function() { - var str - , prefix; - this.expect('namespace'); - - this.skipSpacesAndComments(); - if (prefix = this.accept('ident')) { - prefix = prefix.val; - } - this.skipSpacesAndComments(); - - str = this.accept('string') || this.url(); - this.allowPostfix = true; - return new nodes.Namespace(str, prefix); - }, - - /** - * keyframes name block - */ - - keyframes: function() { - var tok = this.expect('keyframes') - , keyframes; - - this.skipSpacesAndComments(); - keyframes = new nodes.Keyframes(this.selectorParts(), tok.val); - keyframes.column = tok.column; - - this.skipSpacesAndComments(); - - // block - this.state.push('atrule'); - keyframes.block = this.block(keyframes); - this.state.pop(); - - return keyframes; - }, - - /** - * literal - */ - - literal: function() { - return this.expect('literal').val; - }, - - /** - * ident space? - */ - - id: function() { - var tok = this.expect('ident'); - this.accept('space'); - return tok.val; - }, - - /** - * ident - * | assignment - * | property - * | selector - */ - - ident: function() { - var i = 2 - , la = this.lookahead(i).type; - - while ('space' == la) la = this.lookahead(++i).type; - - switch (la) { - // Assignment - case '=': - case '?=': - case '-=': - case '+=': - case '*=': - case '/=': - case '%=': - return this.assignment(); - // Member - case '.': - if ('space' == this.lookahead(i - 1).type) return this.selector(); - if (this._ident == this.peek()) return this.id(); - while ('=' != this.lookahead(++i).type - && !~['[', ',', 'newline', 'indent', 'eos'].indexOf(this.lookahead(i).type)) ; - if ('=' == this.lookahead(i).type) { - this._ident = this.peek(); - return this.expression(); - } else if (this.looksLikeSelector() && this.stateAllowsSelector()) { - return this.selector(); - } - // Assignment []= - case '[': - if (this._ident == this.peek()) return this.id(); - while (']' != this.lookahead(i++).type - && 'selector' != this.lookahead(i).type - && 'eos' != this.lookahead(i).type) ; - if ('=' == this.lookahead(i).type) { - this._ident = this.peek(); - return this.expression(); - } else if (this.looksLikeSelector() && this.stateAllowsSelector()) { - return this.selector(); - } - // Operation - case '-': - case '+': - case '/': - case '*': - case '%': - case '**': - case '&&': - case '||': - case '>': - case '<': - case '>=': - case '<=': - case '!=': - case '==': - case '?': - case 'in': - case 'is a': - case 'is defined': - // Prevent cyclic .ident, return literal - if (this._ident == this.peek()) { - return this.id(); - } else { - this._ident = this.peek(); - switch (this.currentState()) { - // unary op or selector in property / for - case 'for': - case 'selector': - return this.property(); - // Part of a selector - case 'root': - case 'atblock': - case 'atrule': - return '[' == la - ? this.subscript() - : this.selector(); - case 'function': - case 'conditional': - return this.looksLikeSelector() - ? this.selector() - : this.expression(); - // Do not disrupt the ident when an operand - default: - return this.operand - ? this.id() - : this.expression(); - } - } - // Selector or property - default: - switch (this.currentState()) { - case 'root': - return this.selector(); - case 'for': - case 'selector': - case 'function': - case 'conditional': - case 'atblock': - case 'atrule': - return this.property(); - default: - var id = this.id(); - if ('interpolation' == this.previousState()) id.mixin = true; - return id; - } - } - }, - - /** - * '*'? (ident | '{' expression '}')+ - */ - - interpolate: function() { - var node - , segs = [] - , star; - - star = this.accept('*'); - if (star) segs.push(new nodes.Literal('*')); - - while (true) { - if (this.accept('{')) { - this.state.push('interpolation'); - segs.push(this.expression()); - this.expect('}'); - this.state.pop(); - } else if (node = this.accept('-')){ - segs.push(new nodes.Literal('-')); - } else if (node = this.accept('ident')){ - segs.push(node.val); - } else { - break; - } - } - if (!segs.length) this.expect('ident'); - return segs; - }, - - /** - * property ':'? expression - * | ident - */ - - property: function() { - if (this.looksLikeSelector(true)) return this.selector(); - - // property - var ident = this.interpolate() - , prop = new nodes.Property(ident) - , ret = prop; - - // optional ':' - this.accept('space'); - if (this.accept(':')) this.accept('space'); - - this.state.push('property'); - this.inProperty = true; - prop.expr = this.list(); - if (prop.expr.isEmpty) ret = ident[0]; - this.inProperty = false; - this.allowPostfix = true; - this.state.pop(); - - // optional ';' - this.accept(';'); - - return ret; - }, - - /** - * selector ',' selector - * | selector newline selector - * | selector block - */ - - selector: function() { - var arr - , group = new nodes.Group - , scope = this.selectorScope - , isRoot = 'root' == this.currentState() - , selector; - - do { - // Clobber newline after , - this.accept('newline'); - - arr = this.selectorParts(); - - // Push the selector - if (isRoot && scope) arr.unshift(new nodes.Literal(scope + ' ')); - if (arr.length) { - selector = new nodes.Selector(arr); - selector.lineno = arr[0].lineno; - selector.column = arr[0].column; - group.push(selector); - } - } while (this.accept(',') || this.accept('newline')); - - if ('selector-parts' == this.currentState()) return group.nodes; - - this.state.push('selector'); - group.block = this.block(group); - this.state.pop(); - - return group; - }, - - selectorParts: function(){ - var tok - , arr = []; - - // Selector candidates, - // stitched together to - // form a selector. - while (tok = this.selectorToken()) { - debug.selector('%s', tok); - // Selector component - switch (tok.type) { - case '{': - this.skipSpaces(); - var expr = this.expression(); - this.skipSpaces(); - this.expect('}'); - arr.push(expr); - break; - case this.prefix && '.': - var literal = new nodes.Literal(tok.val + this.prefix); - literal.prefixed = true; - arr.push(literal); - break; - case 'comment': - // ignore comments - break; - case 'color': - case 'unit': - arr.push(new nodes.Literal(tok.val.raw)); - break; - case 'space': - arr.push(new nodes.Literal(' ')); - break; - case 'function': - arr.push(new nodes.Literal(tok.val.name + '(')); - break; - case 'ident': - arr.push(new nodes.Literal(tok.val.name || tok.val.string)); - break; - default: - arr.push(new nodes.Literal(tok.val)); - if (tok.space) arr.push(new nodes.Literal(' ')); - } - } - - return arr; - }, - - /** - * ident ('=' | '?=') expression - */ - - assignment: function() { - var - op, - node, - ident = this.id(), - name = ident.name; - - if (op = - this.accept('=') - || this.accept('?=') - || this.accept('+=') - || this.accept('-=') - || this.accept('*=') - || this.accept('/=') - || this.accept('%=')) { - this.state.push('assignment'); - var expr = this.list(); - // @block support - if (expr.isEmpty) this.assignAtblock(expr); - node = new nodes.Ident(name, expr); - - node.lineno = ident.lineno; - node.column = ident.column; - - this.state.pop(); - - switch (op.type) { - case '?=': - var defined = new nodes.BinOp('is defined', node) - , lookup = new nodes.Expression; - lookup.push(new nodes.Ident(name)); - node = new nodes.Ternary(defined, lookup, node); - break; - case '+=': - case '-=': - case '*=': - case '/=': - case '%=': - node.val = new nodes.BinOp(op.type[0], new nodes.Ident(name), expr); - break; - } - } - - return node; - }, - - /** - * definition - * | call - */ - - function: function() { - var parens = 1 - , i = 2 - , tok; - - // Lookahead and determine if we are dealing - // with a function call or definition. Here - // we pair parens to prevent false negatives - out: - while (tok = this.lookahead(i++)) { - switch (tok.type) { - case 'function': - case '(': - ++parens; - break; - case ')': - if (!--parens) break out; - break; - case 'eos': - this.error('failed to find closing paren ")"'); - } - } - - // Definition or call - switch (this.currentState()) { - case 'expression': - return this.functionCall(); - default: - return this.looksLikeFunctionDefinition(i) - ? this.functionDefinition() - : this.expression(); - } - }, - - /** - * url '(' (expression | urlchars)+ ')' - */ - - url: function() { - this.expect('function'); - this.state.push('function arguments'); - var args = this.args(); - this.expect(')'); - this.state.pop(); - return new nodes.Call('url', args); - }, - - /** - * '+'? ident '(' expression ')' block? - */ - - functionCall: function() { - var withBlock = this.accept('+'); - if ('url' == this.peek().val.name) return this.url(); - - var tok = this.expect('function').val; - var name = tok.name; - - this.state.push('function arguments'); - this.parens++; - var args = this.args(); - this.expect(')'); - this.parens--; - this.state.pop(); - var call = new nodes.Call(name, args); - - call.column = tok.column; - call.lineno = tok.lineno; - - if (withBlock) { - this.state.push('function'); - call.block = this.block(call); - this.state.pop(); - } - return call; - }, - - /** - * ident '(' params ')' block - */ - - functionDefinition: function() { - var - tok = this.expect('function'), - name = tok.val.name; - - // params - this.state.push('function params'); - this.skipWhitespace(); - var params = this.params(); - this.skipWhitespace(); - this.expect(')'); - this.state.pop(); - - // Body - this.state.push('function'); - var fn = new nodes.Function(name, params); - - fn.column = tok.column; - fn.lineno = tok.lineno; - - fn.block = this.block(fn); - this.state.pop(); - return new nodes.Ident(name, fn); - }, - - /** - * ident - * | ident '...' - * | ident '=' expression - * | ident ',' ident - */ - - params: function() { - var tok - , node - , params = new nodes.Params; - while (tok = this.accept('ident')) { - this.accept('space'); - params.push(node = tok.val); - if (this.accept('...')) { - node.rest = true; - } else if (this.accept('=')) { - node.val = this.expression(); - } - this.skipWhitespace(); - this.accept(','); - this.skipWhitespace(); - } - return params; - }, - - /** - * (ident ':')? expression (',' (ident ':')? expression)* - */ - - args: function() { - var args = new nodes.Arguments - , keyword; - - do { - // keyword - if ('ident' == this.peek().type && ':' == this.lookahead(2).type) { - keyword = this.next().val.string; - this.expect(':'); - args.map[keyword] = this.expression(); - // arg - } else { - args.push(this.expression()); - } - } while (this.accept(',')); - - return args; - }, - - /** - * expression (',' expression)* - */ - - list: function() { - var node = this.expression(); - - while (this.accept(',')) { - if (node.isList) { - list.push(this.expression()); - } else { - var list = new nodes.Expression(true); - list.push(node); - list.push(this.expression()); - node = list; - } - } - return node; - }, - - /** - * negation+ - */ - - expression: function() { - var node - , expr = new nodes.Expression; - this.state.push('expression'); - while (node = this.negation()) { - if (!node) this.error('unexpected token {peek} in expression'); - expr.push(node); - } - this.state.pop(); - if (expr.nodes.length) { - expr.lineno = expr.nodes[0].lineno; - expr.column = expr.nodes[0].column; - } - return expr; - }, - - /** - * 'not' ternary - * | ternary - */ - - negation: function() { - if (this.accept('not')) { - return new nodes.UnaryOp('!', this.negation()); - } - return this.ternary(); - }, - - /** - * logical ('?' expression ':' expression)? - */ - - ternary: function() { - var node = this.logical(); - if (this.accept('?')) { - var trueExpr = this.expression(); - this.expect(':'); - var falseExpr = this.expression(); - node = new nodes.Ternary(node, trueExpr, falseExpr); - } - return node; - }, - - /** - * typecheck (('&&' | '||') typecheck)* - */ - - logical: function() { - var op - , node = this.typecheck(); - while (op = this.accept('&&') || this.accept('||')) { - node = new nodes.BinOp(op.type, node, this.typecheck()); - } - return node; - }, - - /** - * equality ('is a' equality)* - */ - - typecheck: function() { - var op - , node = this.equality(); - while (op = this.accept('is a')) { - this.operand = true; - if (!node) this.error('illegal unary "' + op + '", missing left-hand operand'); - node = new nodes.BinOp(op.type, node, this.equality()); - this.operand = false; - } - return node; - }, - - /** - * in (('==' | '!=') in)* - */ - - equality: function() { - var op - , node = this.in(); - while (op = this.accept('==') || this.accept('!=')) { - this.operand = true; - if (!node) this.error('illegal unary "' + op + '", missing left-hand operand'); - node = new nodes.BinOp(op.type, node, this.in()); - this.operand = false; - } - return node; - }, - - /** - * relational ('in' relational)* - */ - - in: function() { - var node = this.relational(); - while (this.accept('in')) { - this.operand = true; - if (!node) this.error('illegal unary "in", missing left-hand operand'); - node = new nodes.BinOp('in', node, this.relational()); - this.operand = false; - } - return node; - }, - - /** - * range (('>=' | '<=' | '>' | '<') range)* - */ - - relational: function() { - var op - , node = this.range(); - while (op = - this.accept('>=') - || this.accept('<=') - || this.accept('<') - || this.accept('>') - ) { - this.operand = true; - if (!node) this.error('illegal unary "' + op + '", missing left-hand operand'); - node = new nodes.BinOp(op.type, node, this.range()); - this.operand = false; - } - return node; - }, - - /** - * additive (('..' | '...') additive)* - */ - - range: function() { - var op - , node = this.additive(); - if (op = this.accept('...') || this.accept('..')) { - this.operand = true; - if (!node) this.error('illegal unary "' + op + '", missing left-hand operand'); - node = new nodes.BinOp(op.val, node, this.additive()); - this.operand = false; - } - return node; - }, - - /** - * multiplicative (('+' | '-') multiplicative)* - */ - - additive: function() { - var op - , node = this.multiplicative(); - while (op = this.accept('+') || this.accept('-')) { - this.operand = true; - node = new nodes.BinOp(op.type, node, this.multiplicative()); - this.operand = false; - } - return node; - }, - - /** - * defined (('**' | '*' | '/' | '%') defined)* - */ - - multiplicative: function() { - var op - , node = this.defined(); - while (op = - this.accept('**') - || this.accept('*') - || this.accept('/') - || this.accept('%')) { - this.operand = true; - if ('/' == op && this.inProperty && !this.parens) { - this.stash.push(new Token('literal', new nodes.Literal('/'))); - this.operand = false; - return node; - } else { - if (!node) this.error('illegal unary "' + op + '", missing left-hand operand'); - node = new nodes.BinOp(op.type, node, this.defined()); - this.operand = false; - } - } - return node; - }, - - /** - * unary 'is defined' - * | unary - */ - - defined: function() { - var node = this.unary(); - if (this.accept('is defined')) { - if (!node) this.error('illegal unary "is defined", missing left-hand operand'); - node = new nodes.BinOp('is defined', node); - } - return node; - }, - - /** - * ('!' | '~' | '+' | '-') unary - * | subscript - */ - - unary: function() { - var op - , node; - if (op = - this.accept('!') - || this.accept('~') - || this.accept('+') - || this.accept('-')) { - this.operand = true; - node = this.unary(); - if (!node) this.error('illegal unary "' + op + '"'); - node = new nodes.UnaryOp(op.type, node); - this.operand = false; - return node; - } - return this.subscript(); - }, - - /** - * member ('[' expression ']')+ '='? - * | member - */ - - subscript: function() { - var node = this.member() - , id; - while (this.accept('[')) { - node = new nodes.BinOp('[]', node, this.expression()); - this.expect(']'); - } - // TODO: TernaryOp :) - if (this.accept('=')) { - node.op += '='; - node.val = this.list(); - // @block support - if (node.val.isEmpty) this.assignAtblock(node.val); - } - return node; - }, - - /** - * primary ('.' id)+ '='? - * | primary - */ - - member: function() { - var node = this.primary(); - if (node) { - while (this.accept('.')) { - var id = new nodes.Ident(this.expect('ident').val.string); - node = new nodes.Member(node, id); - } - this.skipSpaces(); - if (this.accept('=')) { - node.val = this.list(); - // @block support - if (node.val.isEmpty) this.assignAtblock(node.val); - } - } - return node; - }, - - /** - * '{' '}' - * | '{' pair (ws pair)* '}' - */ - - object: function(){ - var obj = new nodes.Object - , id, val, comma, hash; - this.expect('{'); - this.skipWhitespace(); - - while (!this.accept('}')) { - if (this.accept('comment') - || this.accept('newline')) continue; - - if (!comma) this.accept(','); - id = this.accept('ident') || this.accept('string'); - - if (!id) { - this.error('expected "ident" or "string", got {peek}'); - } - - hash = id.val.hash; - - this.skipSpacesAndComments(); - this.expect(':'); - - val = this.expression(); - - obj.setValue(hash, val); - obj.setKey(hash, id.val); - - comma = this.accept(','); - this.skipWhitespace(); - } - - return obj; - }, - - /** - * unit - * | null - * | color - * | string - * | ident - * | boolean - * | literal - * | object - * | atblock - * | atrule - * | '(' expression ')' '%'? - */ - - primary: function() { - var tok; - this.skipSpaces(); - - // Parenthesis - if (this.accept('(')) { - ++this.parens; - var expr = this.expression() - , paren = this.expect(')'); - --this.parens; - if (this.accept('%')) expr.push(new nodes.Ident('%')); - tok = this.peek(); - // (1 + 2)px, (1 + 2)em, etc. - if (!paren.space - && 'ident' == tok.type - && ~units.indexOf(tok.val.string)) { - expr.push(new nodes.Ident(tok.val.string)); - this.next(); - } - return expr; - } - - tok = this.peek(); - - // Primitive - switch (tok.type) { - case 'null': - case 'unit': - case 'color': - case 'string': - case 'literal': - case 'boolean': - case 'comment': - return this.next().val; - case !this.cond && '{': - return this.object(); - case 'atblock': - return this.atblock(); - // property lookup - case 'atrule': - var id = new nodes.Ident(this.next().val); - id.property = true; - return id; - case 'ident': - return this.ident(); - case 'function': - return tok.anonymous - ? this.functionDefinition() - : this.functionCall(); - } - } -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/renderer.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/renderer.js deleted file mode 100644 index 1b17d0b7..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/renderer.js +++ /dev/null @@ -1,246 +0,0 @@ - -/*! - * Stylus - Renderer - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Parser = require('./parser') - , EventEmitter = require('events').EventEmitter - , Evaluator = require('./visitor/evaluator') - , Normalizer = require('./visitor/normalizer') - , events = new EventEmitter - , utils = require('./utils') - , nodes = require('./nodes') - , join = require('path').join; - -/** - * Expose `Renderer`. - */ - -module.exports = Renderer; - -/** - * Initialize a new `Renderer` with the given `str` and `options`. - * - * @param {String} str - * @param {Object} options - * @api public - */ - -function Renderer(str, options) { - options = options || {}; - options.globals = options.globals || {}; - options.functions = options.functions || {}; - options.use = options.use || []; - options.use = Array.isArray(options.use) ? options.use : [options.use]; - options.imports = [join(__dirname, 'functions/index.styl')].concat(options.imports || []); - options.paths = options.paths || []; - options.filename = options.filename || 'stylus'; - options.Evaluator = options.Evaluator || Evaluator; - this.options = options; - this.str = str; - this.events = events; -}; - -/** - * Inherit from `EventEmitter.prototype`. - */ - -Renderer.prototype.__proto__ = EventEmitter.prototype; - -/** - * Expose events explicitly. - */ - -module.exports.events = events; - -/** - * Parse and evaluate AST, then callback `fn(err, css, js)`. - * - * @param {Function} fn - * @api public - */ - -Renderer.prototype.render = function(fn){ - var parser = this.parser = new Parser(this.str, this.options); - - // use plugin(s) - for (var i = 0, len = this.options.use.length; i < len; i++) { - this.use(this.options.use[i]); - } - - try { - nodes.filename = this.options.filename; - // parse - var ast = parser.parse(); - - // evaluate - this.evaluator = new this.options.Evaluator(ast, this.options); - this.nodes = nodes; - this.evaluator.renderer = this; - ast = this.evaluator.evaluate(); - - // normalize - var normalizer = new Normalizer(ast, this.options); - ast = normalizer.normalize(); - - // compile - var compiler = this.options.sourcemap - ? new (require('./visitor/sourcemapper'))(ast, this.options) - : new (require('./visitor/compiler'))(ast, this.options) - , css = compiler.compile(); - - // expose sourcemap - if (this.options.sourcemap) this.sourcemap = compiler.map.toJSON(); - } catch (err) { - var options = {}; - options.input = err.input || this.str; - options.filename = err.filename || this.options.filename; - options.lineno = err.lineno || parser.lexer.lineno; - options.column = err.column || parser.lexer.column; - if (!fn) throw utils.formatException(err, options); - return fn(utils.formatException(err, options)); - } - - // fire `end` event - var listeners = this.listeners('end'); - if (fn) listeners.push(fn); - for (var i = 0, len = listeners.length; i < len; i++) { - var ret = listeners[i](null, css); - if (ret) css = ret; - } - if (!fn) return css; -}; - -/** - * Get dependencies of the compiled file. - * - * @param {String} [filename] - * @return {Array} - * @api public - */ - -Renderer.prototype.deps = function(filename){ - var opts = utils.merge({ cache: false }, this.options); - if (filename) opts.filename = filename; - - var DepsResolver = require('./visitor/deps-resolver') - , parser = new Parser(this.str, opts); - - try { - nodes.filename = opts.filename; - // parse - var ast = parser.parse() - , resolver = new DepsResolver(ast, opts); - - // resolve dependencies - return resolver.resolve(); - } catch (err) { - var options = {}; - options.input = err.input || this.str; - options.filename = err.filename || opts.filename; - options.lineno = err.lineno || parser.lexer.lineno; - options.column = err.column || parser.lexer.column; - throw utils.formatException(err, options); - } -}; - -/** - * Set option `key` to `val`. - * - * @param {String} key - * @param {Mixed} val - * @return {Renderer} for chaining - * @api public - */ - -Renderer.prototype.set = function(key, val){ - this.options[key] = val; - return this; -}; - -/** - * Get option `key`. - * - * @param {String} key - * @return {Mixed} val - * @api public - */ - -Renderer.prototype.get = function(key){ - return this.options[key]; -}; - -/** - * Include the given `path` to the lookup paths array. - * - * @param {String} path - * @return {Renderer} for chaining - * @api public - */ - -Renderer.prototype.include = function(path){ - this.options.paths.push(path); - return this; -}; - -/** - * Use the given `fn`. - * - * This allows for plugins to alter the renderer in - * any way they wish, exposing paths etc. - * - * @param {Function} - * @return {Renderer} for chaining - * @api public - */ - -Renderer.prototype.use = function(fn){ - fn.call(this, this); - return this; -}; - -/** - * Define function or global var with the given `name`. Optionally - * the function may accept full expressions, by setting `raw` - * to `true`. - * - * @param {String} name - * @param {Function|Node} fn - * @return {Renderer} for chaining - * @api public - */ - -Renderer.prototype.define = function(name, fn, raw){ - fn = utils.coerce(fn, raw); - - if (fn.nodeName) { - this.options.globals[name] = fn; - return this; - } - - // function - this.options.functions[name] = fn; - if (undefined != raw) fn.raw = raw; - return this; -}; - -/** - * Import the given `file`. - * - * @param {String} file - * @return {Renderer} for chaining - * @api public - */ - -Renderer.prototype.import = function(file){ - this.options.imports.push(file); - return this; -}; - - diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/selector-parser.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/selector-parser.js deleted file mode 100644 index c0071903..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/selector-parser.js +++ /dev/null @@ -1,258 +0,0 @@ -/*! - * Stylus - Selector Parser - * Copyright (c) Automattic - * MIT Licensed - */ - -var COMBINATORS = ['>', '+', '~']; - -/** - * Initialize a new `SelectorParser` - * with the given `str` and selectors `stack`. - * - * @param {String} str - * @param {Array} stack - * @param {Array} parts - * @api private - */ - -var SelectorParser = module.exports = function SelectorParser(str, stack, parts) { - this.str = str; - this.stack = stack || []; - this.parts = parts || []; - this.pos = 0; - this.level = 2; - this.nested = true; - this.ignore = false; -}; - -/** - * Consume the given `len` and move current position. - * - * @param {Number} len - * @api private - */ - -SelectorParser.prototype.skip = function(len) { - this.str = this.str.substr(len); - this.pos += len; -}; - -/** - * Consume spaces. - */ - -SelectorParser.prototype.skipSpaces = function() { - while (' ' == this.str[0]) this.skip(1); -}; - -/** - * Fetch next token. - * - * @return {String} - * @api private - */ - -SelectorParser.prototype.advance = function() { - return this.root() - || this.relative() - || this.initial() - || this.escaped() - || this.parent() - || this.partial() - || this.char(); -}; - -/** - * '/' - */ - -SelectorParser.prototype.root = function() { - if (!this.pos && '/' == this.str[0] - && 'deep' != this.str.slice(1, 5)) { - this.nested = false; - this.skip(1); - } -}; - -/** - * '../' - */ - -SelectorParser.prototype.relative = function(multi) { - if ((!this.pos || multi) && '../' == this.str.slice(0, 3)) { - this.nested = false; - this.skip(3); - while (this.relative(true)) this.level++; - if (!this.raw) { - var ret = this.stack[this.stack.length - this.level]; - if (ret) { - return ret; - } else { - this.ignore = true; - } - } - } -}; - -/** - * '~/' - */ - -SelectorParser.prototype.initial = function() { - if (!this.pos && '~' == this.str[0] && '/' == this.str[1]) { - this.nested = false; - this.skip(2); - return this.stack[0]; - } -}; - -/** - * '\' ('&' | '^') - */ - -SelectorParser.prototype.escaped = function() { - if ('\\' == this.str[0]) { - var char = this.str[1]; - if ('&' == char || '^' == char) { - this.skip(2); - return char; - } - } -}; - -/** - * '&' - */ - -SelectorParser.prototype.parent = function() { - if ('&' == this.str[0]) { - this.nested = false; - - if (!this.pos && (!this.stack.length || this.raw)) { - var i = 0; - while (' ' == this.str[++i]) ; - if (~COMBINATORS.indexOf(this.str[i])) { - this.skip(i + 1); - return; - } - } - - this.skip(1); - if (!this.raw) - return this.stack[this.stack.length - 1]; - } -}; - -/** - * '^[' range ']' - */ - -SelectorParser.prototype.partial = function() { - if ('^' == this.str[0] && '[' == this.str[1]) { - this.skip(2); - this.skipSpaces(); - var ret = this.range(); - this.skipSpaces(); - if (']' != this.str[0]) return '^['; - this.nested = false; - this.skip(1); - if (ret) { - return ret; - } else { - this.ignore = true; - } - } -}; - -/** - * '-'? 0-9+ - */ - -SelectorParser.prototype.number = function() { - var i = 0, ret = ''; - if ('-' == this.str[i]) - ret += this.str[i++]; - - while (this.str.charCodeAt(i) >= 48 - && this.str.charCodeAt(i) <= 57) - ret += this.str[i++]; - - if (ret) { - this.skip(i); - return Number(ret); - } -}; - -/** - * number ('..' number)? - */ - -SelectorParser.prototype.range = function() { - var start = this.number() - , ret; - - if ('..' == this.str.slice(0, 2)) { - this.skip(2); - var end = this.number() - , len = this.parts.length; - - if (start < 0) start = len + start - 1; - if (end < 0) end = len + end - 1; - - if (start > end) { - var tmp = start; - start = end; - end = tmp; - } - - if (end < len - 1) { - ret = this.parts.slice(start, end + 1).map(function(part) { - var selector = new SelectorParser(part, this.stack, this.parts); - selector.raw = true; - return selector.parse(); - }, this).map(function(selector) { - return (selector.nested ? ' ' : '') + selector.val; - }).join('').trim(); - } - } else { - ret = this.stack[ - start < 0 ? this.stack.length + start - 1 : start - ]; - } - - if (ret) { - return ret; - } else { - this.ignore = true; - } -}; - -/** - * .+ - */ - -SelectorParser.prototype.char = function() { - var char = this.str[0]; - this.skip(1); - return char; -}; - -/** - * Parses the selector. - * - * @return {Object} - * @api private - */ - -SelectorParser.prototype.parse = function() { - var val = ''; - while (this.str.length) { - val += this.advance() || ''; - if (this.ignore) { - val = ''; - break; - } - } - return { val: val.trimRight(), nested: this.nested }; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/stack/frame.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/stack/frame.js deleted file mode 100644 index 9cacc724..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/stack/frame.js +++ /dev/null @@ -1,65 +0,0 @@ - -/*! - * Stylus - stack - Frame - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Scope = require('./scope'); - -/** - * Initialize a new `Frame` with the given `block`. - * - * @param {Block} block - * @api private - */ - -var Frame = module.exports = function Frame(block) { - this._scope = false === block.scope - ? null - : new Scope; - this.block = block; -}; - -/** - * Return this frame's scope or the parent scope - * for scope-less blocks. - * - * @return {Scope} - * @api public - */ - -Frame.prototype.__defineGetter__('scope', function(){ - return this._scope || this.parent.scope; -}); - -/** - * Lookup the given local variable `name`. - * - * @param {String} name - * @return {Node} - * @api private - */ - -Frame.prototype.lookup = function(name){ - return this.scope.lookup(name) -}; - -/** - * Custom inspect. - * - * @return {String} - * @api public - */ - -Frame.prototype.inspect = function(){ - return '[Frame ' - + (false === this.block.scope - ? 'scope-less' - : this.scope.inspect()) - + ']'; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/stack/index.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/stack/index.js deleted file mode 100644 index 06ae6f41..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/stack/index.js +++ /dev/null @@ -1,135 +0,0 @@ - -/*! - * Stylus - Stack - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Initialize a new `Stack`. - * - * @api private - */ - -var Stack = module.exports = function Stack() { - Array.apply(this, arguments); -}; - -/** - * Inherit from `Array.prototype`. - */ - -Stack.prototype.__proto__ = Array.prototype; - -/** - * Push the given `frame`. - * - * @param {Frame} frame - * @api public - */ - -Stack.prototype.push = function(frame){ - frame.stack = this; - frame.parent = this.currentFrame; - return [].push.apply(this, arguments); -}; - -/** - * Return the current stack `Frame`. - * - * @return {Frame} - * @api private - */ - -Stack.prototype.__defineGetter__('currentFrame', function(){ - return this[this.length - 1]; -}); - -/** - * Lookup stack frame for the given `block`. - * - * @param {Block} block - * @return {Frame} - * @api private - */ - -Stack.prototype.getBlockFrame = function(block){ - for (var i = 0; i < this.length; ++i) { - if (block == this[i].block) { - return this[i]; - } - } -}; - -/** - * Lookup the given local variable `name`, relative - * to the lexical scope of the current frame's `Block`. - * - * When the result of a lookup is an identifier - * a recursive lookup is performed, defaulting to - * returning the identifier itself. - * - * @param {String} name - * @return {Node} - * @api private - */ - -Stack.prototype.lookup = function(name){ - var block = this.currentFrame.block - , val - , ret; - - do { - var frame = this.getBlockFrame(block); - if (frame && (val = frame.lookup(name))) { - return val; - } - } while (block = block.parent); -}; - -/** - * Custom inspect. - * - * @return {String} - * @api private - */ - -Stack.prototype.inspect = function(){ - return this.reverse().map(function(frame){ - return frame.inspect(); - }).join('\n'); -}; - -/** - * Return stack string formatted as: - * - * at (::) - * - * @return {String} - * @api private - */ - -Stack.prototype.toString = function(){ - var block - , node - , buf = [] - , location - , len = this.length; - - while (len--) { - block = this[len].block; - if (node = block.node) { - location = '(' + node.filename + ':' + (node.lineno + 1) + ':' + node.column + ')'; - switch (node.nodeName) { - case 'function': - buf.push(' at ' + node.name + '() ' + location); - break; - case 'group': - buf.push(' at "' + node.nodes[0].val + '" ' + location); - break; - } - } - } - - return buf.join('\n'); -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/stack/scope.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/stack/scope.js deleted file mode 100644 index a95942e9..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/stack/scope.js +++ /dev/null @@ -1,62 +0,0 @@ - -/*! - * Stylus - stack - Scope - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Initialize a new `Scope`. - * - * @api private - */ - -var Scope = module.exports = function Scope() { - this.locals = {}; -}; - -/** - * Add `ident` node to the current scope. - * - * @param {Ident} ident - * @api private - */ - -Scope.prototype.add = function(ident){ - this.locals[ident.name] = ident.val; -}; - -/** - * Lookup the given local variable `name`. - * - * @param {String} name - * @return {Node} - * @api private - */ - -Scope.prototype.lookup = function(name){ - return hasOwnProperty(this.locals, name) ? this.locals[name] : undefined; -}; - -/** - * Custom inspect. - * - * @return {String} - * @api public - */ - -Scope.prototype.inspect = function(){ - var keys = Object.keys(this.locals).map(function(key){ return '@' + key; }); - return '[Scope' - + (keys.length ? ' ' + keys.join(', ') : '') - + ']'; -}; - -/** - * @param {Object} obj - * @param {String} propName - * @returns {Boolean} - */ -function hasOwnProperty(obj, propName) { - return Object.prototype.hasOwnProperty.call(obj, propName); -} diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/stylus.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/stylus.js deleted file mode 100644 index 7f58812b..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/stylus.js +++ /dev/null @@ -1,103 +0,0 @@ -/*! - * Stylus - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Renderer = require('./renderer') - , nodes = require('./nodes') - , utils = require('./utils'); - -/** - * Export render as the module. - */ - -exports = module.exports = render; - -/** - * Library version. - */ - -exports.version = require('../package').version; - -/** - * Expose nodes. - */ - -exports.nodes = nodes; - -/** - * Expose BIFs. - */ - -exports.functions = require('./functions'); - -/** - * Expose utils. - */ - -exports.utils = require('./utils'); - -/** - * Expose middleware. - */ - -exports.middleware = require('./middleware'); - -/** - * Expose constructors. - */ - -exports.Visitor = require('./visitor'); -exports.Parser = require('./parser'); -exports.Evaluator = require('./visitor/evaluator'); -exports.Normalizer = require('./visitor/normalizer'); -exports.Compiler = require('./visitor/compiler'); - -/** - * Convert the given `css` to `stylus` source. - * - * @param {String} css - * @return {String} - * @api public - */ - -exports.convertCSS = require('./convert/css'); - -/** - * Render the given `str` with `options` and callback `fn(err, css)`. - * - * @param {String} str - * @param {Object|Function} options - * @param {Function} fn - * @api public - */ - -exports.render = function(str, options, fn){ - if ('function' == typeof options) fn = options, options = {}; - return new Renderer(str, options).render(fn); -}; - -/** - * Return a new `Renderer` for the given `str` and `options`. - * - * @param {String} str - * @param {Object} options - * @return {Renderer} - * @api public - */ - -function render(str, options) { - return new Renderer(str, options); -} - -/** - * Expose optional functions. - */ - -exports.url = require('./functions/url'); -exports.resolver = require('./functions/resolver'); diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/token.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/token.js deleted file mode 100644 index e1383d55..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/token.js +++ /dev/null @@ -1,53 +0,0 @@ - -/*! - * Stylus - Token - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var inspect = require('util').inspect; - -/** - * Initialize a new `Token` with the given `type` and `val`. - * - * @param {String} type - * @param {Mixed} val - * @api private - */ - -var Token = exports = module.exports = function Token(type, val) { - this.type = type; - this.val = val; -}; - -/** - * Custom inspect. - * - * @return {String} - * @api public - */ - -Token.prototype.inspect = function(){ - var val = ' ' + inspect(this.val); - return '[Token:' + this.lineno + ':' + this.column + ' ' - + '\x1b[32m' + this.type + '\x1b[0m' - + '\x1b[33m' + (this.val ? val : '') + '\x1b[0m' - + ']'; -}; - -/** - * Return type or val. - * - * @return {String} - * @api public - */ - -Token.prototype.toString = function(){ - return (undefined === this.val - ? this.type - : this.val).toString(); -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/units.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/units.js deleted file mode 100644 index 0046fa49..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/units.js +++ /dev/null @@ -1,20 +0,0 @@ - -/*! - * Stylus - units - * Copyright (c) Automattic - * MIT Licensed - */ - -// units found in http://www.w3.org/TR/css3-values - -module.exports = [ - 'em', 'ex', 'ch', 'rem' // relative lengths - , 'vw', 'vh', 'vmin', 'vmax' // relative viewport-percentage lengths - , 'cm', 'mm', 'in', 'pt', 'pc', 'px' // absolute lengths - , 'deg', 'grad', 'rad', 'turn' // angles - , 's', 'ms' // times - , 'Hz', 'kHz' // frequencies - , 'dpi', 'dpcm', 'dppx', 'x' // resolutions - , '%' // percentage type - , 'fr' // grid-layout (http://www.w3.org/TR/css3-grid-layout/) -]; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/utils.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/utils.js deleted file mode 100644 index ab3a8675..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/utils.js +++ /dev/null @@ -1,524 +0,0 @@ - -/*! - * Stylus - utils - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var nodes = require('./nodes') - , basename = require('path').basename - , relative = require('path').relative - , join = require('path').join - , isAbsolute = require('path').isAbsolute - , glob = require('glob') - , fs = require('fs'); - -/** - * Check if `path` looks absolute. - * - * @param {String} path - * @return {Boolean} - * @api private - */ - -exports.absolute = isAbsolute || function(path){ - // On Windows the path could start with a drive letter, i.e. a:\\ or two leading backslashes. - // Also on Windows, the path may have been normalized to forward slashes, so check for this too. - return path.substr(0, 2) == '\\\\' || '/' === path.charAt(0) || /^[a-z]:[\\\/]/i.test(path); -}; - -/** - * Attempt to lookup `path` within `paths` from tail to head. - * Optionally a path to `ignore` may be passed. - * - * @param {String} path - * @param {String} paths - * @param {String} ignore - * @return {String} - * @api private - */ - -exports.lookup = function(path, paths, ignore){ - var lookup - , i = paths.length; - - // Absolute - if (exports.absolute(path)) { - try { - fs.statSync(path); - return path; - } catch (err) { - // Ignore, continue on - // to trying relative lookup. - // Needed for url(/images/foo.png) - // for example - } - } - - // Relative - while (i--) { - try { - lookup = join(paths[i], path); - if (ignore == lookup) continue; - fs.statSync(lookup); - return lookup; - } catch (err) { - // Ignore - } - } -}; - -/** - * Like `utils.lookup` but uses `glob` to find files. - * - * @param {String} path - * @param {String} paths - * @param {String} ignore - * @return {Array} - * @api private - */ -exports.find = function(path, paths, ignore) { - var lookup - , found - , i = paths.length; - - // Absolute - if (exports.absolute(path)) { - if ((found = glob.sync(path)).length) { - return found; - } - } - - // Relative - while (i--) { - lookup = join(paths[i], path); - if (ignore == lookup) continue; - if ((found = glob.sync(lookup)).length) { - return found; - } - } -}; - -/** - * Lookup index file inside dir with given `name`. - * - * @param {String} name - * @return {Array} - * @api private - */ - -exports.lookupIndex = function(name, paths, filename){ - // foo/index.styl - var found = exports.find(join(name, 'index.styl'), paths, filename); - if (!found) { - // foo/foo.styl - found = exports.find(join(name, basename(name).replace(/\.styl/i, '') + '.styl'), paths, filename); - } - if (!found && !~name.indexOf('node_modules')) { - // node_modules/foo/.. or node_modules/foo.styl/.. - found = lookupPackage(join('node_modules', name)); - } - return found; - - function lookupPackage(dir) { - var pkg = exports.lookup(join(dir, 'package.json'), paths, filename); - if (!pkg) { - return /\.styl$/i.test(dir) ? exports.lookupIndex(dir, paths, filename) : lookupPackage(dir + '.styl'); - } - var main = require(relative(__dirname, pkg)).main; - if (main) { - found = exports.find(join(dir, main), paths, filename); - } else { - found = exports.lookupIndex(dir, paths, filename); - } - return found; - } -}; - -/** - * Format the given `err` with the given `options`. - * - * Options: - * - * - `filename` context filename - * - `context` context line count [8] - * - `lineno` context line number - * - `column` context column number - * - `input` input string - * - * @param {Error} err - * @param {Object} options - * @return {Error} - * @api private - */ - -exports.formatException = function(err, options){ - var lineno = options.lineno - , column = options.column - , filename = options.filename - , str = options.input - , context = options.context || 8 - , context = context / 2 - , lines = ('\n' + str).split('\n') - , start = Math.max(lineno - context, 1) - , end = Math.min(lines.length, lineno + context) - , pad = end.toString().length; - - var context = lines.slice(start, end).map(function(line, i){ - var curr = i + start; - return ' ' - + Array(pad - curr.toString().length + 1).join(' ') - + curr - + '| ' - + line - + (curr == lineno - ? '\n' + Array(curr.toString().length + 5 + column).join('-') + '^' - : ''); - }).join('\n'); - - err.message = filename - + ':' + lineno - + ':' + column - + '\n' + context - + '\n\n' + err.message + '\n' - + (err.stylusStack ? err.stylusStack + '\n' : ''); - - // Don't show JS stack trace for Stylus errors - if (err.fromStylus) err.stack = 'Error: ' + err.message; - - return err; -}; - -/** - * Assert that `node` is of the given `type`, or throw. - * - * @param {Node} node - * @param {Function} type - * @param {String} param - * @api public - */ - -exports.assertType = function(node, type, param){ - exports.assertPresent(node, param); - if (node.nodeName == type) return; - var actual = node.nodeName - , msg = 'expected ' - + (param ? '"' + param + '" to be a ' : '') - + type + ', but got ' - + actual + ':' + node; - throw new Error('TypeError: ' + msg); -}; - -/** - * Assert that `node` is a `String` or `Ident`. - * - * @param {Node} node - * @param {String} param - * @api public - */ - -exports.assertString = function(node, param){ - exports.assertPresent(node, param); - switch (node.nodeName) { - case 'string': - case 'ident': - case 'literal': - return; - default: - var actual = node.nodeName - , msg = 'expected string, ident or literal, but got ' + actual + ':' + node; - throw new Error('TypeError: ' + msg); - } -}; - -/** - * Assert that `node` is a `RGBA` or `HSLA`. - * - * @param {Node} node - * @param {String} param - * @api public - */ - -exports.assertColor = function(node, param){ - exports.assertPresent(node, param); - switch (node.nodeName) { - case 'rgba': - case 'hsla': - return; - default: - var actual = node.nodeName - , msg = 'expected rgba or hsla, but got ' + actual + ':' + node; - throw new Error('TypeError: ' + msg); - } -}; - -/** - * Assert that param `name` is given, aka the `node` is passed. - * - * @param {Node} node - * @param {String} name - * @api public - */ - -exports.assertPresent = function(node, name){ - if (node) return; - if (name) throw new Error('"' + name + '" argument required'); - throw new Error('argument missing'); -}; - -/** - * Unwrap `expr`. - * - * Takes an expressions with length of 1 - * such as `((1 2 3))` and unwraps it to `(1 2 3)`. - * - * @param {Expression} expr - * @return {Node} - * @api public - */ - -exports.unwrap = function(expr){ - // explicitly preserve the expression - if (expr.preserve) return expr; - if ('arguments' != expr.nodeName && 'expression' != expr.nodeName) return expr; - if (1 != expr.nodes.length) return expr; - if ('arguments' != expr.nodes[0].nodeName && 'expression' != expr.nodes[0].nodeName) return expr; - return exports.unwrap(expr.nodes[0]); -}; - -/** - * Coerce JavaScript values to their Stylus equivalents. - * - * @param {Mixed} val - * @param {Boolean} [raw] - * @return {Node} - * @api public - */ - -exports.coerce = function(val, raw){ - switch (typeof val) { - case 'function': - return val; - case 'string': - return new nodes.String(val); - case 'boolean': - return new nodes.Boolean(val); - case 'number': - return new nodes.Unit(val); - default: - if (null == val) return nodes.null; - if (Array.isArray(val)) return exports.coerceArray(val, raw); - if (val.nodeName) return val; - return exports.coerceObject(val, raw); - } -}; - -/** - * Coerce a javascript `Array` to a Stylus `Expression`. - * - * @param {Array} val - * @param {Boolean} [raw] - * @return {Expression} - * @api private - */ - -exports.coerceArray = function(val, raw){ - var expr = new nodes.Expression; - val.forEach(function(val){ - expr.push(exports.coerce(val, raw)); - }); - return expr; -}; - -/** - * Coerce a javascript object to a Stylus `Expression` or `Object`. - * - * For example `{ foo: 'bar', bar: 'baz' }` would become - * the expression `(foo 'bar') (bar 'baz')`. If `raw` is true - * given `obj` would become a Stylus hash object. - * - * @param {Object} obj - * @param {Boolean} [raw] - * @return {Expression|Object} - * @api public - */ - -exports.coerceObject = function(obj, raw){ - var node = raw ? new nodes.Object : new nodes.Expression - , val; - - for (var key in obj) { - val = exports.coerce(obj[key], raw); - key = new nodes.Ident(key); - if (raw) { - node.set(key, val); - } else { - node.push(exports.coerceArray([key, val])); - } - } - - return node; -}; - -/** - * Return param names for `fn`. - * - * @param {Function} fn - * @return {Array} - * @api private - */ - -exports.params = function(fn){ - return fn - .toString() - .match(/\(([^)]*)\)/)[1].split(/ *, */); -}; - -/** - * Merge object `b` with `a`. - * - * @param {Object} a - * @param {Object} b - * @param {Boolean} [deep] - * @return {Object} a - * @api private - */ -exports.merge = function(a, b, deep) { - for (var k in b) { - if (deep && a[k]) { - var nodeA = exports.unwrap(a[k]).first - , nodeB = exports.unwrap(b[k]).first; - - if ('object' == nodeA.nodeName && 'object' == nodeB.nodeName) { - a[k].first.vals = exports.merge(nodeA.vals, nodeB.vals, deep); - } else { - a[k] = b[k]; - } - } else { - a[k] = b[k]; - } - } - return a; -}; - -/** - * Returns an array with unique values. - * - * @param {Array} arr - * @return {Array} - * @api private - */ - -exports.uniq = function(arr){ - var obj = {} - , ret = []; - - for (var i = 0, len = arr.length; i < len; ++i) { - if (arr[i] in obj) continue; - - obj[arr[i]] = true; - ret.push(arr[i]); - } - return ret; -}; - -/** - * Compile selector strings in `arr` from the bottom-up - * to produce the selector combinations. For example - * the following Stylus: - * - * ul - * li - * p - * a - * color: red - * - * Would return: - * - * [ 'ul li a', 'ul p a' ] - * - * @param {Array} arr - * @param {Boolean} leaveHidden - * @return {Array} - * @api private - */ - -exports.compileSelectors = function(arr, leaveHidden){ - var selectors = [] - , Parser = require('./selector-parser') - , indent = (this.indent || '') - , buf = []; - - function parse(selector, buf) { - var parts = [selector.val] - , str = new Parser(parts[0], parents, parts).parse().val - , parents = []; - - if (buf.length) { - for (var i = 0, len = buf.length; i < len; ++i) { - parts.push(buf[i]); - parents.push(str); - var child = new Parser(buf[i], parents, parts).parse(); - - if (child.nested) { - str += ' ' + child.val; - } else { - str = child.val; - } - } - } - return str.trim(); - } - - function compile(arr, i) { - if (i) { - arr[i].forEach(function(selector){ - if (!leaveHidden && selector.isPlaceholder) return; - if (selector.inherits) { - buf.unshift(selector.val); - compile(arr, i - 1); - buf.shift(); - } else { - selectors.push(indent + parse(selector, buf)); - } - }); - } else { - arr[0].forEach(function(selector){ - if (!leaveHidden && selector.isPlaceholder) return; - var str = parse(selector, buf); - if (str) selectors.push(indent + str); - }); - } - } - - compile(arr, arr.length - 1); - - // Return the list with unique selectors only - return exports.uniq(selectors); -}; - -/** - * Attempt to parse string. - * - * @param {String} str - * @return {Node} - * @api private - */ - -exports.parseString = function(str){ - var Parser = require('./parser') - , parser - , ret; - - try { - parser = new Parser(str); - ret = parser.list(); - } catch (e) { - ret = new nodes.Literal(str); - } - return ret; -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/visitor/compiler.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/visitor/compiler.js deleted file mode 100644 index 5ec3037b..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/visitor/compiler.js +++ /dev/null @@ -1,588 +0,0 @@ -/*! - * Stylus - Compiler - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Visitor = require('./') - , utils = require('../utils') - , fs = require('fs'); - -/** - * Initialize a new `Compiler` with the given `root` Node - * and the following `options`. - * - * Options: - * - * - `compress` Compress the CSS output (default: false) - * - * @param {Node} root - * @api public - */ - -var Compiler = module.exports = function Compiler(root, options) { - options = options || {}; - this.compress = options.compress; - this.firebug = options.firebug; - this.linenos = options.linenos; - this.spaces = options['indent spaces'] || 2; - this.indents = 1; - Visitor.call(this, root); - this.stack = []; -}; - -/** - * Inherit from `Visitor.prototype`. - */ - -Compiler.prototype.__proto__ = Visitor.prototype; - -/** - * Compile to css, and return a string of CSS. - * - * @return {String} - * @api private - */ - -Compiler.prototype.compile = function(){ - return this.visit(this.root); -}; - -/** - * Output `str` - * - * @param {String} str - * @param {Node} node - * @return {String} - * @api private - */ - -Compiler.prototype.out = function(str, node){ - return str; -}; - -/** - * Return indentation string. - * - * @return {String} - * @api private - */ - -Compiler.prototype.__defineGetter__('indent', function(){ - if (this.compress) return ''; - return new Array(this.indents).join(Array(this.spaces + 1).join(' ')); -}); - -/** - * Check if given `node` needs brackets. - * - * @param {Node} node - * @return {Boolean} - * @api private - */ - -Compiler.prototype.needBrackets = function(node){ - return 1 == this.indents - || 'atrule' != node.nodeName - || node.hasOnlyProperties; -}; - -/** - * Visit Root. - */ - -Compiler.prototype.visitRoot = function(block){ - this.buf = ''; - for (var i = 0, len = block.nodes.length; i < len; ++i) { - var node = block.nodes[i]; - if (this.linenos || this.firebug) this.debugInfo(node); - var ret = this.visit(node); - if (ret) this.buf += this.out(ret + '\n', node); - } - return this.buf; -}; - -/** - * Visit Block. - */ - -Compiler.prototype.visitBlock = function(block){ - var node - , separator = this.compress ? '' : '\n' - , needBrackets - , lastPropertyIndex; - - if (block.hasProperties && !block.lacksRenderedSelectors) { - needBrackets = this.needBrackets(block.node); - - if (this.compress) { - for (var i = block.nodes.length - 1; i >= 0; --i) { - if (block.nodes[i].nodeName === 'property') { - lastPropertyIndex = i; - break; - } - } - } - if (needBrackets) { - this.buf += this.out(this.compress ? '{' : ' {\n'); - ++this.indents; - } - for (var i = 0, len = block.nodes.length; i < len; ++i) { - this.last = lastPropertyIndex === i; - node = block.nodes[i]; - switch (node.nodeName) { - case 'null': - case 'expression': - case 'function': - case 'group': - case 'block': - case 'unit': - case 'media': - case 'keyframes': - case 'atrule': - case 'supports': - continue; - // inline comments - case !this.compress && node.inline && 'comment': - this.buf = this.buf.slice(0, -1); - this.buf += this.out(' ' + this.visit(node) + '\n', node); - break; - case 'property': - var ret = this.visit(node) + separator; - this.buf += this.compress ? ret : this.out(ret, node); - break; - default: - this.buf += this.out(this.visit(node) + separator, node); - } - } - if (needBrackets) { - --this.indents; - this.buf += this.out(this.indent + '}' + separator); - } - } - - // Nesting - for (var i = 0, len = block.nodes.length; i < len; ++i) { - node = block.nodes[i]; - switch (node.nodeName) { - case 'group': - case 'block': - case 'keyframes': - if (this.linenos || this.firebug) this.debugInfo(node); - this.visit(node); - break; - case 'media': - case 'import': - case 'atrule': - case 'supports': - this.visit(node); - break; - case 'comment': - // only show unsuppressed comments - if (!node.suppress) { - this.buf += this.out(this.indent + this.visit(node) + '\n', node); - } - break; - case 'charset': - case 'literal': - case 'namespace': - this.buf += this.out(this.visit(node) + '\n', node); - break; - } - } -}; - -/** - * Visit Keyframes. - */ - -Compiler.prototype.visitKeyframes = function(node){ - if (!node.frames) return; - - var prefix = 'official' == node.prefix - ? '' - : '-' + node.prefix + '-'; - - this.buf += this.out('@' + prefix + 'keyframes ' - + this.visit(node.val) - + (this.compress ? '{' : ' {\n'), node); - - this.keyframe = true; - ++this.indents; - this.visit(node.block); - --this.indents; - this.keyframe = false; - - this.buf += this.out('}' + (this.compress ? '' : '\n')); -}; - -/** - * Visit Media. - */ - -Compiler.prototype.visitMedia = function(media){ - var val = media.val; - if (!media.hasOutput || !val.nodes.length) return; - - this.buf += this.out('@media ', media); - this.visit(val); - this.buf += this.out(this.compress ? '{' : ' {\n'); - ++this.indents; - this.visit(media.block); - --this.indents; - this.buf += this.out('}' + (this.compress ? '' : '\n')); -}; - -/** - * Visit QueryList. - */ - -Compiler.prototype.visitQueryList = function(queries){ - for (var i = 0, len = queries.nodes.length; i < len; ++i) { - this.visit(queries.nodes[i]); - if (len - 1 != i) this.buf += this.out(',' + (this.compress ? '' : ' ')); - } -}; - -/** - * Visit Query. - */ - -Compiler.prototype.visitQuery = function(node){ - var len = node.nodes.length; - if (node.predicate) this.buf += this.out(node.predicate + ' '); - if (node.type) this.buf += this.out(node.type + (len ? ' and ' : '')); - for (var i = 0; i < len; ++i) { - this.buf += this.out(this.visit(node.nodes[i])); - if (len - 1 != i) this.buf += this.out(' and '); - } -}; - -/** - * Visit Feature. - */ - -Compiler.prototype.visitFeature = function(node){ - if (!node.expr) { - return node.name; - } else if (node.expr.isEmpty) { - return '(' + node.name + ')'; - } else { - return '(' + node.name + ':' + (this.compress ? '' : ' ') + this.visit(node.expr) + ')'; - } -}; - -/** - * Visit Import. - */ - -Compiler.prototype.visitImport = function(imported){ - this.buf += this.out('@import ' + this.visit(imported.path) + ';\n', imported); -}; - -/** - * Visit Atrule. - */ - -Compiler.prototype.visitAtrule = function(atrule){ - var newline = this.compress ? '' : '\n'; - - this.buf += this.out(this.indent + '@' + atrule.type, atrule); - - if (atrule.val) this.buf += this.out(' ' + atrule.val.trim()); - - if (atrule.block) { - if (atrule.block.isEmpty) { - this.buf += this.out((this.compress ? '' : ' ') + '{}' + newline); - } else if (atrule.hasOnlyProperties) { - this.visit(atrule.block); - } else { - this.buf += this.out(this.compress ? '{' : ' {\n'); - ++this.indents; - this.visit(atrule.block); - --this.indents; - this.buf += this.out(this.indent + '}' + newline); - } - } else { - this.buf += this.out(';' + newline); - } -}; - -/** - * Visit Supports. - */ - -Compiler.prototype.visitSupports = function(node){ - if (!node.hasOutput) return; - - this.buf += this.out(this.indent + '@supports ', node); - this.isCondition = true; - this.buf += this.out(this.visit(node.condition)); - this.isCondition = false; - this.buf += this.out(this.compress ? '{' : ' {\n'); - ++this.indents; - this.visit(node.block); - --this.indents; - this.buf += this.out(this.indent + '}' + (this.compress ? '' : '\n')); -}, - -/** - * Visit Comment. - */ - -Compiler.prototype.visitComment = function(comment){ - return this.compress - ? comment.suppress - ? '' - : comment.str - : comment.str; -}; - -/** - * Visit Function. - */ - -Compiler.prototype.visitFunction = function(fn){ - return fn.name; -}; - -/** - * Visit Charset. - */ - -Compiler.prototype.visitCharset = function(charset){ - return '@charset ' + this.visit(charset.val) + ';'; -}; - -/** - * Visit Namespace. - */ - -Compiler.prototype.visitNamespace = function(namespace){ - return '@namespace ' - + (namespace.prefix ? this.visit(namespace.prefix) + ' ' : '') - + this.visit(namespace.val) + ';'; -}; - -/** - * Visit Literal. - */ - -Compiler.prototype.visitLiteral = function(lit){ - var val = lit.val; - if (lit.css) val = val.replace(/^ /gm, ''); - return val; -}; - -/** - * Visit Boolean. - */ - -Compiler.prototype.visitBoolean = function(bool){ - return bool.toString(); -}; - -/** - * Visit RGBA. - */ - -Compiler.prototype.visitRGBA = function(rgba){ - return rgba.toString(); -}; - -/** - * Visit HSLA. - */ - -Compiler.prototype.visitHSLA = function(hsla){ - return hsla.rgba.toString(); -}; - -/** - * Visit Unit. - */ - -Compiler.prototype.visitUnit = function(unit){ - var type = unit.type || '' - , n = unit.val - , float = n != (n | 0); - - // Compress - if (this.compress) { - // Always return '0' unless the unit is a percentage, time, degree or fraction - if (!(['%', 's', 'ms', 'deg', 'fr'].includes(type)) && 0 == n) return '0'; - // Omit leading '0' on floats - if (float && n < 1 && n > -1) { - return n.toString().replace('0.', '.') + type; - } - } - - return (float ? parseFloat(n.toFixed(15)) : n).toString() + type; -}; - -/** - * Visit Group. - */ - -Compiler.prototype.visitGroup = function(group){ - var stack = this.keyframe ? [] : this.stack - , comma = this.compress ? ',' : ',\n'; - - stack.push(group.nodes); - - // selectors - if (group.block.hasProperties) { - var selectors = utils.compileSelectors.call(this, stack) - , len = selectors.length; - - if (len) { - if (this.keyframe) comma = this.compress ? ',' : ', '; - - for (var i = 0; i < len; ++i) { - var selector = selectors[i] - , last = (i == len - 1); - - // keyframe blocks (10%, 20% { ... }) - if (this.keyframe) selector = i ? selector.trim() : selector; - - this.buf += this.out(selector + (last ? '' : comma), group.nodes[i]); - } - } else { - group.block.lacksRenderedSelectors = true; - } - } - - // output block - this.visit(group.block); - stack.pop(); -}; - -/** - * Visit Ident. - */ - -Compiler.prototype.visitIdent = function(ident){ - return ident.name; -}; - -/** - * Visit String. - */ - -Compiler.prototype.visitString = function(string){ - return this.isURL - ? string.val - : string.toString(); -}; - -/** - * Visit Null. - */ - -Compiler.prototype.visitNull = function(node){ - return ''; -}; - -/** - * Visit Call. - */ - -Compiler.prototype.visitCall = function(call){ - this.isURL = 'url' == call.name; - var args = call.args.nodes.map(function(arg){ - return this.visit(arg); - }, this).join(this.compress ? ',' : ', '); - if (this.isURL) args = '"' + args + '"'; - this.isURL = false; - return call.name + '(' + args + ')'; -}; - -/** - * Visit Expression. - */ - -Compiler.prototype.visitExpression = function(expr){ - var buf = [] - , self = this - , len = expr.nodes.length - , nodes = expr.nodes.map(function(node){ return self.visit(node); }); - - nodes.forEach(function(node, i){ - var last = i == len - 1; - buf.push(node); - if ('/' == nodes[i + 1] || '/' == node) return; - if (last) return; - - var space = self.isURL || (self.isCondition - && (')' == nodes[i + 1] || '(' == node)) - ? '' : ' '; - - buf.push(expr.isList - ? (self.compress ? ',' : ', ') - : space); - }); - - return buf.join(''); -}; - -/** - * Visit Arguments. - */ - -Compiler.prototype.visitArguments = Compiler.prototype.visitExpression; - -/** - * Visit Property. - */ - -Compiler.prototype.visitProperty = function(prop){ - var val = this.visit(prop.expr).trim() - , name = (prop.name || prop.segments.join('')) - , arr = []; - - if (name === '@apply') { - arr.push( - this.out(this.indent), - this.out(name + ' ', prop), - this.out(val, prop.expr), - this.out(this.compress ? (this.last ? '' : ';') : ';') - ); - return arr.join(''); - } - arr.push( - this.out(this.indent), - this.out(name + (this.compress ? ':' : ': '), prop), - this.out(val, prop.expr), - this.out(this.compress ? (this.last ? '' : ';') : ';') - ); - return arr.join(''); -}; - -/** - * Debug info. - */ - -Compiler.prototype.debugInfo = function(node){ - - var path = node.filename == 'stdin' ? 'stdin' : fs.realpathSync(node.filename) - , line = (node.nodes && node.nodes.length ? node.nodes[0].lineno : node.lineno) || 1; - - if (this.linenos){ - this.buf += '\n/* ' + 'line ' + line + ' : ' + path + ' */\n'; - } - - if (this.firebug){ - // debug info for firebug, the crazy formatting is needed - path = 'file\\\:\\\/\\\/' + path.replace(/([.:/\\])/g, function(m) { - return '\\' + (m === '\\' ? '\/' : m) - }); - line = '\\00003' + line; - this.buf += '\n@media -stylus-debug-info' - + '{filename{font-family:' + path - + '}line{font-family:' + line + '}}\n'; - } -} diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/visitor/deps-resolver.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/visitor/deps-resolver.js deleted file mode 100644 index c87b1460..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/visitor/deps-resolver.js +++ /dev/null @@ -1,172 +0,0 @@ - -/** - * Module dependencies. - */ - -var Visitor = require('./') - , Parser = require('../parser') - , nodes = require('../nodes') - , utils = require('../utils') - , dirname = require('path').dirname - , fs = require('fs'); - -/** - * Initialize a new `DepsResolver` with the given `root` Node - * and the `options`. - * - * @param {Node} root - * @param {Object} options - * @api private - */ - -var DepsResolver = module.exports = function DepsResolver(root, options) { - this.root = root; - this.filename = options.filename; - this.paths = options.paths || []; - this.paths.push(dirname(options.filename || '.')); - this.options = options; - this.functions = {}; - this.deps = []; -}; - -/** - * Inherit from `Visitor.prototype`. - */ - -DepsResolver.prototype.__proto__ = Visitor.prototype; - -var visit = DepsResolver.prototype.visit; - -DepsResolver.prototype.visit = function(node) { - switch (node.nodeName) { - case 'root': - case 'block': - case 'expression': - this.visitRoot(node); - break; - case 'group': - case 'media': - case 'atblock': - case 'atrule': - case 'keyframes': - case 'each': - case 'supports': - this.visit(node.block); - break; - default: - visit.call(this, node); - } -}; - -/** - * Visit Root. - */ - -DepsResolver.prototype.visitRoot = function(block) { - for (var i = 0, len = block.nodes.length; i < len; ++i) { - this.visit(block.nodes[i]); - } -}; - -/** - * Visit Ident. - */ - -DepsResolver.prototype.visitIdent = function(ident) { - this.visit(ident.val); -}; - -/** - * Visit If. - */ - -DepsResolver.prototype.visitIf = function(node) { - this.visit(node.block); - this.visit(node.cond); - for (var i = 0, len = node.elses.length; i < len; ++i) { - this.visit(node.elses[i]); - } -}; - -/** - * Visit Function. - */ - -DepsResolver.prototype.visitFunction = function(fn) { - this.functions[fn.name] = fn.block; -}; - -/** - * Visit Call. - */ - -DepsResolver.prototype.visitCall = function(call) { - if (call.name in this.functions) this.visit(this.functions[call.name]); - if (call.block) this.visit(call.block); -}; - -/** - * Visit Import. - */ - -DepsResolver.prototype.visitImport = function(node) { - // If it's a url() call, skip - if (node.path.first.name === 'url') return; - - var path = !node.path.first.val.isNull && node.path.first.val || node.path.first.name - , literal, found, oldPath; - - if (!path) return; - - literal = /\.css(?:"|$)/.test(path); - - // support optional .styl - if (!literal && !/\.styl$/i.test(path)) { - oldPath = path; - path += '.styl'; - } - - // Lookup - found = utils.find(path, this.paths, this.filename); - - // support optional index - if (!found && oldPath) found = utils.lookupIndex(oldPath, this.paths, this.filename); - - if (!found) return; - - this.deps = this.deps.concat(found); - - if (literal) return; - - // nested imports - for (var i = 0, len = found.length; i < len; ++i) { - var file = found[i] - , dir = dirname(file) - , str = fs.readFileSync(file, 'utf-8') - , block = new nodes.Block - , parser = new Parser(str, utils.merge({ root: block }, this.options)); - - if (!~this.paths.indexOf(dir)) this.paths.push(dir); - - try { - block = parser.parse(); - } catch (err) { - err.filename = file; - err.lineno = parser.lexer.lineno; - err.column = parser.lexer.column; - err.input = str; - throw err; - } - - this.visit(block); - } -}; - -/** - * Get dependencies. - */ - -DepsResolver.prototype.resolve = function() { - this.visit(this.root); - return utils.uniq(this.deps); -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/visitor/evaluator.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/visitor/evaluator.js deleted file mode 100644 index bda0255e..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/visitor/evaluator.js +++ /dev/null @@ -1,1613 +0,0 @@ - -/*! - * Stylus - Evaluator - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Visitor = require('./') - , units = require('../units') - , nodes = require('../nodes') - , Stack = require('../stack') - , Frame = require('../stack/frame') - , utils = require('../utils') - , bifs = require('../functions') - , dirname = require('path').dirname - , colors = require('../colors') - , debug = require('debug')('stylus:evaluator') - , fs = require('fs'); - -/** - * Import `file` and return Block node. - * - * @api private - */ -function importFile(node, file, literal) { - var importStack = this.importStack - , Parser = require('../parser') - , stat; - - // Handling the `require` - if (node.once) { - if (this.requireHistory[file]) return nodes.null; - this.requireHistory[file] = true; - - if (literal && !this.includeCSS) { - return node; - } - } - - // Avoid overflows from importing the same file over again - if (~importStack.indexOf(file)) - throw new Error('import loop has been found'); - - var str = fs.readFileSync(file, 'utf8'); - - // shortcut for empty files - if (!str.trim()) return nodes.null; - - // Expose imports - node.path = file; - node.dirname = dirname(file); - // Store the modified time - stat = fs.statSync(file); - node.mtime = stat.mtime; - this.paths.push(node.dirname); - - if (this.options._imports) this.options._imports.push(node.clone()); - - // Parse the file - importStack.push(file); - nodes.filename = file; - - if (literal) { - literal = new nodes.Literal(str.replace(/\r\n?/g, '\n')); - literal.lineno = literal.column = 1; - if (!this.resolveURL) return literal; - } - - // parse - var block = new nodes.Block - , parser = new Parser(str, utils.merge({ root: block }, this.options)); - - try { - block = parser.parse(); - } catch (err) { - var line = parser.lexer.lineno - , column = parser.lexer.column; - - if (literal && this.includeCSS && this.resolveURL) { - this.warn('ParseError: ' + file + ':' + line + ':' + column + '. This file included as-is'); - return literal; - } else { - err.filename = file; - err.lineno = line; - err.column = column; - err.input = str; - throw err; - } - } - - // Evaluate imported "root" - block = block.clone(this.currentBlock); - block.parent = this.currentBlock; - block.scope = false; - var ret = this.visit(block); - importStack.pop(); - if (!this.resolveURL || this.resolveURL.nocheck) this.paths.pop(); - - return ret; -} - -/** - * Initialize a new `Evaluator` with the given `root` Node - * and the following `options`. - * - * Options: - * - * - `compress` Compress the css output, defaults to false - * - `warn` Warn the user of duplicate function definitions etc - * - * @param {Node} root - * @api private - */ - -var Evaluator = module.exports = function Evaluator(root, options) { - options = options || {}; - Visitor.call(this, root); - var functions = this.functions = options.functions || {}; - this.stack = new Stack; - this.imports = options.imports || []; - this.globals = options.globals || {}; - this.paths = options.paths || []; - this.prefix = options.prefix || ''; - this.filename = options.filename; - this.includeCSS = options['include css']; - this.resolveURL = functions.url - && 'resolver' == functions.url.name - && functions.url.options; - this.paths.push(dirname(options.filename || '.')); - this.stack.push(this.global = new Frame(root)); - this.warnings = options.warn; - this.options = options; - this.calling = []; // TODO: remove, use stack - this.importStack = []; - this.requireHistory = {}; - this.return = 0; -}; - -/** - * Inherit from `Visitor.prototype`. - */ - -Evaluator.prototype.__proto__ = Visitor.prototype; - -/** - * Proxy visit to expose node line numbers. - * - * @param {Node} node - * @return {Node} - * @api private - */ - -var visit = Visitor.prototype.visit; -Evaluator.prototype.visit = function(node){ - try { - return visit.call(this, node); - } catch (err) { - if (err.filename) throw err; - err.lineno = node.lineno; - err.column = node.column; - err.filename = node.filename; - err.stylusStack = this.stack.toString(); - try { - err.input = fs.readFileSync(err.filename, 'utf8'); - } catch (err) { - // ignore - } - throw err; - } -}; - -/** - * Perform evaluation setup: - * - * - populate global scope - * - iterate imports - * - * @api private - */ - -Evaluator.prototype.setup = function(){ - var root = this.root; - var imports = []; - - this.populateGlobalScope(); - this.imports.forEach(function(file){ - var expr = new nodes.Expression; - expr.push(new nodes.String(file)); - imports.push(new nodes.Import(expr)); - }, this); - - root.nodes = imports.concat(root.nodes); -}; - -/** - * Populate the global scope with: - * - * - css colors - * - user-defined globals - * - * @api private - */ - -Evaluator.prototype.populateGlobalScope = function(){ - var scope = this.global.scope; - - // colors - Object.keys(colors).forEach(function(name){ - var color = colors[name] - , rgba = new nodes.RGBA(color[0], color[1], color[2], color[3]) - , node = new nodes.Ident(name, rgba); - rgba.name = name; - scope.add(node); - }); - - // expose url function - scope.add(new nodes.Ident( - 'embedurl', - new nodes.Function('embedurl', require('../functions/url')({ - limit: false - })) - )); - - // user-defined globals - var globals = this.globals; - Object.keys(globals).forEach(function(name){ - var val = globals[name]; - if (!val.nodeName) val = new nodes.Literal(val); - scope.add(new nodes.Ident(name, val)); - }); -}; - -/** - * Evaluate the tree. - * - * @return {Node} - * @api private - */ - -Evaluator.prototype.evaluate = function(){ - debug('eval %s', this.filename); - this.setup(); - return this.visit(this.root); -}; - -/** - * Visit Group. - */ - -Evaluator.prototype.visitGroup = function(group){ - group.nodes = group.nodes.map(function(selector){ - selector.val = this.interpolate(selector); - debug('ruleset %s', selector.val); - return selector; - }, this); - - group.block = this.visit(group.block); - return group; -}; - -/** - * Visit Return. - */ - -Evaluator.prototype.visitReturn = function(ret){ - ret.expr = this.visit(ret.expr); - throw ret; -}; - -/** - * Visit Media. - */ - -Evaluator.prototype.visitMedia = function(media){ - media.block = this.visit(media.block); - media.val = this.visit(media.val); - return media; -}; - -/** - * Visit QueryList. - */ - -Evaluator.prototype.visitQueryList = function(queries){ - var val, query; - queries.nodes.forEach(this.visit, this); - - if (1 == queries.nodes.length) { - query = queries.nodes[0]; - if (val = this.lookup(query.type)) { - val = val.first.string; - if (!val) return queries; - var Parser = require('../parser') - , parser = new Parser(val, this.options); - queries = this.visit(parser.queries()); - } - } - return queries; -}; - -/** - * Visit Query. - */ - -Evaluator.prototype.visitQuery = function(node){ - node.predicate = this.visit(node.predicate); - node.type = this.visit(node.type); - node.nodes.forEach(this.visit, this); - return node; -}; - -/** - * Visit Feature. - */ - -Evaluator.prototype.visitFeature = function(node){ - node.name = this.interpolate(node); - if (node.expr) { - this.return++; - node.expr = this.visit(node.expr); - this.return--; - } - return node; -}; - -/** - * Visit Object. - */ - -Evaluator.prototype.visitObject = function(obj){ - for (var key in obj.vals) { - obj.vals[key] = this.visit(obj.vals[key]); - } - return obj; -}; - -/** - * Visit Member. - */ - -Evaluator.prototype.visitMember = function(node){ - var left = node.left - , right = node.right - , obj = this.visit(left).first; - - if ('object' != obj.nodeName) { - throw new Error(left.toString() + ' has no property .' + right); - } - if (node.val) { - this.return++; - obj.set(right.name, this.visit(node.val)); - this.return--; - } - return obj.get(right.name); -}; - -/** - * Visit Keyframes. - */ - -Evaluator.prototype.visitKeyframes = function(keyframes){ - var val; - if (keyframes.fabricated) return keyframes; - keyframes.val = this.interpolate(keyframes).trim(); - if (val = this.lookup(keyframes.val)) { - keyframes.val = val.first.string || val.first.name; - } - keyframes.block = this.visit(keyframes.block); - - if ('official' != keyframes.prefix) return keyframes; - - this.vendors.forEach(function(prefix){ - // IE never had prefixes for keyframes - if ('ms' == prefix) return; - var node = keyframes.clone(); - node.val = keyframes.val; - node.prefix = prefix; - node.block = keyframes.block; - node.fabricated = true; - this.currentBlock.push(node); - }, this); - - return nodes.null; -}; - -/** - * Visit Function. - */ - -Evaluator.prototype.visitFunction = function(fn){ - // check local - var local = this.stack.currentFrame.scope.lookup(fn.name); - if (local) this.warn('local ' + local.nodeName + ' "' + fn.name + '" previously defined in this scope'); - - // user-defined - var user = this.functions[fn.name]; - if (user) this.warn('user-defined function "' + fn.name + '" is already defined'); - - // BIF - var bif = bifs[fn.name]; - if (bif) this.warn('built-in function "' + fn.name + '" is already defined'); - - return fn; -}; - -/** - * Visit Each. - */ - -Evaluator.prototype.visitEach = function(each){ - this.return++; - var expr = utils.unwrap(this.visit(each.expr)) - , len = expr.nodes.length - , val = new nodes.Ident(each.val) - , key = new nodes.Ident(each.key || '__index__') - , scope = this.currentScope - , block = this.currentBlock - , vals = [] - , self = this - , body - , obj; - this.return--; - - each.block.scope = false; - - function visitBody(key, val) { - scope.add(val); - scope.add(key); - body = self.visit(each.block.clone()); - vals = vals.concat(body.nodes); - } - - // for prop in obj - if (1 == len && 'object' == expr.nodes[0].nodeName) { - obj = expr.nodes[0]; - for (var prop in obj.vals) { - val.val = new nodes.String(prop); - key.val = obj.get(prop); - visitBody(key, val); - } - } else { - for (var i = 0; i < len; ++i) { - val.val = expr.nodes[i]; - key.val = new nodes.Unit(i); - visitBody(key, val); - } - } - - this.mixin(vals, block); - return vals[vals.length - 1] || nodes.null; -}; - -/** - * Visit Call. - */ - -Evaluator.prototype.visitCall = function(call){ - debug('call %s', call); - var fn = this.lookup(call.name) - , literal - , ret; - - // url() - this.ignoreColors = 'url' == call.name; - - // Variable function - if (fn && 'expression' == fn.nodeName) { - fn = fn.nodes[0]; - } - - // Not a function? try user-defined or built-ins - if (fn && 'function' != fn.nodeName) { - fn = this.lookupFunction(call.name); - } - - // Undefined function? render literal CSS - if (!fn || fn.nodeName != 'function') { - debug('%s is undefined', call); - // Special case for `calc` - if ('calc' == this.unvendorize(call.name)) { - literal = call.args.nodes && call.args.nodes[0]; - if (literal) ret = new nodes.Literal(call.name + literal); - } else { - ret = this.literalCall(call); - } - this.ignoreColors = false; - return ret; - } - - this.calling.push(call.name); - - // Massive stack - if (this.calling.length > 200) { - throw new RangeError('Maximum stylus call stack size exceeded'); - } - - // First node in expression - if ('expression' == fn.nodeName) fn = fn.first; - - // Evaluate arguments - this.return++; - var args = this.visit(call.args); - - for (var key in args.map) { - args.map[key] = this.visit(args.map[key].clone()); - } - this.return--; - - // Built-in - if (fn.fn) { - debug('%s is built-in', call); - ret = this.invokeBuiltin(fn.fn, args); - // User-defined - } else if ('function' == fn.nodeName) { - debug('%s is user-defined', call); - // Evaluate mixin block - if (call.block) call.block = this.visit(call.block); - ret = this.invokeFunction(fn, args, call.block); - } - - this.calling.pop(); - this.ignoreColors = false; - return ret; -}; - -/** - * Visit Ident. - */ - -Evaluator.prototype.visitIdent = function(ident){ - var prop; - // Property lookup - if (ident.property) { - if (prop = this.lookupProperty(ident.name)) { - return this.visit(prop.expr.clone()); - } - return nodes.null; - // Lookup - } else if (ident.val.isNull) { - var val = this.lookup(ident.name); - // Object or Block mixin - if (val && ident.mixin) this.mixinNode(val); - return val ? this.visit(val) : ident; - // Assign - } else { - this.return++; - ident.val = this.visit(ident.val); - this.return--; - this.currentScope.add(ident); - return ident.val; - } -}; - -/** - * Visit BinOp. - */ - -Evaluator.prototype.visitBinOp = function(binop){ - // Special-case "is defined" pseudo binop - if ('is defined' == binop.op) return this.isDefined(binop.left); - - this.return++; - // Visit operands - var op = binop.op - , left = this.visit(binop.left) - , right = ('||' == op || '&&' == op) - ? binop.right : this.visit(binop.right); - - // HACK: ternary - var val = binop.val - ? this.visit(binop.val) - : null; - this.return--; - - // Operate - try { - return this.visit(left.operate(op, right, val)); - } catch (err) { - // disregard coercion issues in equality - // checks, and simply return false - if ('CoercionError' == err.name) { - switch (op) { - case '==': - return nodes.false; - case '!=': - return nodes.true; - } - } - throw err; - } -}; - -/** - * Visit UnaryOp. - */ - -Evaluator.prototype.visitUnaryOp = function(unary){ - var op = unary.op - , node = this.visit(unary.expr); - - if ('!' != op) { - node = node.first.clone(); - utils.assertType(node, 'unit'); - } - - switch (op) { - case '-': - node.val = -node.val; - break; - case '+': - node.val = +node.val; - break; - case '~': - node.val = ~node.val; - break; - case '!': - return node.toBoolean().negate(); - } - - return node; -}; - -/** - * Visit TernaryOp. - */ - -Evaluator.prototype.visitTernary = function(ternary){ - var ok = this.visit(ternary.cond).toBoolean(); - return ok.isTrue - ? this.visit(ternary.trueExpr) - : this.visit(ternary.falseExpr); -}; - -/** - * Visit Expression. - */ - -Evaluator.prototype.visitExpression = function(expr){ - for (var i = 0, len = expr.nodes.length; i < len; ++i) { - expr.nodes[i] = this.visit(expr.nodes[i]); - } - - // support (n * 5)px etc - if (this.castable(expr)) expr = this.cast(expr); - - return expr; -}; - -/** - * Visit Arguments. - */ - -Evaluator.prototype.visitArguments = Evaluator.prototype.visitExpression; - -/** - * Visit Property. - */ - -Evaluator.prototype.visitProperty = function(prop){ - var name = this.interpolate(prop) - , fn = this.lookup(name) - , call = fn && 'function' == fn.first.nodeName - , literal = ~this.calling.indexOf(name) - , _prop = this.property; - - // Function of the same name - if (call && !literal && !prop.literal) { - var args = nodes.Arguments.fromExpression(utils.unwrap(prop.expr.clone())); - prop.name = name; - this.property = prop; - this.return++; - this.property.expr = this.visit(prop.expr); - this.return--; - var ret = this.visit(new nodes.Call(name, args)); - this.property = _prop; - return ret; - // Regular property - } else { - this.return++; - prop.name = name; - prop.literal = true; - this.property = prop; - prop.expr = this.visit(prop.expr); - this.property = _prop; - this.return--; - return prop; - } -}; - -/** - * Visit Root. - */ - -Evaluator.prototype.visitRoot = function(block){ - // normalize cached imports - if (block != this.root) { - block.constructor = nodes.Block; - return this.visit(block); - } - - for (var i = 0; i < block.nodes.length; ++i) { - block.index = i; - block.nodes[i] = this.visit(block.nodes[i]); - } - return block; -}; - -/** - * Visit Block. - */ - -Evaluator.prototype.visitBlock = function(block){ - this.stack.push(new Frame(block)); - for (block.index = 0; block.index < block.nodes.length; ++block.index) { - try { - block.nodes[block.index] = this.visit(block.nodes[block.index]); - } catch (err) { - if ('return' == err.nodeName) { - if (this.return) { - this.stack.pop(); - throw err; - } else { - block.nodes[block.index] = err; - break; - } - } else { - throw err; - } - } - } - this.stack.pop(); - return block; -}; - -/** - * Visit Atblock. - */ - -Evaluator.prototype.visitAtblock = function(atblock){ - atblock.block = this.visit(atblock.block); - return atblock; -}; - -/** - * Visit Atrule. - */ - -Evaluator.prototype.visitAtrule = function(atrule){ - atrule.val = this.interpolate(atrule); - if (atrule.block) atrule.block = this.visit(atrule.block); - return atrule; -}; - -/** - * Visit Supports. - */ - -Evaluator.prototype.visitSupports = function(node){ - var condition = node.condition - , val; - - this.return++; - node.condition = this.visit(condition); - this.return--; - - val = condition.first; - if (1 == condition.nodes.length - && 'string' == val.nodeName) { - node.condition = val.string; - } - node.block = this.visit(node.block); - return node; -}; - -/** - * Visit If. - */ - -Evaluator.prototype.visitIf = function(node){ - var ret - , block = this.currentBlock - , negate = node.negate; - - this.return++; - var ok = this.visit(node.cond).first.toBoolean(); - this.return--; - - node.block.scope = node.block.hasMedia; - - // Evaluate body - if (negate) { - // unless - if (ok.isFalse) { - ret = this.visit(node.block); - } - } else { - // if - if (ok.isTrue) { - ret = this.visit(node.block); - // else - } else if (node.elses.length) { - var elses = node.elses - , len = elses.length - , cond; - for (var i = 0; i < len; ++i) { - // else if - if (elses[i].cond) { - elses[i].block.scope = elses[i].block.hasMedia; - this.return++; - cond = this.visit(elses[i].cond).first.toBoolean(); - this.return--; - if (cond.isTrue) { - ret = this.visit(elses[i].block); - break; - } - // else - } else { - elses[i].scope = elses[i].hasMedia; - ret = this.visit(elses[i]); - } - } - } - } - - // mixin conditional statements within - // a selector group or at-rule - if (ret && !node.postfix && block.node - && ~['group' - , 'atrule' - , 'media' - , 'supports' - , 'keyframes'].indexOf(block.node.nodeName)) { - this.mixin(ret.nodes, block); - return nodes.null; - } - - return ret || nodes.null; -}; - -/** - * Visit Extend. - */ - -Evaluator.prototype.visitExtend = function(extend){ - var block = this.currentBlock; - if ('group' != block.node.nodeName) block = this.closestGroup; - extend.selectors.forEach(function(selector){ - block.node.extends.push({ - // Cloning the selector for when we are in a loop and don't want it to affect - // the selector nodes and cause the values to be different to expected - selector: this.interpolate(selector.clone()).trim(), - optional: selector.optional, - lineno: selector.lineno, - column: selector.column - }); - }, this); - return nodes.null; -}; - -/** - * Visit Import. - */ - -Evaluator.prototype.visitImport = function(imported){ - this.return++; - - var path = this.visit(imported.path).first - , nodeName = imported.once ? 'require' : 'import' - , found - , literal; - - this.return--; - debug('import %s', path); - - // url() passed - if ('url' == path.name) { - if (imported.once) throw new Error('You cannot @require a url'); - - return imported; - } - - // Ensure string - if (!path.string) throw new Error('@' + nodeName + ' string expected'); - - var name = path = path.string; - - // Absolute URL or hash - if (/(?:url\s*\(\s*)?['"]?(?:#|(?:https?:)?\/\/)/i.test(path)) { - if (imported.once) throw new Error('You cannot @require a url'); - return imported; - } - - // Literal - if (/\.css(?:"|$)/.test(path)) { - literal = true; - if (!imported.once && !this.includeCSS) { - return imported; - } - } - - // support optional .styl - if (!literal && !/\.styl$/i.test(path)) path += '.styl'; - - // Lookup - found = utils.find(path, this.paths, this.filename); - if (!found) { - found = utils.lookupIndex(name, this.paths, this.filename); - } - - // Throw if import failed - if (!found) throw new Error('failed to locate @' + nodeName + ' file ' + path); - - var block = new nodes.Block; - - for (var i = 0, len = found.length; i < len; ++i) { - block.push(importFile.call(this, imported, found[i], literal)); - } - - return block; -}; - -/** - * Invoke `fn` with `args`. - * - * @param {Function} fn - * @param {Array} args - * @return {Node} - * @api private - */ - -Evaluator.prototype.invokeFunction = function(fn, args, content){ - var block = new nodes.Block(fn.block.parent); - - // Clone the function body - // to prevent mutation of subsequent calls - var body = fn.block.clone(block); - - // mixin block - var mixinBlock = this.stack.currentFrame.block; - - // new block scope - this.stack.push(new Frame(block)); - var scope = this.currentScope; - - // normalize arguments - if ('arguments' != args.nodeName) { - var expr = new nodes.Expression; - expr.push(args); - args = nodes.Arguments.fromExpression(expr); - } - - // arguments local - scope.add(new nodes.Ident('arguments', args)); - - // mixin scope introspection - scope.add(new nodes.Ident('mixin', this.return - ? nodes.false - : new nodes.String(mixinBlock.nodeName))); - - // current property - if (this.property) { - var prop = this.propertyExpression(this.property, fn.name); - scope.add(new nodes.Ident('current-property', prop)); - } else { - scope.add(new nodes.Ident('current-property', nodes.null)); - } - - // current call stack - var expr = new nodes.Expression; - for (var i = this.calling.length - 1; i-- ; ) { - expr.push(new nodes.Literal(this.calling[i])); - }; - scope.add(new nodes.Ident('called-from', expr)); - - // inject arguments as locals - var i = 0 - , len = args.nodes.length; - fn.params.nodes.forEach(function(node){ - // rest param support - if (node.rest) { - node.val = new nodes.Expression; - for (; i < len; ++i) node.val.push(args.nodes[i]); - node.val.preserve = true; - node.val.isList = args.isList; - // argument default support - } else { - var arg = args.map[node.name] || args.nodes[i++]; - node = node.clone(); - if (arg) { - arg.isEmpty ? args.nodes[i - 1] = this.visit(node) : node.val = arg; - } else { - args.push(node.val); - } - - // required argument not satisfied - if (node.val.isNull) { - throw new Error('argument "' + node + '" required for ' + fn); - } - } - - scope.add(node); - }, this); - - // mixin block - if (content) scope.add(new nodes.Ident('block', content, true)); - - // invoke - return this.invoke(body, true, fn.filename); -}; - -/** - * Invoke built-in `fn` with `args`. - * - * @param {Function} fn - * @param {Array} args - * @return {Node} - * @api private - */ - -Evaluator.prototype.invokeBuiltin = function(fn, args){ - // Map arguments to first node - // providing a nicer js api for - // BIFs. Functions may specify that - // they wish to accept full expressions - // via .raw - if (fn.raw) { - args = args.nodes; - } else { - if (!fn.params) { - fn.params = utils.params(fn); - } - args = fn.params.reduce(function(ret, param){ - var arg = args.map[param] || args.nodes.shift() - if (arg) { - arg = utils.unwrap(arg); - var len = arg.nodes.length; - if (len > 1) { - for (var i = 0; i < len; ++i) { - ret.push(utils.unwrap(arg.nodes[i].first)); - } - } else { - ret.push(arg.first); - } - } - return ret; - }, []); - } - - // Invoke the BIF - var body = utils.coerce(fn.apply(this, args)); - - // Always wrapping allows js functions - // to return several values with a single - // Expression node - var expr = new nodes.Expression; - expr.push(body); - body = expr; - - // Invoke - return this.invoke(body); -}; - -/** - * Invoke the given function `body`. - * - * @param {Block} body - * @return {Node} - * @api private - */ - -Evaluator.prototype.invoke = function(body, stack, filename){ - var self = this - , ret; - - if (filename) this.paths.push(dirname(filename)); - - // Return - if (this.return) { - ret = this.eval(body.nodes); - if (stack) this.stack.pop(); - // Mixin - } else { - body = this.visit(body); - if (stack) this.stack.pop(); - this.mixin(body.nodes, this.currentBlock); - ret = nodes.null; - } - - if (filename) this.paths.pop(); - - return ret; -}; - -/** - * Mixin the given `nodes` to the given `block`. - * - * @param {Array} nodes - * @param {Block} block - * @api private - */ - -Evaluator.prototype.mixin = function(nodes, block){ - if (!nodes.length) return; - var len = block.nodes.length - , head = block.nodes.slice(0, block.index) - , tail = block.nodes.slice(block.index + 1, len); - this._mixin(nodes, head, block); - block.index = 0; - block.nodes = head.concat(tail); -}; - -/** - * Mixin the given `items` to the `dest` array. - * - * @param {Array} items - * @param {Array} dest - * @param {Block} block - * @api private - */ - -Evaluator.prototype._mixin = function(items, dest, block){ - var node - , len = items.length; - for (var i = 0; i < len; ++i) { - switch ((node = items[i]).nodeName) { - case 'return': - return; - case 'block': - this._mixin(node.nodes, dest, block); - break; - case 'media': - // fix link to the parent block - var parentNode = node.block.parent.node; - if (parentNode && 'call' != parentNode.nodeName) { - node.block.parent = block; - } - case 'property': - var val = node.expr; - // prevent `block` mixin recursion - if (node.literal && 'block' == val.first.name) { - val = utils.unwrap(val); - val.nodes[0] = new nodes.Literal('block'); - } - default: - dest.push(node); - } - } -}; - -/** - * Mixin the given `node` to the current block. - * - * @param {Node} node - * @api private - */ - -Evaluator.prototype.mixinNode = function(node){ - node = this.visit(node.first); - switch (node.nodeName) { - case 'object': - this.mixinObject(node); - return nodes.null; - case 'block': - case 'atblock': - this.mixin(node.nodes, this.currentBlock); - return nodes.null; - } -}; - -/** - * Mixin the given `object` to the current block. - * - * @param {Object} object - * @api private - */ - -Evaluator.prototype.mixinObject = function(object){ - var Parser = require('../parser') - , root = this.root - , str = '$block ' + object.toBlock() - , parser = new Parser(str, utils.merge({ root: block }, this.options)) - , block; - - try { - block = parser.parse(); - } catch (err) { - err.filename = this.filename; - err.lineno = parser.lexer.lineno; - err.column = parser.lexer.column; - err.input = str; - throw err; - } - - block.parent = root; - block.scope = false; - var ret = this.visit(block) - , vals = ret.first.nodes; - for (var i = 0, len = vals.length; i < len; ++i) { - if (vals[i].block) { - this.mixin(vals[i].block.nodes, this.currentBlock); - break; - } - } -}; - -/** - * Evaluate the given `vals`. - * - * @param {Array} vals - * @return {Node} - * @api private - */ - -Evaluator.prototype.eval = function(vals){ - if (!vals) return nodes.null; - var len = vals.length - , node = nodes.null; - - try { - for (var i = 0; i < len; ++i) { - node = vals[i]; - switch (node.nodeName) { - case 'if': - if ('block' != node.block.nodeName) { - node = this.visit(node); - break; - } - case 'each': - case 'block': - node = this.visit(node); - if (node.nodes) node = this.eval(node.nodes); - break; - default: - node = this.visit(node); - } - } - } catch (err) { - if ('return' == err.nodeName) { - return err.expr; - } else { - throw err; - } - } - - return node; -}; - -/** - * Literal function `call`. - * - * @param {Call} call - * @return {call} - * @api private - */ - -Evaluator.prototype.literalCall = function(call){ - call.args = this.visit(call.args); - return call; -}; - -/** - * Lookup property `name`. - * - * @param {String} name - * @return {Property} - * @api private - */ - -Evaluator.prototype.lookupProperty = function(name){ - var i = this.stack.length - , index = this.currentBlock.index - , top = i - , nodes - , block - , len - , other; - - while (i--) { - block = this.stack[i].block; - if (!block.node) continue; - switch (block.node.nodeName) { - case 'group': - case 'function': - case 'if': - case 'each': - case 'atrule': - case 'media': - case 'atblock': - case 'call': - nodes = block.nodes; - // scan siblings from the property index up - if (i + 1 == top) { - while (index--) { - // ignore current property - if (this.property == nodes[index]) continue; - other = this.interpolate(nodes[index]); - if (name == other) return nodes[index].clone(); - } - // sequential lookup for non-siblings (for now) - } else { - len = nodes.length; - while (len--) { - if ('property' != nodes[len].nodeName - || this.property == nodes[len]) continue; - other = this.interpolate(nodes[len]); - if (name == other) return nodes[len].clone(); - } - } - break; - } - } - - return nodes.null; -}; - -/** - * Return the closest mixin-able `Block`. - * - * @return {Block} - * @api private - */ - -Evaluator.prototype.__defineGetter__('closestBlock', function(){ - var i = this.stack.length - , block; - while (i--) { - block = this.stack[i].block; - if (block.node) { - switch (block.node.nodeName) { - case 'group': - case 'keyframes': - case 'atrule': - case 'atblock': - case 'media': - case 'call': - return block; - } - } - } -}); - -/** - * Return the closest group block. - * - * @return {Block} - * @api private - */ - -Evaluator.prototype.__defineGetter__('closestGroup', function(){ - var i = this.stack.length - , block; - while (i--) { - block = this.stack[i].block; - if (block.node && 'group' == block.node.nodeName) { - return block; - } - } -}); - -/** - * Return the current selectors stack. - * - * @return {Array} - * @api private - */ - -Evaluator.prototype.__defineGetter__('selectorStack', function(){ - var block - , stack = []; - for (var i = 0, len = this.stack.length; i < len; ++i) { - block = this.stack[i].block; - if (block.node && 'group' == block.node.nodeName) { - block.node.nodes.forEach(function(selector) { - if (!selector.val) selector.val = this.interpolate(selector); - }, this); - stack.push(block.node.nodes); - } - } - return stack; -}); - -/** - * Lookup `name`, with support for JavaScript - * functions, and BIFs. - * - * @param {String} name - * @return {Node} - * @api private - */ - -Evaluator.prototype.lookup = function(name){ - var val; - if (this.ignoreColors && name in colors) return; - if (val = this.stack.lookup(name)) { - return utils.unwrap(val); - } else { - return this.lookupFunction(name); - } -}; - -/** - * Map segments in `node` returning a string. - * - * @param {Node} node - * @return {String} - * @api private - */ - -Evaluator.prototype.interpolate = function(node){ - var self = this - , isSelector = ('selector' == node.nodeName); - function toString(node) { - switch (node.nodeName) { - case 'function': - case 'ident': - return node.name; - case 'literal': - case 'string': - if (self.prefix && !node.prefixed && !node.val.nodeName) { - node.val = node.val.replace(/\.(?=[\w-])|^\.$/g, '.' + self.prefix); - node.prefixed = true; - } - return node.val; - case 'unit': - // Interpolation inside keyframes - return '%' == node.type ? node.val + '%' : node.val; - case 'member': - return toString(self.visit(node)); - case 'expression': - // Prevent cyclic `selector()` calls. - if (self.calling && ~self.calling.indexOf('selector') && self._selector) return self._selector; - self.return++; - var ret = toString(self.visit(node).first); - self.return--; - if (isSelector) self._selector = ret; - return ret; - } - } - - if (node.segments) { - return node.segments.map(toString).join(''); - } else { - return toString(node); - } -}; - -/** - * Lookup JavaScript user-defined or built-in function. - * - * @param {String} name - * @return {Function} - * @api private - */ - -Evaluator.prototype.lookupFunction = function(name){ - var fn = this.functions[name] || bifs[name]; - if (fn) return new nodes.Function(name, fn); -}; - -/** - * Check if the given `node` is an ident, and if it is defined. - * - * @param {Node} node - * @return {Boolean} - * @api private - */ - -Evaluator.prototype.isDefined = function(node){ - if ('ident' == node.nodeName) { - return nodes.Boolean(this.lookup(node.name)); - } else { - throw new Error('invalid "is defined" check on non-variable ' + node); - } -}; - -/** - * Return `Expression` based on the given `prop`, - * replacing cyclic calls to the given function `name` - * with "__CALL__". - * - * @param {Property} prop - * @param {String} name - * @return {Expression} - * @api private - */ - -Evaluator.prototype.propertyExpression = function(prop, name){ - var expr = new nodes.Expression - , val = prop.expr.clone(); - - // name - expr.push(new nodes.String(prop.name)); - - // replace cyclic call with __CALL__ - function replace(node) { - if ('call' == node.nodeName && name == node.name) { - return new nodes.Literal('__CALL__'); - } - - if (node.nodes) node.nodes = node.nodes.map(replace); - return node; - } - - replace(val); - expr.push(val); - return expr; -}; - -/** - * Cast `expr` to the trailing ident. - * - * @param {Expression} expr - * @return {Unit} - * @api private - */ - -Evaluator.prototype.cast = function(expr){ - return new nodes.Unit(expr.first.val, expr.nodes[1].name); -}; - -/** - * Check if `expr` is castable. - * - * @param {Expression} expr - * @return {Boolean} - * @api private - */ - -Evaluator.prototype.castable = function(expr){ - return 2 == expr.nodes.length - && 'unit' == expr.first.nodeName - && ~units.indexOf(expr.nodes[1].name); -}; - -/** - * Warn with the given `msg`. - * - * @param {String} msg - * @api private - */ - -Evaluator.prototype.warn = function(msg){ - if (!this.warnings) return; - console.warn('\u001b[33mWarning:\u001b[0m ' + msg); -}; - -/** - * Return the current `Block`. - * - * @return {Block} - * @api private - */ - -Evaluator.prototype.__defineGetter__('currentBlock', function(){ - return this.stack.currentFrame.block; -}); - -/** - * Return an array of vendor names. - * - * @return {Array} - * @api private - */ - -Evaluator.prototype.__defineGetter__('vendors', function(){ - return this.lookup('vendors').nodes.map(function(node){ - return node.string; - }); -}); - -/** - * Return the property name without vendor prefix. - * - * @param {String} prop - * @return {String} - * @api public - */ - -Evaluator.prototype.unvendorize = function(prop){ - for (var i = 0, len = this.vendors.length; i < len; i++) { - if ('official' != this.vendors[i]) { - var vendor = '-' + this.vendors[i] + '-'; - if (~prop.indexOf(vendor)) return prop.replace(vendor, ''); - } - } - return prop; -}; - -/** - * Return the current frame `Scope`. - * - * @return {Scope} - * @api private - */ - -Evaluator.prototype.__defineGetter__('currentScope', function(){ - return this.stack.currentFrame.scope; -}); - -/** - * Return the current `Frame`. - * - * @return {Frame} - * @api private - */ - -Evaluator.prototype.__defineGetter__('currentFrame', function(){ - return this.stack.currentFrame; -}); diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/visitor/index.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/visitor/index.js deleted file mode 100644 index eecc7cdb..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/visitor/index.js +++ /dev/null @@ -1,31 +0,0 @@ - -/*! - * Stylus - Visitor - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Initialize a new `Visitor` with the given `root` Node. - * - * @param {Node} root - * @api private - */ - -var Visitor = module.exports = function Visitor(root) { - this.root = root; -}; - -/** - * Visit the given `node`. - * - * @param {Node|Array} node - * @api public - */ - -Visitor.prototype.visit = function(node, fn){ - var method = 'visit' + node.constructor.name; - if (this[method]) return this[method](node); - return node; -}; - diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/visitor/normalizer.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/visitor/normalizer.js deleted file mode 100644 index ec92e3c1..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/visitor/normalizer.js +++ /dev/null @@ -1,443 +0,0 @@ - -/*! - * Stylus - Normalizer - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Visitor = require('./') - , nodes = require('../nodes') - , utils = require('../utils'); - -/** - * Initialize a new `Normalizer` with the given `root` Node. - * - * This visitor implements the first stage of the duel-stage - * compiler, tasked with stripping the "garbage" from - * the evaluated nodes, ditching null rules, resolving - * ruleset selectors etc. This step performs the logic - * necessary to facilitate the "@extend" functionality, - * as these must be resolved _before_ buffering output. - * - * @param {Node} root - * @api public - */ - -var Normalizer = module.exports = function Normalizer(root, options) { - options = options || {}; - Visitor.call(this, root); - this.hoist = options['hoist atrules']; - this.stack = []; - this.map = {}; - this.imports = []; -}; - -/** - * Inherit from `Visitor.prototype`. - */ - -Normalizer.prototype.__proto__ = Visitor.prototype; - -/** - * Normalize the node tree. - * - * @return {Node} - * @api private - */ - -Normalizer.prototype.normalize = function(){ - var ret = this.visit(this.root); - - if (this.hoist) { - // hoist @import - if (this.imports.length) ret.nodes = this.imports.concat(ret.nodes); - - // hoist @charset - if (this.charset) ret.nodes = [this.charset].concat(ret.nodes); - } - - return ret; -}; - -/** - * Bubble up the given `node`. - * - * @param {Node} node - * @api private - */ - -Normalizer.prototype.bubble = function(node){ - var props = [] - , other = [] - , self = this; - - function filterProps(block) { - block.nodes.forEach(function(node) { - node = self.visit(node); - - switch (node.nodeName) { - case 'property': - props.push(node); - break; - case 'block': - filterProps(node); - break; - default: - other.push(node); - } - }); - } - - filterProps(node.block); - - if (props.length) { - var selector = new nodes.Selector([new nodes.Literal('&')]); - selector.lineno = node.lineno; - selector.column = node.column; - selector.filename = node.filename; - selector.val = '&'; - - var group = new nodes.Group; - group.lineno = node.lineno; - group.column = node.column; - group.filename = node.filename; - - var block = new nodes.Block(node.block, group); - block.lineno = node.lineno; - block.column = node.column; - block.filename = node.filename; - - props.forEach(function(prop){ - block.push(prop); - }); - - group.push(selector); - group.block = block; - - node.block.nodes = []; - node.block.push(group); - other.forEach(function(n){ - node.block.push(n); - }); - - var group = this.closestGroup(node.block); - if (group) node.group = group.clone(); - - node.bubbled = true; - } -}; - -/** - * Return group closest to the given `block`. - * - * @param {Block} block - * @return {Group} - * @api private - */ - -Normalizer.prototype.closestGroup = function(block){ - var parent = block.parent - , node; - while (parent && (node = parent.node)) { - if ('group' == node.nodeName) return node; - parent = node.block && node.block.parent; - } -}; - -/** - * Visit Root. - */ - -Normalizer.prototype.visitRoot = function(block){ - var ret = new nodes.Root - , node; - - for (var i = 0; i < block.nodes.length; ++i) { - node = block.nodes[i]; - switch (node.nodeName) { - case 'null': - case 'expression': - case 'function': - case 'unit': - case 'atblock': - continue; - default: - this.rootIndex = i; - ret.push(this.visit(node)); - } - } - - return ret; -}; - -/** - * Visit Property. - */ - -Normalizer.prototype.visitProperty = function(prop){ - this.visit(prop.expr); - return prop; -}; - -/** - * Visit Expression. - */ - -Normalizer.prototype.visitExpression = function(expr){ - expr.nodes = expr.nodes.map(function(node){ - // returns `block` literal if mixin's block - // is used as part of a property value - if ('block' == node.nodeName) { - var literal = new nodes.Literal('block'); - literal.lineno = expr.lineno; - literal.column = expr.column; - return literal; - } - return node; - }); - return expr; -}; - -/** - * Visit Block. - */ - -Normalizer.prototype.visitBlock = function(block){ - var node; - - if (block.hasProperties) { - for (var i = 0, len = block.nodes.length; i < len; ++i) { - node = block.nodes[i]; - switch (node.nodeName) { - case 'null': - case 'expression': - case 'function': - case 'group': - case 'unit': - case 'atblock': - continue; - default: - block.nodes[i] = this.visit(node); - } - } - } - - // nesting - for (var i = 0, len = block.nodes.length; i < len; ++i) { - node = block.nodes[i]; - block.nodes[i] = this.visit(node); - } - - return block; -}; - -/** - * Visit Group. - */ - -Normalizer.prototype.visitGroup = function(group){ - var stack = this.stack - , map = this.map - , parts; - - // normalize interpolated selectors with comma - group.nodes.forEach(function(selector, i){ - if (!~selector.val.indexOf(',')) return; - if (~selector.val.indexOf('\\,')) { - selector.val = selector.val.replace(/\\,/g, ','); - return; - } - parts = selector.val.split(','); - var root = '/' == selector.val.charAt(0) - , part, s; - for (var k = 0, len = parts.length; k < len; ++k){ - part = parts[k].trim(); - if (root && k > 0 && !~part.indexOf('&')) { - part = '/' + part; - } - s = new nodes.Selector([new nodes.Literal(part)]); - s.val = part; - s.block = group.block; - group.nodes[i++] = s; - } - }); - stack.push(group.nodes); - - var selectors = utils.compileSelectors(stack, true); - - // map for extension lookup - selectors.forEach(function(selector){ - map[selector] = map[selector] || []; - map[selector].push(group); - }); - - // extensions - this.extend(group, selectors); - - stack.pop(); - return group; -}; - -/** - * Visit Function. - */ - -Normalizer.prototype.visitFunction = function(){ - return nodes.null; -}; - -/** - * Visit Media. - */ - -Normalizer.prototype.visitMedia = function(media){ - var medias = [] - , group = this.closestGroup(media.block) - , parent; - - function mergeQueries(block) { - block.nodes.forEach(function(node, i){ - switch (node.nodeName) { - case 'media': - node.val = media.val.merge(node.val); - medias.push(node); - block.nodes[i] = nodes.null; - break; - case 'block': - mergeQueries(node); - break; - default: - if (node.block && node.block.nodes) - mergeQueries(node.block); - } - }); - } - - mergeQueries(media.block); - this.bubble(media); - - if (medias.length) { - medias.forEach(function(node){ - if (group) { - group.block.push(node); - } else { - this.root.nodes.splice(++this.rootIndex, 0, node); - } - node = this.visit(node); - parent = node.block.parent; - if (node.bubbled && (!group || 'group' == parent.node.nodeName)) { - node.group.block = node.block.nodes[0].block; - node.block.nodes[0] = node.group; - } - }, this); - } - return media; -}; - -/** - * Visit Supports. - */ - -Normalizer.prototype.visitSupports = function(node){ - this.bubble(node); - return node; -}; - -/** - * Visit Atrule. - */ - -Normalizer.prototype.visitAtrule = function(node){ - if (node.block) node.block = this.visit(node.block); - return node; -}; - -/** - * Visit Keyframes. - */ - -Normalizer.prototype.visitKeyframes = function(node){ - var frames = node.block.nodes.filter(function(frame){ - return frame.block && frame.block.hasProperties; - }); - node.frames = frames.length; - return node; -}; - -/** - * Visit Import. - */ - -Normalizer.prototype.visitImport = function(node){ - this.imports.push(node); - return this.hoist ? nodes.null : node; -}; - -/** - * Visit Charset. - */ - -Normalizer.prototype.visitCharset = function(node){ - this.charset = node; - return this.hoist ? nodes.null : node; -}; - -/** - * Apply `group` extensions. - * - * @param {Group} group - * @param {Array} selectors - * @api private - */ - -Normalizer.prototype.extend = function(group, selectors){ - var map = this.map - , self = this - , parent = this.closestGroup(group.block); - - group.extends.forEach(function(extend){ - var groups = map[extend.selector]; - if (!groups) { - if (extend.optional) return; - groups = self._checkForPrefixedGroups(extend.selector); - if(!groups) { - var err = new Error('Failed to @extend "' + extend.selector + '"'); - err.lineno = extend.lineno; - err.column = extend.column; - throw err; - } - } - selectors.forEach(function(selector){ - var node = new nodes.Selector; - node.val = selector; - node.inherits = false; - groups.forEach(function(group){ - // prevent recursive extend - if (!parent || (parent != group)) self.extend(group, selectors); - group.push(node); - }); - }); - }); - - group.block = this.visit(group.block); -}; - -Normalizer.prototype._checkForPrefixedGroups = function (selector) { - var prefix = []; - var map = this.map; - var result = null; - for (var i = 0; i < this.stack.length; i++) { - var stackElementArray=this.stack[i]; - var stackElement = stackElementArray[0]; - prefix.push(stackElement.val); - var fullSelector = prefix.join(" ") + " " + selector; - result = map[fullSelector]; - if (result) - break; - } - return result; -}; \ No newline at end of file diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/visitor/sourcemapper.js b/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/visitor/sourcemapper.js deleted file mode 100644 index d51a36fb..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/lib/visitor/sourcemapper.js +++ /dev/null @@ -1,204 +0,0 @@ -/*! - * Stylus - SourceMapper - * Copyright (c) Automattic - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Compiler = require('./compiler') - , Buffer = require('buffer').Buffer - , SourceMapGenerator = require('source-map').SourceMapGenerator - , basename = require('path').basename - , extname = require('path').extname - , dirname = require('path').dirname - , join = require('path').join - , relative = require('path').relative - , sep = require('path').sep - , fs = require('fs'); - -/** - * Initialize a new `SourceMapper` generator with the given `root` Node - * and the following `options`. - * - * @param {Node} root - * @api public - */ - -var SourceMapper = module.exports = function SourceMapper(root, options){ - options = options || {}; - this.column = 1; - this.lineno = 1; - this.contents = {}; - this.filename = options.filename; - this.dest = options.dest; - - var sourcemap = options.sourcemap; - this.basePath = sourcemap.basePath || '.'; - this.inline = sourcemap.inline; - this.comment = sourcemap.comment; - if (this.dest && extname(this.dest) === '.css') { - this.basename = basename(this.dest); - this.dest = dirname(this.dest); - } else { - this.basename = basename(this.filename, extname(this.filename)) + '.css'; - } - this.utf8 = false; - - this.map = new SourceMapGenerator({ - file: this.basename, - sourceRoot: sourcemap.sourceRoot || null - }); - Compiler.call(this, root, options); -}; - -/** - * Inherit from `Compiler.prototype`. - */ - -SourceMapper.prototype.__proto__ = Compiler.prototype; - -/** - * Generate and write source map. - * - * @return {String} - * @api private - */ - -var compile = Compiler.prototype.compile; -SourceMapper.prototype.compile = function(){ - var css = compile.call(this) - , out = this.basename + '.map' - , url = this.normalizePath(this.dest - ? join(this.dest, out) - : join(dirname(this.filename), out)) - , map; - - if (this.inline) { - map = this.map.toString(); - url = 'data:application/json;' - + (this.utf8 ? 'charset=utf-8;' : '') + 'base64,' - + Buffer.from(map).toString('base64'); - } - if (this.inline || false !== this.comment) - css += '/*# sourceMappingURL=' + url + ' */'; - return css; -}; - -/** - * Add mapping information. - * - * @param {String} str - * @param {Node} node - * @return {String} - * @api private - */ - -SourceMapper.prototype.out = function(str, node){ - if (node && node.lineno) { - var filename = this.normalizePath(node.filename); - - this.map.addMapping({ - original: { - line: node.lineno, - column: node.column - 1 - }, - generated: { - line: this.lineno, - column: this.column - 1 - }, - source: filename - }); - - if (this.inline && !this.contents[filename]) { - this.map.setSourceContent(filename, fs.readFileSync(node.filename, 'utf-8')); - this.contents[filename] = true; - } - } - - this.move(str); - return str; -}; - -/** - * Move current line and column position. - * - * @param {String} str - * @api private - */ - -SourceMapper.prototype.move = function(str){ - var lines = str.match(/\n/g) - , idx = str.lastIndexOf('\n'); - - if (lines) this.lineno += lines.length; - this.column = ~idx - ? str.length - idx - : this.column + str.length; -}; - -/** - * Normalize the given `path`. - * - * @param {String} path - * @return {String} - * @api private - */ - -SourceMapper.prototype.normalizePath = function(path){ - path = relative(this.dest || this.basePath, path); - if ('\\' == sep) { - path = path.replace(/^[a-z]:\\/i, '/') - .replace(/\\/g, '/'); - } - return path; -}; - -/** - * Visit Literal. - */ - -var literal = Compiler.prototype.visitLiteral; -SourceMapper.prototype.visitLiteral = function(lit){ - var val = literal.call(this, lit) - , filename = this.normalizePath(lit.filename) - , indentsRe = /^\s+/ - , lines = val.split('\n'); - - // add mappings for multiline literals - if (lines.length > 1) { - lines.forEach(function(line, i) { - var indents = line.match(indentsRe) - , column = indents && indents[0] - ? indents[0].length - : 0; - - if (lit.css) column += 2; - - this.map.addMapping({ - original: { - line: lit.lineno + i, - column: column - }, - generated: { - line: this.lineno + i, - column: 0 - }, - source: filename - }); - }, this); - } - return val; -}; - -/** - * Visit Charset. - */ - -var charset = Compiler.prototype.visitCharset; -SourceMapper.prototype.visitCharset = function(node){ - this.utf8 = ('utf-8' == node.val.string.toLowerCase()); - return charset.call(this, node); -}; diff --git a/node_modules/hexo-theme-butterfly/node_modules/stylus/package.json b/node_modules/hexo-theme-butterfly/node_modules/stylus/package.json deleted file mode 100644 index 52e3cb25..00000000 --- a/node_modules/hexo-theme-butterfly/node_modules/stylus/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "stylus", - "description": "Robust, expressive, and feature-rich CSS superset", - "version": "0.59.0", - "author": "TJ Holowaychuk ", - "keywords": [ - "css", - "parser", - "style", - "stylesheets", - "jade", - "language" - ], - "repository": { - "type": "git", - "url": "git://github.com/stylus/stylus" - }, - "main": "./index.js", - "browserify": "./lib/browserify.js", - "engines": { - "node": "*" - }, - "bin": { - "stylus": "./bin/stylus" - }, - "scripts": { - "prepublish": "npm prune", - "test": "mocha test/ test/middleware/ --require chai --bail --check-leaks --reporter dot" - }, - "dependencies": { - "@adobe/css-tools": "^4.0.1", - "debug": "^4.3.2", - "glob": "^7.1.6", - "sax": "~1.2.4", - "source-map": "^0.7.3" - }, - "devDependencies": { - "chai": "^4.3.6", - "mocha": "^9.2.0" - }, - "bugs": { - "url": "https://github.com/stylus/stylus/issues" - }, - "homepage": "https://github.com/stylus/stylus", - "directories": { - "doc": "docs", - "example": "examples", - "test": "test" - }, - "license": "MIT", - "funding": "https://opencollective.com/stylus" -} diff --git a/node_modules/hexo-theme-butterfly/package.json b/node_modules/hexo-theme-butterfly/package.json deleted file mode 100644 index cf71c0a1..00000000 --- a/node_modules/hexo-theme-butterfly/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "hexo-theme-butterfly", - "version": "4.9.0", - "description": "A Simple and Card UI Design theme for Hexo", - "main": "package.json", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [ - "hexo", - "theme", - "butterfly", - "Card UI Design", - "Jerry", - "hexo-theme-butterfly" - ], - "repository": { - "type": "git", - "url": "https://github.com/jerryc127/hexo-theme-butterfly.git" - }, - "bugs": { - "url": "https://github.com/jerryc127/hexo-theme-butterfly/issues", - "email": "my@crazywong.com" - }, - "dependencies": { - "hexo-renderer-stylus": "^3.0.0", - "hexo-renderer-pug": "^3.0.0" - }, - "homepage": "https://butterfly.js.org/", - "author": "Jerry ", - "license": "Apache-2.0" -} diff --git a/node_modules/hexo-theme-butterfly/plugins.yml b/node_modules/hexo-theme-butterfly/plugins.yml deleted file mode 100644 index 2a3f2c92..00000000 --- a/node_modules/hexo-theme-butterfly/plugins.yml +++ /dev/null @@ -1,214 +0,0 @@ -algolia_search: - name: algoliasearch - file: dist/algoliasearch-lite.umd.js - version: 4.17.1 -instantsearch: - name: instantsearch.js - file: dist/instantsearch.production.min.js - version: 4.56.1 -pjax: - name: pjax - file: pjax.min.js - version: 0.2.8 -gitalk: - name: gitalk - file: dist/gitalk.min.js - version: 1.8.0 -gitalk_css: - name: gitalk - file: dist/gitalk.css - version: 1.8.0 -blueimp_md5: - name: blueimp-md5 - file: js/md5.min.js - version: 2.19.0 -valine: - name: valine - file: dist/Valine.min.js - version: 1.5.1 -disqusjs: - name: disqusjs - file: dist/browser/disqusjs.es2015.umd.min.js - version: 3.0.2 -disqusjs_css: - name: disqusjs - file: dist/browser/styles/disqusjs.css - version: 3.0.2 -twikoo: - name: twikoo - file: dist/twikoo.all.min.js - version: 1.6.16 -waline_js: - name: '@waline/client' - file: dist/waline.js - other_name: waline - version: 2.15.5 -waline_css: - name: '@waline/client' - file: dist/waline.css - other_name: waline - version: 2.15.5 -sharejs: - name: butterfly-extsrc - file: sharejs/dist/js/social-share.min.js - version: 1.1.3 -sharejs_css: - name: butterfly-extsrc - file: sharejs/dist/css/share.min.css - version: 1.1.3 -mathjax: - name: mathjax - file: es5/tex-mml-chtml.js - version: 3.2.2 -katex: - name: katex - file: dist/katex.min.css - other_name: KaTeX - version: 0.16.7 -katex_copytex: - name: katex - file: dist/contrib/copy-tex.min.js - other_name: KaTeX - version: 0.16.7 -mermaid: - name: mermaid - file: dist/mermaid.min.js - version: 10.2.2 -canvas_ribbon: - name: butterfly-extsrc - file: dist/canvas-ribbon.min.js - version: 1.1.3 -canvas_fluttering_ribbon: - name: butterfly-extsrc - file: dist/canvas-fluttering-ribbon.min.js - version: 1.1.3 -canvas_nest: - name: butterfly-extsrc - file: dist/canvas-nest.min.js - version: 1.1.3 -activate_power_mode: - name: butterfly-extsrc - file: dist/activate-power-mode.min.js - version: 1.1.3 -fireworks: - name: butterfly-extsrc - file: dist/fireworks.min.js - version: 1.1.3 -click_heart: - name: butterfly-extsrc - file: dist/click-heart.min.js - version: 1.1.3 -ClickShowText: - name: butterfly-extsrc - file: dist/click-show-text.min.js - version: 1.1.3 -lazyload: - name: vanilla-lazyload - file: dist/lazyload.iife.min.js - version: 17.8.3 -instantpage: - name: instant.page - file: instantpage.js - version: 5.2.0 -typed: - name: typed.js - file: dist/typed.umd.js - version: 2.0.16 -pangu: - name: pangu - file: dist/browser/pangu.min.js - version: 4.0.7 -fancybox_css: - name: '@fancyapps/ui' - file: dist/fancybox/fancybox.css - version: 5.0.19 - other_name: fancyapps-ui -fancybox: - name: '@fancyapps/ui' - file: dist/fancybox/fancybox.umd.js - version: 5.0.19 - other_name: fancyapps-ui -medium_zoom: - name: medium-zoom - file: dist/medium-zoom.min.js - version: 1.0.8 -snackbar_css: - name: node-snackbar - file: dist/snackbar.min.css - version: 0.1.16 -snackbar: - name: node-snackbar - file: dist/snackbar.min.js - version: 0.1.16 -fontawesome: - name: '@fortawesome/fontawesome-free' - file: css/all.min.css - other_name: font-awesome - version: 6.4.0 -flickr_justified_gallery_js: - name: flickr-justified-gallery - file: dist/fjGallery.min.js - version: 2.1.2 -flickr_justified_gallery_css: - name: flickr-justified-gallery - file: dist/fjGallery.css - version: 2.1.2 -aplayer_css: - name: aplayer - file: dist/APlayer.min.css - version: 1.10.1 -aplayer_js: - name: aplayer - file: dist/APlayer.min.js - version: 1.10.1 -meting_js: - name: butterfly-extsrc - file: metingjs/dist/Meting.min.js - version: 1.1.3 -prismjs_js: - name: prismjs - file: prism.js - other_name: prism - version: 1.29.0 -prismjs_lineNumber_js: - name: prismjs - file: plugins/line-numbers/prism-line-numbers.min.js - other_name: prism - version: 1.29.0 -prismjs_autoloader: - name: prismjs - file: plugins/autoloader/prism-autoloader.min.js - other_name: prism - version: 1.29.0 -artalk_js: - name: artalk - file: dist/Artalk.js - version: 2.5.5 -artalk_css: - name: artalk - file: dist/Artalk.css - version: 2.5.5 -pace_js: - name: pace-js - other_name: pace - file: pace.min.js - version: 1.2.4 -pace_default_css: - name: pace-js - other_name: pace - file: themes/blue/pace-theme-minimal.css - version: 1.2.4 -docsearch_js: - name: '@docsearch/js' - other_name: docsearch-js - file: dist/umd/index.js - version: 3.4.0 -docsearch_css: - name: '@docsearch/css' - other_name: docsearch-css - file: dist/style.css - version: 3.4.0 -abcjs_basic_js: - name: abcjs - file: dist/abcjs-basic-min.js - version: 6.2.2 diff --git a/node_modules/hexo-theme-butterfly/scripts/events/404.js b/node_modules/hexo-theme-butterfly/scripts/events/404.js deleted file mode 100644 index c95f0e0a..00000000 --- a/node_modules/hexo-theme-butterfly/scripts/events/404.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Butterfly - * 404 error page - */ - -'use strict' - -hexo.extend.generator.register('404', function (locals) { - if (!hexo.theme.config.error_404.enable) return - return { - path: '404.html', - layout: ['page'], - data: { - type: '404', - top_img: false - } - } -}) diff --git a/node_modules/hexo-theme-butterfly/scripts/events/cdn.js b/node_modules/hexo-theme-butterfly/scripts/events/cdn.js deleted file mode 100644 index 7d3e31ee..00000000 --- a/node_modules/hexo-theme-butterfly/scripts/events/cdn.js +++ /dev/null @@ -1,97 +0,0 @@ -/** - * Butterfly - * Merge CDN - */ - -'use strict' - -const { version } = require('../../package.json') -const path = require('path') - -hexo.extend.filter.register('before_generate', () => { - const themeConfig = hexo.theme.config - const { CDN } = themeConfig - - const thirdPartySrc = hexo.render.renderSync({ path: path.join(hexo.theme_dir, '/plugins.yml'), engine: 'yaml' }) - const internalSrc = { - main: { - name: 'hexo-theme-butterfly', - file: 'js/main.js', - version - }, - utils: { - name: 'hexo-theme-butterfly', - file: 'js/utils.js', - version - }, - translate: { - name: 'hexo-theme-butterfly', - file: 'js/tw_cn.js', - version - }, - local_search: { - name: 'hexo-theme-butterfly', - file: 'js/search/local-search.js', - version - }, - algolia_js: { - name: 'hexo-theme-butterfly', - file: 'js/search/algolia.js', - version - } - } - - const minFile = file => { - return file.replace(/(? '.min' + ext) - } - - const createCDNLink = (data, type, cond = '') => { - Object.keys(data).forEach(key => { - let { name, version, file, other_name } = data[key] - const cdnjs_name = other_name || name - const cdnjs_file = file.replace(/^[lib|dist]*\/|browser\//g, '') - const min_cdnjs_file = minFile(cdnjs_file) - if (cond === 'internal') file = `source/${file}` - const min_file = minFile(file) - const verType = CDN.version ? (type === 'local' ? `?v=${version}` : `@${version}`) : '' - - const value = { - version, - name, - file, - cdnjs_file, - min_file, - min_cdnjs_file, - cdnjs_name - } - - const cdnSource = { - local: cond === 'internal' ? `${cdnjs_file + verType}` : `/pluginsSrc/${name}/${file + verType}`, - jsdelivr: `https://cdn.jsdelivr.net/npm/${name}${verType}/${min_file}`, - unpkg: `https://unpkg.com/${name}${verType}/${file}`, - cdnjs: `https://cdnjs.cloudflare.com/ajax/libs/${cdnjs_name}/${version}/${min_cdnjs_file}`, - custom: (CDN.custom_format || '').replace(/\$\{(.+?)\}/g, (match, $1) => value[$1]) - } - - data[key] = cdnSource[type] - }) - - if (cond === 'internal') data.main_css = 'css/index.css' + (CDN.version ? `?v=${version}` : '') - return data - } - - // delete null value - const deleteNullValue = obj => { - if (!obj) return - for (const i in obj) { - obj[i] === null && delete obj[i] - } - return obj - } - - themeConfig.asset = Object.assign( - createCDNLink(internalSrc, CDN.internal_provider, 'internal'), - createCDNLink(thirdPartySrc, CDN.third_party_provider), - deleteNullValue(CDN.option) - ) -}) diff --git a/node_modules/hexo-theme-butterfly/scripts/events/comment.js b/node_modules/hexo-theme-butterfly/scripts/events/comment.js deleted file mode 100644 index 88aff658..00000000 --- a/node_modules/hexo-theme-butterfly/scripts/events/comment.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Capitalize the first letter of comment name - */ - -hexo.extend.filter.register('before_generate', () => { - const themeConfig = hexo.theme.config - let { use } = themeConfig.comments - if (!use) return - if (typeof use === 'string') { - use = use.split(',') - } - const newArray = use.map(item => item.toLowerCase().replace(/\b[a-z]/g, s => s.toUpperCase())) - themeConfig.comments.use = newArray -}) diff --git a/node_modules/hexo-theme-butterfly/scripts/events/init.js b/node_modules/hexo-theme-butterfly/scripts/events/init.js deleted file mode 100644 index dab46960..00000000 --- a/node_modules/hexo-theme-butterfly/scripts/events/init.js +++ /dev/null @@ -1,20 +0,0 @@ -hexo.extend.filter.register('before_generate', () => { - // Get first two digits of the Hexo version number - const { version, log, locals } = hexo - const hexoVer = version.replace(/(^.*\..*)\..*/, '$1') - - if (hexoVer < 5.3) { - log.error('Please update Hexo to V5.3.0 or higher!') - log.error('請把 Hexo 升級到 V5.3.0 或更高的版本!') - process.exit(-1) - } - - if (locals.get) { - const data = locals.get('data') - if (data && data.butterfly) { - log.error("'butterfly.yml' is deprecated. Please use '_config.butterfly.yml'") - log.error("'butterfly.yml' 已經棄用,請使用 '_config.butterfly.yml'") - process.exit(-1) - } - } -}) diff --git a/node_modules/hexo-theme-butterfly/scripts/events/stylus.js b/node_modules/hexo-theme-butterfly/scripts/events/stylus.js deleted file mode 100644 index 73a28716..00000000 --- a/node_modules/hexo-theme-butterfly/scripts/events/stylus.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * stylus - */ - -'use strict' - -hexo.extend.filter.register('stylus:renderer', function (style) { - const { highlight, prismjs } = hexo.config - style - .define('$highlight_enable', highlight && highlight.enable) - .define('$highlight_line_number', highlight && highlight.line_number) - .define('$prismjs_enable', prismjs && prismjs.enable) - .define('$prismjs_line_number', prismjs && prismjs.line_number) - // .import(this.source_dir.replace(/\\/g, '/') + '_data/css/*') -}) diff --git a/node_modules/hexo-theme-butterfly/scripts/events/welcome.js b/node_modules/hexo-theme-butterfly/scripts/events/welcome.js deleted file mode 100644 index 188763c2..00000000 --- a/node_modules/hexo-theme-butterfly/scripts/events/welcome.js +++ /dev/null @@ -1,13 +0,0 @@ -hexo.on('ready', () => { - const { version } = require('../../package.json') - hexo.log.info(` - =================================================================== - ##### # # ##### ##### ###### ##### ###### # # # - # # # # # # # # # # # # # - ##### # # # # ##### # # ##### # # - # # # # # # # ##### # # # - # # # # # # # # # # # # - ##### #### # # ###### # # # ###### # - ${version} - ===================================================================`) -}) diff --git a/node_modules/hexo-theme-butterfly/scripts/filters/post_lazyload.js b/node_modules/hexo-theme-butterfly/scripts/filters/post_lazyload.js deleted file mode 100644 index adf9b69b..00000000 --- a/node_modules/hexo-theme-butterfly/scripts/filters/post_lazyload.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Butterfly - * lazyload - * replace src to data-lazy-src - */ - -'use strict' - -const urlFor = require('hexo-util').url_for.bind(hexo) - -function lazyload (htmlContent) { - const bg = hexo.theme.config.lazyload.placeholder ? urlFor(hexo.theme.config.lazyload.placeholder) : 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' - return htmlContent.replace(/( { - const config = hexo.theme.config.lazyload - if (!config.enable) return - if (config.field !== 'post') return - data.content = lazyload.call(this, data.content) - return data -}) diff --git a/node_modules/hexo-theme-butterfly/scripts/filters/random_cover.js b/node_modules/hexo-theme-butterfly/scripts/filters/random_cover.js deleted file mode 100644 index 1f1aa8e9..00000000 --- a/node_modules/hexo-theme-butterfly/scripts/filters/random_cover.js +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Butterfly - * ramdom cover - */ - -'use strict' - -hexo.extend.filter.register('before_post_render', function (data) { - const imgTestReg = /\.(png|jpe?g|gif|svg|webp)(\?.*)?$/i - let randomCover - let coverVal = data.cover - - // Add path to top_img and cover if post_asset_folder is enabled - if (hexo.config.post_asset_folder) { - const topImg = data.top_img - if (topImg && topImg.indexOf('/') === -1 && imgTestReg.test(topImg)) data.top_img = data.path + topImg - if (coverVal && coverVal.indexOf('/') === -1 && imgTestReg.test(coverVal)) data.cover = data.path + coverVal - } - - const randomCoverFn = () => { - const theme = hexo.theme.config - if (!(theme.cover && theme.cover.default_cover)) return false - if (!Array.isArray(theme.cover.default_cover)) return theme.cover.default_cover - const num = Math.floor(Math.random() * theme.cover.default_cover.length) - return theme.cover.default_cover[num] - } - - if (coverVal === false) return data - - // If cover is not set, use random cover - if (!coverVal) { - randomCover = randomCoverFn() - data.cover = randomCover - coverVal = randomCover // update coverVal - } - - if (coverVal) { - if (coverVal.indexOf('//') !== -1 || imgTestReg.test(coverVal)) { - data.cover_type = 'img' - return data - } - } - - return data -}) diff --git a/node_modules/hexo-theme-butterfly/scripts/helpers/aside_archives.js b/node_modules/hexo-theme-butterfly/scripts/helpers/aside_archives.js deleted file mode 100644 index 427c773b..00000000 --- a/node_modules/hexo-theme-butterfly/scripts/helpers/aside_archives.js +++ /dev/null @@ -1,113 +0,0 @@ -/** - * Butterfly - * for aside archives - */ - -'use strict' - -hexo.extend.helper.register('aside_archives', function (options = {}) { - const { config } = this - const archiveDir = config.archive_dir - const { timezone } = config - const lang = toMomentLocale(this.page.lang || this.page.language || config.language) - let { format } = options - const type = options.type || 'monthly' - const { transform } = options - const showCount = Object.prototype.hasOwnProperty.call(options, 'show_count') ? options.show_count : true - const order = options.order || -1 - const compareFunc = type === 'monthly' - ? (yearA, monthA, yearB, monthB) => yearA === yearB && monthA === monthB - : (yearA, monthA, yearB, monthB) => yearA === yearB - const limit = options.limit - let result = '' - - if (!format) { - format = type === 'monthly' ? 'MMMM YYYY' : 'YYYY' - } - - const posts = this.site.posts.sort('date', order) - if (!posts.length) return result - - const data = [] - let length = 0 - - posts.forEach(post => { - // Clone the date object to avoid pollution - let date = post.date.clone() - - if (timezone) date = date.tz(timezone) - - const year = date.year() - const month = date.month() + 1 - const lastData = data[length - 1] - - if (!lastData || !compareFunc(lastData.year, lastData.month, year, month)) { - if (lang) date = date.locale(lang) - const name = date.format(format) - length = data.push({ - name, - year, - month, - count: 1 - }) - } else { - lastData.count++ - } - }) - - const link = item => { - let url = `${archiveDir}/${item.year}/` - - if (type === 'monthly') { - if (item.month < 10) url += '0' - url += `${item.month}/` - } - - return this.url_for(url) - } - - const len = data.length - const Judge = limit === 0 ? len : Math.min(len, limit) - - result += `' - return result -}) - -const toMomentLocale = function (lang) { - if (lang === undefined) { - return undefined - } - - // moment.locale('') equals moment.locale('en') - // moment.locale(null) equals moment.locale('en') - if (!lang || lang === 'en' || lang === 'default') { - return 'en' - } - return lang.toLowerCase().replace('_', '-') -} diff --git a/node_modules/hexo-theme-butterfly/scripts/helpers/aside_categories.js b/node_modules/hexo-theme-butterfly/scripts/helpers/aside_categories.js deleted file mode 100644 index 75a322ca..00000000 --- a/node_modules/hexo-theme-butterfly/scripts/helpers/aside_categories.js +++ /dev/null @@ -1,97 +0,0 @@ -/** - * Butterfly - * for aside categories - */ - -'use strict' - -hexo.extend.helper.register('aside_categories', function (categories, options) { - if (!options && (!categories || !Object.prototype.hasOwnProperty.call(categories, 'length')) - ) { - options = categories - categories = this.site.categories - } - - if (!categories || !categories.length) return '' - options = options || {} - const { config } = this - const showCount = Object.prototype.hasOwnProperty.call(options, 'show_count') - ? options.show_count - : true - const depth = options.depth ? parseInt(options.depth, 10) : 0 - const orderby = options.orderby || 'name' - const order = options.order || 1 - const categoryDir = this.url_for(config.category_dir) - const limit = options.limit === 0 ? categories.length : options.limit - const isExpand = options.expand !== 'none' - const expandClass = isExpand && options.expand === true ? 'expand' : '' - const buttonLabel = this._p('aside.more_button') - const prepareQuery = (parent) => { - const query = {} - if (parent) { query.parent = parent } else { query.parent = { $exists: false } } - return categories.find(query).sort(orderby, order).filter((cat) => cat.length) - } - - const hierarchicalList = (t, level, parent, topparent = true) => { - let result = '' - const isTopParent = topparent - if (t > 0) { - prepareQuery(parent).forEach((cat, i) => { - if (t > 0) { - t = t - 1 - let child - if (!depth || level + 1 < depth) { - const childList = hierarchicalList(t, level + 1, cat._id, false) - child = childList[0] - t = childList[1] - } - - const parentClass = isExpand && isTopParent && child ? 'parent' : '' - - result += `
  • ` - - result += `` - - result += `${cat.name}` - - if (showCount) { - result += `${cat.length}` - } - - if (isExpand && isTopParent && child) { - result += `` - } - - result += '' - - if (child) { - result += `
      ${child}
    ` - } - - result += '
  • ' - } - }) - } - - return [result, t] - } - - const list = hierarchicalList(limit, 0) - - const moreButton = function () { - if (categories.length <= limit) return '' - const moreHtml = ` - ` - - return moreHtml - } - - return `
    - - ${this._p('aside.card_categories')} - ${moreButton()} -
    -
      - ${list[0]} -
    ` -}) diff --git a/node_modules/hexo-theme-butterfly/scripts/helpers/findArchiveLength.js b/node_modules/hexo-theme-butterfly/scripts/helpers/findArchiveLength.js deleted file mode 100644 index 36402988..00000000 --- a/node_modules/hexo-theme-butterfly/scripts/helpers/findArchiveLength.js +++ /dev/null @@ -1,58 +0,0 @@ -hexo.extend.helper.register('findArchiveLength', function (func) { - const allPostsLength = this.site.posts.length - if (hexo.config.archive_generator && hexo.config.archive_generator.enable === false) return allPostsLength - const { yearly, monthly, daily } = hexo.config.archive_generator - const { year, month, day } = this.page - if (yearly === false || !year) return allPostsLength - - const posts = this.site.posts.sort('date') - - const compareFunc = (type, y1, m1, d1, y2, m2, d2) => { - if (type === 'year') { - return y1 === y2 - } else if (type === 'month') { - return y1 === y2 && m1 === m2 - } else if (type === 'day') { - return y1 === y2 && m1 === m2 && d1 === d2 - } - } - - const generateDateObj = (type) => { - const dateObj = [] - let length = 0 - - posts.forEach(post => { - const date = post.date.clone() - const year = date.year() - const month = date.month() + 1 - const day = date.date() - const lastData = dateObj[length - 1] - - if (!lastData || !compareFunc(type, lastData.year, lastData.month, lastData.day, year, month, day)) { - const name = type === 'year' ? year : type === 'month' ? `${year}-${month}` : `${year}-${month}-${day}` - length = dateObj.push({ - name, - year, - month, - day, - count: 1 - }) - } else { - lastData.count++ - } - }) - - return dateObj - } - - const data = func('createArchiveObj', () => { - const yearObj = yearly ? generateDateObj('year') : [] - const monthObj = monthly ? generateDateObj('month') : [] - const dayObj = daily ? generateDateObj('day') : [] - const fullObj = [...yearObj, ...monthObj, ...dayObj] - return fullObj - }) - - const name = month ? day ? `${year}-${month}-${day}` : `${year}-${month}` : year - return data.find(item => item.name === name).count -}) diff --git a/node_modules/hexo-theme-butterfly/scripts/helpers/inject_head_js.js b/node_modules/hexo-theme-butterfly/scripts/helpers/inject_head_js.js deleted file mode 100644 index 86c67b21..00000000 --- a/node_modules/hexo-theme-butterfly/scripts/helpers/inject_head_js.js +++ /dev/null @@ -1,166 +0,0 @@ -/** - * Butterfly - * inject js to head - */ - -'use strict' - -hexo.extend.helper.register('inject_head_js', function () { - const { darkmode, aside } = this.theme - const start = darkmode.start ? darkmode.start : 6 - const end = darkmode.end ? darkmode.end : 18 - const { theme_color } = hexo.theme.config - const themeColorLight = (theme_color && theme_color.enable && theme_color.meta_theme_color_light) || '#ffffff' - const themeColorDark = (theme_color && theme_color.enable && theme_color.meta_theme_color_dark) || '#0d0d0d' - - const localStore = ` - win.saveToLocal = { - set: function setWithExpiry(key, value, ttl) { - if (ttl === 0) return - const now = new Date() - const expiryDay = ttl * 86400000 - const item = { - value: value, - expiry: now.getTime() + expiryDay, - } - localStorage.setItem(key, JSON.stringify(item)) - }, - - get: function getWithExpiry(key) { - const itemStr = localStorage.getItem(key) - - if (!itemStr) { - return undefined - } - const item = JSON.parse(itemStr) - const now = new Date() - - if (now.getTime() > item.expiry) { - localStorage.removeItem(key) - return undefined - } - return item.value - } - } - ` - - // https://stackoverflow.com/questions/16839698/jquery-getscript-alternative-in-native-javascript - const getScript = ` - win.getScript = url => new Promise((resolve, reject) => { - const script = document.createElement('script') - script.src = url - script.async = true - script.onerror = reject - script.onload = script.onreadystatechange = function() { - const loadState = this.readyState - if (loadState && loadState !== 'loaded' && loadState !== 'complete') return - script.onload = script.onreadystatechange = null - resolve() - } - document.head.appendChild(script) - }) - ` - - const getCSS = ` - win.getCSS = (url,id = false) => new Promise((resolve, reject) => { - const link = document.createElement('link') - link.rel = 'stylesheet' - link.href = url - if (id) link.id = id - link.onerror = reject - link.onload = link.onreadystatechange = function() { - const loadState = this.readyState - if (loadState && loadState !== 'loaded' && loadState !== 'complete') return - link.onload = link.onreadystatechange = null - resolve() - } - document.head.appendChild(link) - }) - ` - - let darkmodeJs = '' - if (darkmode.enable) { - darkmodeJs = ` - win.activateDarkMode = function () { - document.documentElement.setAttribute('data-theme', 'dark') - if (document.querySelector('meta[name="theme-color"]') !== null) { - document.querySelector('meta[name="theme-color"]').setAttribute('content', '${themeColorDark}') - } - } - win.activateLightMode = function () { - document.documentElement.setAttribute('data-theme', 'light') - if (document.querySelector('meta[name="theme-color"]') !== null) { - document.querySelector('meta[name="theme-color"]').setAttribute('content', '${themeColorLight}') - } - } - const t = saveToLocal.get('theme') - ` - - const autoChangeMode = darkmode.autoChangeMode - - if (autoChangeMode === 1) { - darkmodeJs += ` - const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches - const isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches - const isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches - const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified - - if (t === undefined) { - if (isLightMode) activateLightMode() - else if (isDarkMode) activateDarkMode() - else if (isNotSpecified || hasNoSupport) { - const now = new Date() - const hour = now.getHours() - const isNight = hour <= ${start} || hour >= ${end} - isNight ? activateDarkMode() : activateLightMode() - } - window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) { - if (saveToLocal.get('theme') === undefined) { - e.matches ? activateDarkMode() : activateLightMode() - } - }) - } else if (t === 'light') activateLightMode() - else activateDarkMode() - ` - } else if (autoChangeMode === 2) { - darkmodeJs += ` - const now = new Date() - const hour = now.getHours() - const isNight = hour <= ${start} || hour >= ${end} - if (t === undefined) isNight ? activateDarkMode() : activateLightMode() - else if (t === 'light') activateLightMode() - else activateDarkMode() - ` - } else { - darkmodeJs += ` - if (t === 'dark') activateDarkMode() - else if (t === 'light') activateLightMode() - ` - } - } - - let asideStatus = '' - if (aside.enable && aside.button) { - asideStatus = ` - const asideStatus = saveToLocal.get('aside-status') - if (asideStatus !== undefined) { - if (asideStatus === 'hide') { - document.documentElement.classList.add('hide-aside') - } else { - document.documentElement.classList.remove('hide-aside') - } - } - ` - } - - const detectApple = ` - const detectApple = () => { - if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){ - document.documentElement.classList.add('apple') - } - } - detectApple() - ` - - return `` -}) diff --git a/node_modules/hexo-theme-butterfly/scripts/helpers/page.js b/node_modules/hexo-theme-butterfly/scripts/helpers/page.js deleted file mode 100644 index 60a33c09..00000000 --- a/node_modules/hexo-theme-butterfly/scripts/helpers/page.js +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Butterfly - * @example - * page_description() - * cloudTags(source, minfontsize, maxfontsize, limit) - */ - -'use strict' - -const { stripHTML, escapeHTML, prettyUrls } = require('hexo-util') -const crypto = require('crypto') - -hexo.extend.helper.register('page_description', function () { - const { config, page } = this - let description = page.description || page.content || page.title || config.description - - if (description) { - description = escapeHTML(stripHTML(description).substring(0, 150) - .trim() - ).replace(/\n/g, ' ') - return description - } -}) - -hexo.extend.helper.register('cloudTags', function (options = {}) { - const env = this - let { source, minfontsize, maxfontsize, limit, unit, orderby, order } = options - unit = unit || 'px' - - let result = '' - if (limit > 0) { - source = source.limit(limit) - } - - const sizes = [] - source.sort('length').forEach(tag => { - const { length } = tag - if (sizes.includes(length)) return - sizes.push(length) - }) - - const length = sizes.length - 1 - source.sort(orderby, order).forEach(tag => { - const ratio = length ? sizes.indexOf(tag.length) / length : 0 - const size = minfontsize + ((maxfontsize - minfontsize) * ratio) - let style = `font-size: ${parseFloat(size.toFixed(2))}${unit};` - const color = 'rgb(' + Math.floor(Math.random() * 201) + ', ' + Math.floor(Math.random() * 201) + ', ' + Math.floor(Math.random() * 201) + ')' // 0,0,0 -> 200,200,200 - style += ` color: ${color}` - result += `${tag.name}` - }) - return result -}) - -hexo.extend.helper.register('urlNoIndex', function (url = null, trailingIndex = false, trailingHtml = false) { - return prettyUrls(url || this.url, { trailing_index: trailingIndex, trailing_html: trailingHtml }) -}) - -hexo.extend.helper.register('md5', function (path) { - return crypto.createHash('md5').update(decodeURI(this.url_for(path))).digest('hex') -}) - -hexo.extend.helper.register('injectHtml', function (data) { - let result = '' - if (!data) return '' - for (let i = 0; i < data.length; i++) { - result += data[i] - } - return result -}) - -hexo.extend.helper.register('findArchivesTitle', function (page, menu, date) { - if (page.year) { - const dateStr = page.month ? `${page.year}-${page.month}` : `${page.year}` - const dateFormat = page.month ? hexo.theme.config.aside.card_archives.format : 'YYYY' - return date(dateStr, dateFormat) - } - - const defaultTitle = this._p('page.archives') - if (!menu) return defaultTitle - - const loop = (m) => { - for (const key in m) { - if (typeof m[key] === 'object') { - loop(m[key]) - } - - if (/\/archives\//.test(m[key])) { - return key - } - } - } - - return loop(menu) || defaultTitle -}) - -hexo.extend.helper.register('isImgOrUrl', function (path) { - const imgTestReg = /\.(png|jpe?g|gif|svg|webp)(\?.*)?$/i - if (path.indexOf('//') !== -1 || imgTestReg.test(path)) { - return true - } - return false -}) diff --git a/node_modules/hexo-theme-butterfly/scripts/helpers/related_post.js b/node_modules/hexo-theme-butterfly/scripts/helpers/related_post.js deleted file mode 100644 index c91a983e..00000000 --- a/node_modules/hexo-theme-butterfly/scripts/helpers/related_post.js +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Butterfly - * Related Posts - * According the tag - */ - -'use strict' - -hexo.extend.helper.register('related_posts', function (currentPost, allPosts) { - let relatedPosts = [] - currentPost.tags.forEach(function (tag) { - allPosts.forEach(function (post) { - if (isTagRelated(tag.name, post.tags)) { - const relatedPost = { - title: post.title, - path: post.path, - cover: post.cover, - cover_type: post.cover_type, - weight: 1, - updated: post.updated, - created: post.date - } - const index = findItem(relatedPosts, 'path', post.path) - if (index !== -1) { - relatedPosts[index].weight += 1 - } else { - if (currentPost.path !== post.path) { - relatedPosts.push(relatedPost) - } - } - } - }) - }) - if (relatedPosts.length === 0) { - return '' - } - let result = '' - const hexoConfig = hexo.config - const config = hexo.theme.config - - const limitNum = config.related_post.limit || 6 - const dateType = config.related_post.date_type || 'created' - const headlineLang = this._p('post.recommend') - - relatedPosts = relatedPosts.sort(compare('weight')) - - if (relatedPosts.length > 0) { - result += '