Commit f979da7
fix: remove ~48 transitive dependencies from asset packaging (#1654)
Whenever the CDK Toolkit packages file assets — Lambda function code, S3
file assets and the like — it builds a ZIP archive. That work was
previously done by `archiver`, a dependency that brings roughly fifty
transitive packages along with it into every install of the CDK CLI and
`@aws-cdk/toolkit-lib`. This pull request replaces it with `yazl`, a
focused, write-only ZIP library, which brings the footprint for this
functionality down to just two packages (`yazl` and `buffer-crc32`).
The reason for the change is customer experience. A smaller dependency
graph means a faster `npm install` and a lighter footprint on disk and
in CI for everyone who installs the CLI or builds on the toolkit
library. It also shrinks the set of third-party code that has to be
audited and patched when security advisories are published, which is a
recurring cost for our users. Because the CDK only ever *creates*
archives and never parses untrusted ones, a write-only library is all we
need, so this also drops a large amount of reader and format-handling
code that was never exercised in our use case.
Asset packaging gets a little faster as a side effect. Both libraries
hand compression to Node's native zlib, and in local benchmarks across
representative asset trees `yazl` produced archives 8–11% faster than
`archiver` at comparable memory use. The existing streaming behaviour is
kept, so large assets are still written to disk without buffering the
whole archive in memory.
The change is otherwise invisible to users. Archives stay byte-for-byte
deterministic — entry timestamps remain pinned to the 1980 epoch, so
identical content continues to produce an identical hash — Unix file
modes such as the executable bit are still preserved, and symbolic links
are still followed. The existing unit tests for the zip tool pass
unchanged.
A full benchmark and security report is attached as a separate comment
on this PR.
### Checklist
- [ ] This change contains a major version upgrade for a dependency and
I confirm all breaking changes are addressed
- Release notes for the new version:
---
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache-2.0 license
---------
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>1 parent 078ce70 commit f979da7
20 files changed
Lines changed: 2176 additions & 8126 deletions
File tree
- packages
- @aws-cdk
- cdk-assets-lib
- .projen
- integ-runner
- private-tools
- .projen
- lib/zip
- toolkit-lib
- .projen
- aws-cdk
- .projen
- cdk-assets
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
716 | 716 | | |
717 | 717 | | |
718 | 718 | | |
719 | | - | |
720 | | - | |
| 719 | + | |
| 720 | + | |
721 | 721 | | |
722 | 722 | | |
723 | 723 | | |
| |||
1223 | 1223 | | |
1224 | 1224 | | |
1225 | 1225 | | |
1226 | | - | |
| 1226 | + | |
1227 | 1227 | | |
1228 | 1228 | | |
1229 | 1229 | | |
| |||
1252 | 1252 | | |
1253 | 1253 | | |
1254 | 1254 | | |
1255 | | - | |
| 1255 | + | |
1256 | 1256 | | |
1257 | 1257 | | |
1258 | 1258 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
| 5 | + | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
58 | 58 | | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
| 59 | + | |
| 60 | + | |
65 | 61 | | |
66 | | - | |
| 62 | + | |
67 | 63 | | |
68 | 64 | | |
69 | 65 | | |
| |||
80 | 76 | | |
81 | 77 | | |
82 | 78 | | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
| 79 | + | |
| 80 | + | |
88 | 81 | | |
89 | | - | |
90 | | - | |
91 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
92 | 85 | | |
93 | 86 | | |
94 | | - | |
| 87 | + | |
95 | 88 | | |
96 | 89 | | |
97 | 90 | | |
98 | 91 | | |
99 | 92 | | |
100 | 93 | | |
101 | 94 | | |
102 | | - | |
103 | | - | |
104 | | - | |
| 95 | + | |
| 96 | + | |
105 | 97 | | |
106 | 98 | | |
107 | 99 | | |
108 | 100 | | |
109 | | - | |
| 101 | + | |
110 | 102 | | |
111 | 103 | | |
112 | 104 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments