11ty / eleventy

A simpler site generator. Transforms a directory of templates (of varying types) into HTML.
https://www.11ty.dev/
MIT License
17.12k stars 494 forks source link

Recent canary builds (post canary.21) are pretty big #1885

Closed pdehaan closed 3 years ago

pdehaan commented 3 years ago

Was playing w/ pacote and noticed that the recent canary builds (after canary.21) are 3.8 MB (vs expected ~314 KB). Not sure why they're big yet. I did a git pull on the master branch and then npm pack --dry-run and my local canary.38 build summary says:

npm notice === Tarball Details ===
npm notice name:          @11ty/eleventy
npm notice version:       1.0.0-canary.38
npm notice filename:      11ty-eleventy-1.0.0-canary.38.tgz
npm notice package size:  81.9 kB
npm notice unpacked size: 333.4 kB
npm notice shasum:        37ca62f23a8f9479722184b2bd3c60600627bbc2
npm notice integrity:     sha512-1SY1c61Q73DuX[...]x9QQj8mlNNJqg==
npm notice total files:   77
npm notice
11ty-eleventy-1.0.0-canary.38.tgz

I'll have to see if I can scrape npm's canary.38 and compare it to my local version to see what files are missing/added. Curious indeed. @zachleat, it might be something from your local system (docs) that is sneakily getting bundled into the builds, which I'm not reproducing locally here on a semi-fresh clone.

VERSION DATE NODE VERSION FILE COUNT UNPACKED SIZE
1.0.0-canary.38 2021-06-23 >=12 123 3,897 KB
1.0.0-canary.37 2021-06-18 >=12 121 3,892 KB
1.0.0-canary.36 2021-06-16 >=12 121 3,892 KB
1.0.0-canary.35 2021-06-15 >=12 121 3,891 KB
1.0.0-canary.34 2021-06-15 >=12 121 3,891 KB
1.0.0-canary.33 2021-06-14 >=12 121 3,890 KB
1.0.0-canary.32 2021-06-11 >=12 121 3,889 KB
1.0.0-canary.31 2021-06-10 >=12 121 3,889 KB
1.0.0-canary.30 2021-06-10 >=12 121 3,889 KB
1.0.0-canary.29 2021-06-09 >=12 121 3,888 KB
1.0.0-canary.28 2021-06-09 >=12 121 3,888 KB
1.0.0-canary.27 2021-06-09 >=12 121 3,888 KB
1.0.0-canary.26 2021-06-09 >=12 121 3,888 KB
1.0.0-canary.25 2021-06-09 >=12 121 3,888 KB
1.0.0-canary.24 2021-06-09 >=12 121 3,888 KB
1.0.0-canary.23 2021-05-20 >=12 118 3,872 KB
1.0.0-canary.22 2021-05-17 >=12 119 3,890 KB
1.0.0-canary.21 2021-05-14 >=12 71 314 KB
1.0.0-canary.20 2021-05-04 >=12 71 314 KB
1.0.0-canary.19 2021-05-04 >=12 71 314 KB
1.0.0-canary.18 2021-05-03 >=12 71 314 KB
1.0.0-canary.17 2021-05-03 >=12 71 313 KB
1.0.0-canary.16 2021-04-27 >=12 71 312 KB
1.0.0-canary.15 2021-04-15 >=12 71 310 KB
1.0.0-canary.14 2021-04-11 >=12 71 309 KB
1.0.0-canary.13 2021-04-10 >=12 71 309 KB
1.0.0-canary.12 2021-04-09 >=12 71 309 KB
1.0.0-canary.11 2021-04-09 >=12 71 309 KB
1.0.0-canary.10 2021-02-22 >=10 70 291 KB
1.0.0-canary.9 2021-02-21 >=10 70 291 KB
1.0.0-canary.8 2021-02-20 >=10 70 290 KB
1.0.0-canary.7 2021-02-19 >=10 70 290 KB
1.0.0-canary.6 2021-02-17 >=10 72 286 KB
1.0.0-canary.5 2021-02-17 >=10 72 286 KB
1.0.0-canary.4 2021-02-17 >=10 73 289 KB
1.0.0-canary.3 2021-02-17 >=10 73 289 KB
1.0.0-canary.2 2021-02-10 >=10 72 286 KB
1.0.0-canary.1 2021-02-10 >=10 72 286 KB
0.12.1 2021-03-19 >=10 71 272 KB
0.12.0 2021-03-19 >=8 71 272 KB
0.11.1 2020-10-22 >=8 71 272 KB
0.11.0 2020-05-10 >=8 71 271 KB
pdehaan commented 3 years ago

Actually, I'm using npm@7, so I can use the nifty npm diff trick I learned the other day to debug the difference between two package versions…

