From 5d17e8fb21f7304393dea0508b65ee8cc5fcd29d Mon Sep 17 00:00:00 2001 From: Brent Jackson Date: Sun, 14 Apr 2019 13:45:10 -0400 Subject: [PATCH] Adjust themes packages for better bundle sizes --- docs/bundle-analyzer.config.js | 8 +++ docs/demo.mdx | 3 +- docs/package.json | 3 + package.json | 1 + packages/components/src/Provider.js | 2 +- packages/themes/{src => }/aspect.js | 0 packages/themes/{src => }/base.js | 0 packages/themes/{src => }/big.js | 0 packages/themes/{src => }/book.js | 0 packages/themes/{src => }/code.js | 0 packages/themes/{src => }/comic.js | 0 packages/themes/{src => }/condensed.js | 0 packages/themes/{src => }/dark.js | 0 packages/themes/{src => }/future.js | 0 packages/themes/{src => }/hack.js | 0 packages/themes/{src => }/index.js | 0 packages/themes/{src => }/lobster.js | 0 packages/themes/{src => }/notes.js | 0 packages/themes/package.json | 2 +- packages/themes/{src => }/poppins.js | 0 packages/themes/{src => }/rye.js | 0 packages/themes/{src => }/script.js | 0 packages/themes/{src => }/swiss.js | 0 .../{src => }/syntax-highlighter-prism.js | 0 .../themes/{src => }/syntax-highlighter.js | 0 packages/themes/{src => }/yellow.js | 0 yarn.lock | 64 +++++++++++++++++-- 27 files changed, 75 insertions(+), 8 deletions(-) create mode 100644 docs/bundle-analyzer.config.js rename packages/themes/{src => }/aspect.js (100%) rename packages/themes/{src => }/base.js (100%) rename packages/themes/{src => }/big.js (100%) rename packages/themes/{src => }/book.js (100%) rename packages/themes/{src => }/code.js (100%) rename packages/themes/{src => }/comic.js (100%) rename packages/themes/{src => }/condensed.js (100%) rename packages/themes/{src => }/dark.js (100%) rename packages/themes/{src => }/future.js (100%) rename packages/themes/{src => }/hack.js (100%) rename packages/themes/{src => }/index.js (100%) rename packages/themes/{src => }/lobster.js (100%) rename packages/themes/{src => }/notes.js (100%) rename packages/themes/{src => }/poppins.js (100%) rename packages/themes/{src => }/rye.js (100%) rename packages/themes/{src => }/script.js (100%) rename packages/themes/{src => }/swiss.js (100%) rename packages/themes/{src => }/syntax-highlighter-prism.js (100%) rename packages/themes/{src => }/syntax-highlighter.js (100%) rename packages/themes/{src => }/yellow.js (100%) diff --git a/docs/bundle-analyzer.config.js b/docs/bundle-analyzer.config.js new file mode 100644 index 0000000..1799d27 --- /dev/null +++ b/docs/bundle-analyzer.config.js @@ -0,0 +1,8 @@ +const BundleAnalyzerPlugin = require('webpack-bundle-analyzer') + .BundleAnalyzerPlugin + +console.log('bundle analyzer') + +module.exports = { + plugins: [new BundleAnalyzerPlugin()], +} diff --git a/docs/demo.mdx b/docs/demo.mdx index 3e7691c..71d1e32 100644 --- a/docs/demo.mdx +++ b/docs/demo.mdx @@ -1,8 +1,9 @@ -export { future as theme } from '@mdx-deck/themes' import { Head, Image, Notes, Appear } from '@mdx-deck/components' import { Invert, Split, SplitRight, FullScreenCode, Horizontal} from '@mdx-deck/layouts' import Counter from './Counter' +export { default as theme } from '@mdx-deck/themes/future' + mdx-deck diff --git a/docs/package.json b/docs/package.json index 981e230..212f6d6 100644 --- a/docs/package.json +++ b/docs/package.json @@ -19,5 +19,8 @@ "@rebass/emotion": "^3.0.0", "mdx-deck": "^2.2.0", "rebass": "^3.0.1" + }, + "devDependencies": { + "webpack-bundle-analyzer": "^3.3.2" } } diff --git a/package.json b/package.json index adade25..51d2f81 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ ], "scripts": { "start": "yarn workspace @mdx-deck/docs start", + "analyze-bundle": "yarn workspace @mdx-deck/docs start --webpack bundle-analyzer.config.js", "build": "yarn workspace @mdx-deck/docs build", "test": "jest" }, diff --git a/packages/components/src/Provider.js b/packages/components/src/Provider.js index 8bff89e..a2a17b5 100644 --- a/packages/components/src/Provider.js +++ b/packages/components/src/Provider.js @@ -4,7 +4,7 @@ import { ThemeProvider } from 'emotion-theming' import merge from 'lodash.merge' import { HeadProvider } from './Head' import { MDXProvider } from '@mdx-js/react' -import defaultTheme from '@mdx-deck/themes' +import defaultTheme from '@mdx-deck/themes/base' import mdxComponents from './mdx-components' const DefaultProvider = props => <>{props.children} diff --git a/packages/themes/src/aspect.js b/packages/themes/aspect.js similarity index 100% rename from packages/themes/src/aspect.js rename to packages/themes/aspect.js diff --git a/packages/themes/src/base.js b/packages/themes/base.js similarity index 100% rename from packages/themes/src/base.js rename to packages/themes/base.js diff --git a/packages/themes/src/big.js b/packages/themes/big.js similarity index 100% rename from packages/themes/src/big.js rename to packages/themes/big.js diff --git a/packages/themes/src/book.js b/packages/themes/book.js similarity index 100% rename from packages/themes/src/book.js rename to packages/themes/book.js diff --git a/packages/themes/src/code.js b/packages/themes/code.js similarity index 100% rename from packages/themes/src/code.js rename to packages/themes/code.js diff --git a/packages/themes/src/comic.js b/packages/themes/comic.js similarity index 100% rename from packages/themes/src/comic.js rename to packages/themes/comic.js diff --git a/packages/themes/src/condensed.js b/packages/themes/condensed.js similarity index 100% rename from packages/themes/src/condensed.js rename to packages/themes/condensed.js diff --git a/packages/themes/src/dark.js b/packages/themes/dark.js similarity index 100% rename from packages/themes/src/dark.js rename to packages/themes/dark.js diff --git a/packages/themes/src/future.js b/packages/themes/future.js similarity index 100% rename from packages/themes/src/future.js rename to packages/themes/future.js diff --git a/packages/themes/src/hack.js b/packages/themes/hack.js similarity index 100% rename from packages/themes/src/hack.js rename to packages/themes/hack.js diff --git a/packages/themes/src/index.js b/packages/themes/index.js similarity index 100% rename from packages/themes/src/index.js rename to packages/themes/index.js diff --git a/packages/themes/src/lobster.js b/packages/themes/lobster.js similarity index 100% rename from packages/themes/src/lobster.js rename to packages/themes/lobster.js diff --git a/packages/themes/src/notes.js b/packages/themes/notes.js similarity index 100% rename from packages/themes/src/notes.js rename to packages/themes/notes.js diff --git a/packages/themes/package.json b/packages/themes/package.json index 819c85d..5b23ac3 100644 --- a/packages/themes/package.json +++ b/packages/themes/package.json @@ -1,7 +1,7 @@ { "name": "@mdx-deck/themes", "version": "2.2.0", - "main": "src/index.js", + "main": "index.js", "author": "Brent Jackson ", "license": "MIT", "dependencies": { diff --git a/packages/themes/src/poppins.js b/packages/themes/poppins.js similarity index 100% rename from packages/themes/src/poppins.js rename to packages/themes/poppins.js diff --git a/packages/themes/src/rye.js b/packages/themes/rye.js similarity index 100% rename from packages/themes/src/rye.js rename to packages/themes/rye.js diff --git a/packages/themes/src/script.js b/packages/themes/script.js similarity index 100% rename from packages/themes/src/script.js rename to packages/themes/script.js diff --git a/packages/themes/src/swiss.js b/packages/themes/swiss.js similarity index 100% rename from packages/themes/src/swiss.js rename to packages/themes/swiss.js diff --git a/packages/themes/src/syntax-highlighter-prism.js b/packages/themes/syntax-highlighter-prism.js similarity index 100% rename from packages/themes/src/syntax-highlighter-prism.js rename to packages/themes/syntax-highlighter-prism.js diff --git a/packages/themes/src/syntax-highlighter.js b/packages/themes/syntax-highlighter.js similarity index 100% rename from packages/themes/src/syntax-highlighter.js rename to packages/themes/syntax-highlighter.js diff --git a/packages/themes/src/yellow.js b/packages/themes/yellow.js similarity index 100% rename from packages/themes/src/yellow.js rename to packages/themes/yellow.js diff --git a/yarn.lock b/yarn.lock index b96f30e..535f061 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2350,7 +2350,7 @@ acorn-jsx@^5.0.0: resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.1.tgz#32a064fd925429216a09b141102bfdd185fae40e" integrity sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg== -acorn-walk@^6.0.1: +acorn-walk@^6.0.1, acorn-walk@^6.1.1: version "6.1.1" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-6.1.1.tgz#d363b66f5fac5f018ff9c3a1e7b6f8e310cc3913" integrity sha512-OtUw6JUTgxA2QoqqmrmQ7F2NYqiBPi/L2jqHyFtllhOUvXYQXf0Z1CYUinIfyT4bTCGmrA7gX9FvHA81uzCoVw== @@ -3025,6 +3025,16 @@ better-queue@^3.8.6, better-queue@^3.8.7: node-eta "^0.9.0" uuid "^3.0.0" +bfj@^6.1.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/bfj/-/bfj-6.1.1.tgz#05a3b7784fbd72cfa3c22e56002ef99336516c48" + integrity sha512-+GUNvzHR4nRyGybQc2WpNJL4MJazMuvf92ueIyA0bIkPRwhhQu3IfZQ2PSoVPpCBJfmoSdOxu5rnotfFLlvYRQ== + dependencies: + bluebird "^3.5.1" + check-types "^7.3.0" + hoopy "^0.1.2" + tryer "^1.0.0" + big.js@^5.2.2: version "5.2.2" resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328" @@ -3554,6 +3564,11 @@ charenc@~0.0.1: resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667" integrity sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc= +check-types@^7.3.0: + version "7.4.0" + resolved "https://registry.yarnpkg.com/check-types/-/check-types-7.4.0.tgz#0378ec1b9616ec71f774931a3c6516fad8c152f4" + integrity sha512-YbulWHdfP99UfZ73NcUDlNJhEIDgm9Doq9GhpyXbF+7Aegi3CVV7qqMCKTTqJxlvEvnQBp9IA+dxsGN6xK/nSg== + cheerio@^0.22.0: version "0.22.0" resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-0.22.0.tgz#a9baa860a3f9b595a6b81b1a86873121ed3a269e" @@ -3826,7 +3841,7 @@ command-exists@^1.2.2: resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.8.tgz#715acefdd1223b9c9b37110a149c6392c2852291" integrity sha512-PM54PkseWbiiD/mMsbvW351/u+dafwTJ0ye2qB60G1aGQP9j3xK2gmMDc+R34L3nDtx4qMCitXT75mkbkGJDLw== -commander@^2.11.0, commander@^2.14.1, commander@^2.19.0, commander@^2.9.0, commander@~2.20.0: +commander@^2.11.0, commander@^2.14.1, commander@^2.18.0, commander@^2.19.0, commander@^2.9.0, commander@~2.20.0: version "2.20.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== @@ -5091,6 +5106,11 @@ ee-first@1.1.1: resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= +ejs@^2.6.1: + version "2.6.1" + resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.6.1.tgz#498ec0d495655abc6f23cd61868d926464071aa0" + integrity sha512-0xy4A/twfrRCnkhfk8ErDi5DqdAsAqeGxht4xkCUrsvhhbQNs7E+4jV0CN7+NKIY0aHE72+XvqtBIXzD31ZbXQ== + electron-to-chromium@^1.3.103, electron-to-chromium@^1.3.122, electron-to-chromium@^1.3.47: version "1.3.124" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.124.tgz#861fc0148748a11b3e5ccebdf8b795ff513fa11f" @@ -5936,7 +5956,7 @@ filesize@3.5.11: resolved "https://registry.yarnpkg.com/filesize/-/filesize-3.5.11.tgz#1919326749433bb3cf77368bd158caabcc19e9ee" integrity sha512-ZH7loueKBoDb7yG9esn1U+fgq7BzlzW6NRi5/rMdxIZ05dj7GFD/Xc5rq2CDt5Yq86CyfSYVyx4242QQNZbx1g== -filesize@3.6.1: +filesize@3.6.1, filesize@^3.6.1: version "3.6.1" resolved "https://registry.yarnpkg.com/filesize/-/filesize-3.6.1.tgz#090bb3ee01b6f801a8a8be99d31710b3422bb317" integrity sha512-7KjR1vv6qnicaPMi1iiTcI85CyYwRO/PSFCu6SvqL8jN2Wjt/NIYQTFtFs7fSDCYOstUkEWIQGFUg5YZQfjlcg== @@ -6916,7 +6936,7 @@ gzip-size@3.0.0: dependencies: duplexer "^0.1.1" -gzip-size@5.0.0: +gzip-size@5.0.0, gzip-size@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-5.0.0.tgz#a55ecd99222f4c48fd8c01c625ce3b349d0a0e80" integrity sha512-5iI7omclyqrnWw4XbXAmGhPsABkSIDQonv2K0h61lybgofWa6iZyvrI3r2zsJH4P8Nb64fFVzlvfhs0g7BBxAA== @@ -7172,6 +7192,11 @@ homedir-polyfill@^1.0.1: dependencies: parse-passwd "^1.0.0" +hoopy@^0.1.2: + version "0.1.4" + resolved "https://registry.yarnpkg.com/hoopy/-/hoopy-0.1.4.tgz#609207d661100033a9a9402ad3dea677381c1b1d" + integrity sha512-HRcs+2mr52W0K+x8RzcLzuPPmVIKMSv97RGHy0Ea9y/mpcaK+xTrjICA04KAHi4GRzxliNqNJEFYWHghy3rSfQ== + hosted-git-info@^2.1.4, hosted-git-info@^2.6.0: version "2.7.1" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" @@ -10374,6 +10399,11 @@ onetime@^2.0.0: dependencies: mimic-fn "^1.0.0" +opener@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/opener/-/opener-1.5.1.tgz#6d2f0e77f1a0af0032aca716c2c1fbb8e7e8abed" + integrity sha512-goYSy5c2UXE4Ra1xixabeVh1guIX/ZV/YokJksb6q2lubWu6UbvPQ20p542/sFIll1nl8JnCyK9oBaOcCWXwvA== + opentracing@^0.14.3: version "0.14.3" resolved "https://registry.yarnpkg.com/opentracing/-/opentracing-0.14.3.tgz#23e3ad029fa66a653926adbe57e834469f8550aa" @@ -13881,6 +13911,11 @@ trough@^1.0.0: dependencies: glob "^7.1.2" +tryer@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/tryer/-/tryer-1.0.1.tgz#f2c85406800b9b0f74c9f7465b81eaad241252f8" + integrity sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA== + ts-invariant@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.2.1.tgz#3d587f9d6e3bded97bf9ec17951dd9814d5a9d3f" @@ -14444,6 +14479,25 @@ webidl-conversions@^4.0.2: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg== +webpack-bundle-analyzer@^3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/webpack-bundle-analyzer/-/webpack-bundle-analyzer-3.3.2.tgz#3da733a900f515914e729fcebcd4c40dde71fc6f" + integrity sha512-7qvJLPKB4rRWZGjVp5U1KEjwutbDHSKboAl0IfafnrdXMrgC0tOtZbQD6Rw0u4cmpgRN4O02Fc0t8eAT+FgGzA== + dependencies: + acorn "^6.0.7" + acorn-walk "^6.1.1" + bfj "^6.1.1" + chalk "^2.4.1" + commander "^2.18.0" + ejs "^2.6.1" + express "^4.16.3" + filesize "^3.6.1" + gzip-size "^5.0.0" + lodash "^4.17.10" + mkdirp "^0.5.1" + opener "^1.5.1" + ws "^6.0.0" + webpack-dev-middleware@^3.0.1, webpack-dev-middleware@^3.6.0, webpack-dev-middleware@^3.6.2: version "3.6.2" resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-3.6.2.tgz#f37a27ad7c09cd7dc67cd97655413abaa1f55942" @@ -14836,7 +14890,7 @@ ws@^5.2.0: dependencies: async-limiter "~1.0.0" -ws@^6.1.0: +ws@^6.0.0, ws@^6.1.0: version "6.2.1" resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.1.tgz#442fdf0a47ed64f59b6a5d8ff130f4748ed524fb" integrity sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==