Commit 72a1d3c
authored
perf: don't bundle
Uses new implementations of `createStorageContentSignature` and
`createHmacSignature` from `@apify/utilities`.
Those native WebCrypto API instead of importing the `node:crypto`
package, so we can mark `crypto` as external in the browser bundler and
cut the bundle size ~2.4 times (both plain and compressed).
|before (`master`)|after (`perf/use-native-crypto`)|
|---|---|
|<img width="362" height="195" alt="image"
src="https://github.com/user-attachments/assets/1ae1b104-2c6a-42e3-bfda-e6d63f29d1b0"
/> | <img width="362" height="195" alt="image"
src="https://github.com/user-attachments/assets/246a1ae4-0ace-4fd5-aed7-34639ff989e9"
/> |
**Note:** `SubtleCrypto` API in browsers is only available in [Secure
Contexts](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).
This should be fairly safe (as any `https://`-served page is one, as
well as `localhost`).
Related to #753node:crypto in the browser bundle (#782)1 parent cf3486e commit 72a1d3c
File tree
8 files changed
+43
-13
lines changed- src/resource_clients
- test
8 files changed
+43
-13
lines changedSome 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 | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
| 207 | + | |
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
406 | 407 | | |
407 | 408 | | |
408 | 409 | | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
409 | 413 | | |
410 | 414 | | |
411 | 415 | | |
| |||
415 | 419 | | |
416 | 420 | | |
417 | 421 | | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
418 | 425 | | |
419 | 426 | | |
420 | 427 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
619 | 620 | | |
620 | 621 | | |
621 | 622 | | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
622 | 629 | | |
623 | 630 | | |
624 | 631 | | |
| |||
629 | 636 | | |
630 | 637 | | |
631 | 638 | | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
632 | 645 | | |
633 | 646 | | |
634 | 647 | | |
| |||
659 | 672 | | |
660 | 673 | | |
661 | 674 | | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
662 | 678 | | |
663 | 679 | | |
664 | 680 | | |
| |||
668 | 684 | | |
669 | 685 | | |
670 | 686 | | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
671 | 690 | | |
672 | 691 | | |
673 | 692 | | |
| |||
0 commit comments