npm diff --diff=@11ty/eleventy@1.0.0-canary.21 --diff=@11ty/eleventy@1.0.0-canary.22 --diff-name-only

src/EleventyServe.js
package.json
api-docs/@11ty/eleventy/1.0.0-canary.22/styles/darkstrap.css
api-docs/@11ty/eleventy/1.0.0-canary.22/styles/prettify-tomorrow.css
api-docs/@11ty/eleventy/1.0.0-canary.22/styles/site.cerulean.css
api-docs/@11ty/eleventy/1.0.0-canary.22/styles/site.cosmo.css
api-docs/@11ty/eleventy/1.0.0-canary.22/styles/site.cyborg.css
api-docs/@11ty/eleventy/1.0.0-canary.22/styles/site.darkly.css
api-docs/@11ty/eleventy/1.0.0-canary.22/styles/site.darkstrap.css
api-docs/@11ty/eleventy/1.0.0-canary.22/styles/site.dibs-bootstrap.css
api-docs/@11ty/eleventy/1.0.0-canary.22/styles/site.flatly.css
api-docs/@11ty/eleventy/1.0.0-canary.22/styles/site.journal.css
api-docs/@11ty/eleventy/1.0.0-canary.22/styles/site.lumen.css
api-docs/@11ty/eleventy/1.0.0-canary.22/styles/site.paper.css
api-docs/@11ty/eleventy/1.0.0-canary.22/styles/site.readable.css
api-docs/@11ty/eleventy/1.0.0-canary.22/styles/site.sandstone.css
api-docs/@11ty/eleventy/1.0.0-canary.22/styles/site.simplex.css
api-docs/@11ty/eleventy/1.0.0-canary.22/styles/site.slate.css
api-docs/@11ty/eleventy/1.0.0-canary.22/styles/site.spacelab.css
api-docs/@11ty/eleventy/1.0.0-canary.22/styles/site.superhero.css
api-docs/@11ty/eleventy/1.0.0-canary.22/styles/site.united.css
api-docs/@11ty/eleventy/1.0.0-canary.22/styles/site.yeti.css
api-docs/@11ty/eleventy/1.0.0-canary.22/styles/sunlight.dark.css
api-docs/@11ty/eleventy/1.0.0-canary.22/styles/sunlight.default.css
api-docs/@11ty/eleventy/1.0.0-canary.22/fonts/glyphicons-halflings-regular.eot
api-docs/@11ty/eleventy/1.0.0-canary.22/classes.list.html
api-docs/@11ty/eleventy/1.0.0-canary.22/index.html
api-docs/@11ty/eleventy/1.0.0-canary.22/module-11ty_eleventy_Eleventy-Eleventy.html
api-docs/@11ty/eleventy/1.0.0-canary.22/module-11ty_eleventy_Eleventy.html
api-docs/@11ty/eleventy/1.0.0-canary.22/module-11ty_eleventy_EventBus.html
api-docs/@11ty/eleventy/1.0.0-canary.22/module-11ty_eleventy_TemplateConfig-EleventyConfigError.html
api-docs/@11ty/eleventy/1.0.0-canary.22/module-11ty_eleventy_TemplateConfig-TemplateConfig.html
api-docs/@11ty/eleventy/1.0.0-canary.22/module-11ty_eleventy_TemplateConfig.html
api-docs/@11ty/eleventy/1.0.0-canary.22/modules.list.html
api-docs/@11ty/eleventy/1.0.0-canary.22/scripts/docstrap.lib.js
api-docs/@11ty/eleventy/1.0.0-canary.22/scripts/fulltext-search-ui.js
api-docs/@11ty/eleventy/1.0.0-canary.22/scripts/fulltext-search.js
api-docs/@11ty/eleventy/1.0.0-canary.22/scripts/prettify/jquery.min.js
api-docs/@11ty/eleventy/1.0.0-canary.22/scripts/prettify/lang-css.js
api-docs/@11ty/eleventy/1.0.0-canary.22/scripts/lunr.min.js
api-docs/@11ty/eleventy/1.0.0-canary.22/scripts/prettify/prettify.js
api-docs/@11ty/eleventy/1.0.0-canary.22/scripts/sunlight.js
api-docs/@11ty/eleventy/1.0.0-canary.22/scripts/toc.js
api-docs/@11ty/eleventy/1.0.0-canary.22/img/glyphicons-halflings-white.png
api-docs/@11ty/eleventy/1.0.0-canary.22/img/glyphicons-halflings.png
api-docs/@11ty/eleventy/1.0.0-canary.22/fonts/glyphicons-halflings-regular.svg
api-docs/@11ty/eleventy/1.0.0-canary.22/fonts/glyphicons-halflings-regular.ttf
api-docs/@11ty/eleventy/1.0.0-canary.22/scripts/prettify/Apache-License-2.0.txt
api-docs/@11ty/eleventy/1.0.0-canary.22/fonts/glyphicons-halflings-regular.woff
api-docs/@11ty/eleventy/1.0.0-canary.22/fonts/glyphicons-halflings-regular.woff2

So it looks like the new api-docs (and it's fonts and minified libs) is getting bundled into the builds and we might need to add "api-docs" to the .npmignore file.

Now running npm run doc locally will build the API docs locally and increase the bundle size with roughly 3.6 MB of API documentation:

npm notice === Tarball Details ===
npm notice name:          @11ty/eleventy
npm notice version:       1.0.0-canary.38
npm notice filename:      @11ty/eleventy-1.0.0-canary.38.tgz
npm notice package size:  790.0 kB
npm notice unpacked size: 4.0 MB
npm notice shasum:        b778dfb33a11fd4b80b2927c4ac0fde94b929a12
npm notice integrity:     sha512-PzU14p7lrhKAn[...]5zTBrrclf3NBw==
npm notice total files:   125
npm notice
11ty-eleventy-1.0.0-canary.38.tgz
npm run doc
du -sh api-docs
# 3.6M  api-docs
Ryuno-Ki commented 3 years ago

Alternatively, use the files and explicity put the files to include on an allowlist.

pdehaan commented 3 years ago

I learnt some Bash today! This will log out all the files in the ./api-docs/ folder, sorting them by file size (in descending order). So it looks like we're including around 2.7 MB of CSS files (so it wasn't the fonts causing the bloat like I was originally expecting).

/giphy "the more you know"

ls -ld $(find api-docs -type f) | sort -r | awk '{print $5 "\t" $9}'

348534  api-docs/@11ty/eleventy/1.0.0-canary.38/scripts/docstrap.lib.js
172866  api-docs/@11ty/eleventy/1.0.0-canary.38/styles/site.dibs-bootstrap.css
167516  api-docs/@11ty/eleventy/1.0.0-canary.38/styles/site.paper.css
165118  api-docs/@11ty/eleventy/1.0.0-canary.38/styles/site.slate.css
157135  api-docs/@11ty/eleventy/1.0.0-canary.38/styles/site.lumen.css
154866  api-docs/@11ty/eleventy/1.0.0-canary.38/styles/site.spacelab.css
153783  api-docs/@11ty/eleventy/1.0.0-canary.38/styles/site.yeti.css
153458  api-docs/@11ty/eleventy/1.0.0-canary.38/styles/site.darkly.css
153054  api-docs/@11ty/eleventy/1.0.0-canary.38/styles/site.flatly.css
152640  api-docs/@11ty/eleventy/1.0.0-canary.38/styles/site.superhero.css
152386  api-docs/@11ty/eleventy/1.0.0-canary.38/styles/site.cerulean.css
151980  api-docs/@11ty/eleventy/1.0.0-canary.38/styles/site.simplex.css
150819  api-docs/@11ty/eleventy/1.0.0-canary.38/styles/site.cosmo.css
150758  api-docs/@11ty/eleventy/1.0.0-canary.38/styles/site.cyborg.css
150635  api-docs/@11ty/eleventy/1.0.0-canary.38/styles/site.sandstone.css
149895  api-docs/@11ty/eleventy/1.0.0-canary.38/styles/site.readable.css
149558  api-docs/@11ty/eleventy/1.0.0-canary.38/styles/site.journal.css
147815  api-docs/@11ty/eleventy/1.0.0-canary.38/styles/site.united.css
137683  api-docs/@11ty/eleventy/1.0.0-canary.38/styles/site.darkstrap.css
108738  api-docs/@11ty/eleventy/1.0.0-canary.38/fonts/glyphicons-halflings-regular.svg
83095   api-docs/@11ty/eleventy/1.0.0-canary.38/scripts/prettify/jquery.min.js
45404   api-docs/@11ty/eleventy/1.0.0-canary.38/fonts/glyphicons-halflings-regular.ttf
35095   api-docs/@11ty/eleventy/1.0.0-canary.38/module-11ty_eleventy_Eleventy-Eleventy.html
33618   api-docs/@11ty/eleventy/1.0.0-canary.38/scripts/sunlight.js
23733   api-docs/@11ty/eleventy/1.0.0-canary.38/styles/darkstrap.css
23424   api-docs/@11ty/eleventy/1.0.0-canary.38/fonts/glyphicons-halflings-regular.woff
20127   api-docs/@11ty/eleventy/1.0.0-canary.38/fonts/glyphicons-halflings-regular.eot
18732   api-docs/@11ty/eleventy/1.0.0-canary.38/scripts/prettify/prettify.js
18028   api-docs/@11ty/eleventy/1.0.0-canary.38/fonts/glyphicons-halflings-regular.woff2
17523   api-docs/@11ty/eleventy/1.0.0-canary.38/module-11ty_eleventy_TemplateConfig-TemplateConfig.html
15426   api-docs/@11ty/eleventy/1.0.0-canary.38/scripts/lunr.min.js
12799   api-docs/@11ty/eleventy/1.0.0-canary.38/img/glyphicons-halflings.png
11358   api-docs/@11ty/eleventy/1.0.0-canary.38/scripts/prettify/Apache-License-2.0.txt
8777    api-docs/@11ty/eleventy/1.0.0-canary.38/img/glyphicons-halflings-white.png
8306    api-docs/@11ty/eleventy/1.0.0-canary.38/styles/sunlight.dark.css
8173    api-docs/@11ty/eleventy/1.0.0-canary.38/styles/sunlight.default.css
7652    api-docs/@11ty/eleventy/1.0.0-canary.38/index.html
5794    api-docs/@11ty/eleventy/1.0.0-canary.38/scripts/toc.js
5100    api-docs/@11ty/eleventy/1.0.0-canary.38/module-11ty_eleventy_EventBus.html
5028    api-docs/@11ty/eleventy/1.0.0-canary.38/module-11ty_eleventy_TemplateConfig-EleventyConfigError.html
5011    api-docs/@11ty/eleventy/1.0.0-canary.38/modules.list.html
5011    api-docs/@11ty/eleventy/1.0.0-canary.38/classes.list.html
4900    api-docs/@11ty/eleventy/1.0.0-canary.38/module-11ty_eleventy_TemplateConfig.html
4723    api-docs/@11ty/eleventy/1.0.0-canary.38/module-11ty_eleventy_Eleventy.html
2845    api-docs/@11ty/eleventy/1.0.0-canary.38/scripts/fulltext-search-ui.js
2018    api-docs/@11ty/eleventy/1.0.0-canary.38/styles/prettify-tomorrow.css
980     api-docs/@11ty/eleventy/1.0.0-canary.38/scripts/fulltext-search.js
932     api-docs/@11ty/eleventy/1.0.0-canary.38/scripts/prettify/lang-css.js
ls -lash api-docs/@11ty/eleventy/1.0.0-canary.38/styles | grep -E "site\..*?\.css" | awk '{print $6 "\t" $10}'

149K    site.cerulean.css
147K    site.cosmo.css
147K    site.cyborg.css
150K    site.darkly.css
134K    site.darkstrap.css
169K    site.dibs-bootstrap.css
149K    site.flatly.css
146K    site.journal.css
153K    site.lumen.css
164K    site.paper.css
146K    site.readable.css
147K    site.sandstone.css
148K    site.simplex.css
161K    site.slate.css
151K    site.spacelab.css
149K    site.superhero.css
144K    site.united.css
150K    site.yeti.css
Ryuno-Ki commented 3 years ago

I'm confused.

api-docs is generated via JSDoc: https://github.com/11ty/eleventy/blob/36713b3af81b08530fac532ceef24f5dde8acb36/package.json#L45 (introduced by me like two years ago). cosmo is the default theme.

It is on .gitignore. I can't imagine, that the version bump caused the spike: https://github.com/11ty/eleventy/compare/v1.0.0-canary.21...v1.0.0-canary.22

pdehaan commented 3 years ago

:shrug: Maybe @zachleat always purged the local API documentation before deploying to npm previously.

I only know what npm tells me. Although I could try a clean folder and doing npm i @11ty/eleventy@canary and confirming which files are bundled. I didn't think this would possibly be Eleventy Serverless related. This all seems very npm specific, which is why I was suspecting it being related to something on his local machine making its way into the bundles.

Ryuno-Ki commented 3 years ago

So … perhaps it's worth to let CI create the builds and publish it? Can GitHub Actions do that?

zachleat commented 3 years ago

I realize this is probably going to be contentious but in the interest of time and maintenance ease for me I’m going to remove the jsdoc stuff, at least for now. ink-docstrap has some npm audit violations and hasn’t had a release in 4 years https://www.npmjs.com/package/ink-docstrap

We can reinvestigate something a bit more integrated with 11ty.dev a bit later if there is enough demand for it! (sorry @Ryuno-Ki!)

This will also solve https://github.com/11ty/eleventy/issues/1785 Related: #1375

zachleat commented 3 years ago

To answer the previous comments, I’m guessing between the 1.0.0-canary.21 and 1.0.0-canary.22 is when I ran the jsdoc command locally to generate those files (as part of the investigation into https://github.com/11ty/eleventy/issues/1785)

Ryuno-Ki commented 3 years ago

Would you still accept PRs to add more JSDoc strings? (and go with JSDoc's default theme)

zachleat commented 3 years ago

Yeah for sure!

zachleat commented 11 months ago

Re-added the jsdoc command in #3060