@atlaspack/bundler-default 2.14.5-canary.19 → 2.14.5-canary.191
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +384 -0
- package/lib/DefaultBundler.js +6 -1
- package/lib/MonolithicBundler.js +11 -3
- package/lib/bundleMerge.js +106 -37
- package/lib/bundlerConfig.js +51 -5
- package/lib/decorateLegacyGraph.js +24 -3
- package/lib/idealGraph.js +426 -50
- package/lib/memoize.js +39 -0
- package/lib/stats.js +85 -0
- package/lib/types/DefaultBundler.d.ts +18 -0
- package/lib/types/MonolithicBundler.d.ts +2 -0
- package/lib/types/bundleMerge.d.ts +9 -0
- package/lib/types/bundlerConfig.d.ts +36 -0
- package/lib/types/decorateLegacyGraph.d.ts +3 -0
- package/lib/types/idealGraph.d.ts +40 -0
- package/lib/types/memoize.d.ts +2 -0
- package/lib/types/stats.d.ts +16 -0
- package/package.json +21 -12
- package/src/{DefaultBundler.js → DefaultBundler.ts} +21 -6
- package/src/{MonolithicBundler.js → MonolithicBundler.ts} +17 -5
- package/src/bundleMerge.ts +250 -0
- package/src/{bundlerConfig.js → bundlerConfig.ts} +105 -44
- package/src/{decorateLegacyGraph.js → decorateLegacyGraph.ts} +26 -7
- package/src/{idealGraph.js → idealGraph.ts} +669 -102
- package/src/memoize.ts +32 -0
- package/src/stats.ts +97 -0
- package/tsconfig.json +4 -0
- package/src/bundleMerge.js +0 -103
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,389 @@
|
|
|
1
1
|
# @atlaspack/bundler-default
|
|
2
2
|
|
|
3
|
+
## 3.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`830261d`](https://github.com/atlassian-labs/atlaspack/commit/830261dcf4a40293090b61cab52fd75d5683c73f), [`53dd47b`](https://github.com/atlassian-labs/atlaspack/commit/53dd47bd6d23cd47f87297347f03a609ab38a03d)]:
|
|
8
|
+
- @atlaspack/feature-flags@2.24.1
|
|
9
|
+
- @atlaspack/rust@3.7.0
|
|
10
|
+
- @atlaspack/graph@3.5.18
|
|
11
|
+
- @atlaspack/types-internal@2.19.5
|
|
12
|
+
- @atlaspack/utils@2.19.1
|
|
13
|
+
- @atlaspack/plugin@2.14.29
|
|
14
|
+
|
|
15
|
+
## 3.4.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [#753](https://github.com/atlassian-labs/atlaspack/pull/753) [`f0349a6`](https://github.com/atlassian-labs/atlaspack/commit/f0349a6b9b04755088f121095ca6301a2ada3767) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Add configurable async bundle merging and redundant shared bundle removal behind a feature flag.
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [#761](https://github.com/atlassian-labs/atlaspack/pull/761) [`8843980`](https://github.com/atlassian-labs/atlaspack/commit/88439807be20025fd3433380204ff1205079729e) Thanks [@marcins](https://github.com/marcins)! - Adds a new feature flag `singleFileOutputStableName` - when enabled, bundles produced by the experimental single file output bundler will have stable names (i.e. no hash).
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [[`f0349a6`](https://github.com/atlassian-labs/atlaspack/commit/f0349a6b9b04755088f121095ca6301a2ada3767), [`a5081c3`](https://github.com/atlassian-labs/atlaspack/commit/a5081c3f9207d28716ee4edd3841de1830ea4b80), [`f930003`](https://github.com/atlassian-labs/atlaspack/commit/f930003364fdc31e5487520ebe256f1a9389f579), [`f930003`](https://github.com/atlassian-labs/atlaspack/commit/f930003364fdc31e5487520ebe256f1a9389f579), [`8843980`](https://github.com/atlassian-labs/atlaspack/commit/88439807be20025fd3433380204ff1205079729e)]:
|
|
26
|
+
- @atlaspack/feature-flags@2.24.0
|
|
27
|
+
- @atlaspack/utils@2.19.0
|
|
28
|
+
- @atlaspack/graph@3.5.17
|
|
29
|
+
- @atlaspack/types-internal@2.19.4
|
|
30
|
+
- @atlaspack/plugin@2.14.28
|
|
31
|
+
|
|
32
|
+
## 3.3.4
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- Updated dependencies [[`3cfb7cf`](https://github.com/atlassian-labs/atlaspack/commit/3cfb7cfd90b78a5c48ce717e779ff789769825a3)]:
|
|
37
|
+
- @atlaspack/feature-flags@2.23.2
|
|
38
|
+
- @atlaspack/rust@3.6.2
|
|
39
|
+
- @atlaspack/graph@3.5.16
|
|
40
|
+
- @atlaspack/types-internal@2.19.3
|
|
41
|
+
- @atlaspack/utils@2.18.4
|
|
42
|
+
- @atlaspack/plugin@2.14.27
|
|
43
|
+
|
|
44
|
+
## 3.3.3
|
|
45
|
+
|
|
46
|
+
### Patch Changes
|
|
47
|
+
|
|
48
|
+
- [#742](https://github.com/atlassian-labs/atlaspack/pull/742) [`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd) Thanks [@yamadapc](https://github.com/yamadapc)! - Internal changes and bug fixes to environmentDeduplication flag
|
|
49
|
+
|
|
50
|
+
- Updated dependencies [[`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd), [`889c65c`](https://github.com/atlassian-labs/atlaspack/commit/889c65cd25b811045e26a117e7404f694dde77a2)]:
|
|
51
|
+
- @atlaspack/types-internal@2.19.2
|
|
52
|
+
- @atlaspack/feature-flags@2.23.1
|
|
53
|
+
- @atlaspack/diagnostic@2.14.3
|
|
54
|
+
- @atlaspack/plugin@2.14.26
|
|
55
|
+
- @atlaspack/graph@3.5.15
|
|
56
|
+
- @atlaspack/utils@2.18.3
|
|
57
|
+
- @atlaspack/rust@3.6.1
|
|
58
|
+
|
|
59
|
+
## 3.3.2
|
|
60
|
+
|
|
61
|
+
### Patch Changes
|
|
62
|
+
|
|
63
|
+
- Updated dependencies [[`f6b3f22`](https://github.com/atlassian-labs/atlaspack/commit/f6b3f2276c7e417580b49c4879563aab51f156b1)]:
|
|
64
|
+
- @atlaspack/feature-flags@2.23.0
|
|
65
|
+
- @atlaspack/graph@3.5.14
|
|
66
|
+
- @atlaspack/types-internal@2.19.1
|
|
67
|
+
- @atlaspack/utils@2.18.2
|
|
68
|
+
- @atlaspack/plugin@2.14.25
|
|
69
|
+
|
|
70
|
+
## 3.3.1
|
|
71
|
+
|
|
72
|
+
### Patch Changes
|
|
73
|
+
|
|
74
|
+
- Updated dependencies [[`ad26146`](https://github.com/atlassian-labs/atlaspack/commit/ad26146f13b4c1cc65d4a0f9c67060b90ef14ff3), [`f1b48e7`](https://github.com/atlassian-labs/atlaspack/commit/f1b48e7a04e005cef0f36a3e692087a9ecdb6f7a), [`7f5841c`](https://github.com/atlassian-labs/atlaspack/commit/7f5841c39df049f9546cccbeea2a7337e0337b45), [`73dd7ba`](https://github.com/atlassian-labs/atlaspack/commit/73dd7baab69456ef2f6e4a0cc7dbb04f407eb148)]:
|
|
75
|
+
- @atlaspack/rust@3.6.0
|
|
76
|
+
- @atlaspack/types-internal@2.19.0
|
|
77
|
+
- @atlaspack/feature-flags@2.22.0
|
|
78
|
+
- @atlaspack/utils@2.18.1
|
|
79
|
+
- @atlaspack/graph@3.5.13
|
|
80
|
+
- @atlaspack/plugin@2.14.24
|
|
81
|
+
|
|
82
|
+
## 3.3.0
|
|
83
|
+
|
|
84
|
+
### Minor Changes
|
|
85
|
+
|
|
86
|
+
- [#731](https://github.com/atlassian-labs/atlaspack/pull/731) [`23d561e`](https://github.com/atlassian-labs/atlaspack/commit/23d561e51e68b0c38fd1ff4e4fb173e5e7b01cf2) Thanks [@marcins](https://github.com/marcins)! - Implement "inline isolated" scripts
|
|
87
|
+
|
|
88
|
+
### Patch Changes
|
|
89
|
+
|
|
90
|
+
- Updated dependencies [[`23d561e`](https://github.com/atlassian-labs/atlaspack/commit/23d561e51e68b0c38fd1ff4e4fb173e5e7b01cf2)]:
|
|
91
|
+
- @atlaspack/feature-flags@2.21.0
|
|
92
|
+
- @atlaspack/utils@2.18.0
|
|
93
|
+
- @atlaspack/rust@3.5.0
|
|
94
|
+
- @atlaspack/graph@3.5.12
|
|
95
|
+
- @atlaspack/plugin@2.14.23
|
|
96
|
+
|
|
97
|
+
## 3.2.1
|
|
98
|
+
|
|
99
|
+
### Patch Changes
|
|
100
|
+
|
|
101
|
+
- [#720](https://github.com/atlassian-labs/atlaspack/pull/720) [`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94) Thanks [@alshdavid](https://github.com/alshdavid)! - Migrate to TypeScript
|
|
102
|
+
|
|
103
|
+
- Updated dependencies [[`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94), [`12bee0e`](https://github.com/atlassian-labs/atlaspack/commit/12bee0e23f0464d7f6bd3e24fbe0d19c126d587d)]:
|
|
104
|
+
- @atlaspack/feature-flags@2.20.1
|
|
105
|
+
- @atlaspack/diagnostic@2.14.2
|
|
106
|
+
- @atlaspack/plugin@2.14.22
|
|
107
|
+
- @atlaspack/graph@3.5.11
|
|
108
|
+
- @atlaspack/utils@2.17.4
|
|
109
|
+
- @atlaspack/rust@3.4.2
|
|
110
|
+
|
|
111
|
+
## 3.2.0
|
|
112
|
+
|
|
113
|
+
### Minor Changes
|
|
114
|
+
|
|
115
|
+
- [#721](https://github.com/atlassian-labs/atlaspack/pull/721) [`069de47`](https://github.com/atlassian-labs/atlaspack/commit/069de478e64fb5889f6f2ce023eb510782767fbd) Thanks [@benjervis](https://github.com/benjervis)! - Add support for bundle merging based on `webpackChunkName` comments.
|
|
116
|
+
|
|
117
|
+
Adding a `webpackChunkName` comment to an import will allow the bundler to merge multiple imports into a single bundle.
|
|
118
|
+
|
|
119
|
+
e.g.:
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
import(/* webpackChunkName: "my-chunk" */ './my-module');
|
|
123
|
+
import(/* webpackChunkName: "my-chunk" */ './another-module');
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
This can be enabled with the feature flag `supportWebpackChunkName`.
|
|
127
|
+
|
|
128
|
+
### Patch Changes
|
|
129
|
+
|
|
130
|
+
- Updated dependencies [[`069de47`](https://github.com/atlassian-labs/atlaspack/commit/069de478e64fb5889f6f2ce023eb510782767fbd)]:
|
|
131
|
+
- @atlaspack/feature-flags@2.20.0
|
|
132
|
+
- @atlaspack/graph@3.5.10
|
|
133
|
+
- @atlaspack/utils@2.17.3
|
|
134
|
+
- @atlaspack/plugin@2.14.21
|
|
135
|
+
|
|
136
|
+
## 3.1.2
|
|
137
|
+
|
|
138
|
+
### Patch Changes
|
|
139
|
+
|
|
140
|
+
- [#702](https://github.com/atlassian-labs/atlaspack/pull/702) [`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa) Thanks [@alshdavid](https://github.com/alshdavid)! - Fixes to Flow types
|
|
141
|
+
|
|
142
|
+
- Updated dependencies [[`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa), [`1c7865a`](https://github.com/atlassian-labs/atlaspack/commit/1c7865a64451116d94015e248302435839d347c0), [`a0b959f`](https://github.com/atlassian-labs/atlaspack/commit/a0b959fbf61fc3f820ff03c7e8988945fe40a91a)]:
|
|
143
|
+
- @atlaspack/plugin@2.14.20
|
|
144
|
+
- @atlaspack/feature-flags@2.19.2
|
|
145
|
+
- @atlaspack/graph@3.5.9
|
|
146
|
+
- @atlaspack/utils@2.17.2
|
|
147
|
+
|
|
148
|
+
## 3.1.1
|
|
149
|
+
|
|
150
|
+
### Patch Changes
|
|
151
|
+
|
|
152
|
+
- Updated dependencies [[`13aef17`](https://github.com/atlassian-labs/atlaspack/commit/13aef177eea289a6e40d2113b5ec1ac9be18a33d)]:
|
|
153
|
+
- @atlaspack/feature-flags@2.19.1
|
|
154
|
+
- @atlaspack/graph@3.5.8
|
|
155
|
+
- @atlaspack/utils@2.17.1
|
|
156
|
+
- @atlaspack/plugin@2.14.19
|
|
157
|
+
|
|
158
|
+
## 3.1.0
|
|
159
|
+
|
|
160
|
+
### Minor Changes
|
|
161
|
+
|
|
162
|
+
- [#640](https://github.com/atlassian-labs/atlaspack/pull/640) [`dbb4072`](https://github.com/atlassian-labs/atlaspack/commit/dbb40721ebeb45990a14ba04e6b44e7f836fb32d) Thanks [@JakeLane](https://github.com/JakeLane)! - Clean up conditional bundling feature flags
|
|
163
|
+
|
|
164
|
+
### Patch Changes
|
|
165
|
+
|
|
166
|
+
- Updated dependencies [[`dbb4072`](https://github.com/atlassian-labs/atlaspack/commit/dbb40721ebeb45990a14ba04e6b44e7f836fb32d), [`becf977`](https://github.com/atlassian-labs/atlaspack/commit/becf977f625d5ee46dae3d4c679f173bf5f40cc0), [`becf977`](https://github.com/atlassian-labs/atlaspack/commit/becf977f625d5ee46dae3d4c679f173bf5f40cc0), [`c4415a4`](https://github.com/atlassian-labs/atlaspack/commit/c4415a455543d984ca28452c2cb87a794d22497c), [`f0f7c71`](https://github.com/atlassian-labs/atlaspack/commit/f0f7c7168a1d3d18c6f30d2daed611275692b7c5), [`de23e0c`](https://github.com/atlassian-labs/atlaspack/commit/de23e0ce49d5504fe3947ac26640a3d951087da3), [`18a57cf`](https://github.com/atlassian-labs/atlaspack/commit/18a57cf8a4789b2de5ad8e2676f317a26cc91417), [`a5ed1b4`](https://github.com/atlassian-labs/atlaspack/commit/a5ed1b414498560f393ff491af4da25b6e8dde56)]:
|
|
167
|
+
- @atlaspack/feature-flags@2.19.0
|
|
168
|
+
- @atlaspack/utils@2.17.0
|
|
169
|
+
- @atlaspack/rust@3.4.1
|
|
170
|
+
- @atlaspack/graph@3.5.7
|
|
171
|
+
- @atlaspack/plugin@2.14.18
|
|
172
|
+
|
|
173
|
+
## 3.0.8
|
|
174
|
+
|
|
175
|
+
### Patch Changes
|
|
176
|
+
|
|
177
|
+
- Updated dependencies [[`c75bf55`](https://github.com/atlassian-labs/atlaspack/commit/c75bf553fff4decc285b5fd499a275853b18f8f2)]:
|
|
178
|
+
- @atlaspack/rust@3.4.0
|
|
179
|
+
- @atlaspack/utils@2.16.1
|
|
180
|
+
- @atlaspack/plugin@2.14.17
|
|
181
|
+
|
|
182
|
+
## 3.0.7
|
|
183
|
+
|
|
184
|
+
### Patch Changes
|
|
185
|
+
|
|
186
|
+
- Updated dependencies [[`e8a60ff`](https://github.com/atlassian-labs/atlaspack/commit/e8a60ffbea41caef265786bbf73349771760081c), [`30ee2cf`](https://github.com/atlassian-labs/atlaspack/commit/30ee2cfcd34cf2646ded0eda13fdb80a2a5de529)]:
|
|
187
|
+
- @atlaspack/feature-flags@2.18.4
|
|
188
|
+
- @atlaspack/utils@2.16.0
|
|
189
|
+
- @atlaspack/graph@3.5.6
|
|
190
|
+
- @atlaspack/plugin@2.14.16
|
|
191
|
+
|
|
192
|
+
## 3.0.6
|
|
193
|
+
|
|
194
|
+
### Patch Changes
|
|
195
|
+
|
|
196
|
+
- Updated dependencies [[`5ded263`](https://github.com/atlassian-labs/atlaspack/commit/5ded263c7f11b866e8885b81c73e20dd060b25be)]:
|
|
197
|
+
- @atlaspack/feature-flags@2.18.3
|
|
198
|
+
- @atlaspack/graph@3.5.5
|
|
199
|
+
- @atlaspack/utils@2.15.3
|
|
200
|
+
- @atlaspack/plugin@2.14.15
|
|
201
|
+
|
|
202
|
+
## 3.0.5
|
|
203
|
+
|
|
204
|
+
### Patch Changes
|
|
205
|
+
|
|
206
|
+
- Updated dependencies [[`644b157`](https://github.com/atlassian-labs/atlaspack/commit/644b157dee72a871acc2d0facf0b87b8eea51956)]:
|
|
207
|
+
- @atlaspack/feature-flags@2.18.2
|
|
208
|
+
- @atlaspack/graph@3.5.4
|
|
209
|
+
- @atlaspack/utils@2.15.2
|
|
210
|
+
- @atlaspack/plugin@2.14.14
|
|
211
|
+
|
|
212
|
+
## 3.0.4
|
|
213
|
+
|
|
214
|
+
### Patch Changes
|
|
215
|
+
|
|
216
|
+
- Updated dependencies [[`26aa9c5`](https://github.com/atlassian-labs/atlaspack/commit/26aa9c599d2be45ce1438a74c5fa22f39b9b554b), [`0501255`](https://github.com/atlassian-labs/atlaspack/commit/05012550da35b05ce7d356a8cc29311e7f9afdca)]:
|
|
217
|
+
- @atlaspack/feature-flags@2.18.1
|
|
218
|
+
- @atlaspack/utils@2.15.1
|
|
219
|
+
- @atlaspack/graph@3.5.3
|
|
220
|
+
- @atlaspack/plugin@2.14.13
|
|
221
|
+
|
|
222
|
+
## 3.0.3
|
|
223
|
+
|
|
224
|
+
### Patch Changes
|
|
225
|
+
|
|
226
|
+
- [#622](https://github.com/atlassian-labs/atlaspack/pull/622) [`e39c6cf`](https://github.com/atlassian-labs/atlaspack/commit/e39c6cf05f7e95ce5420dbcea66f401b1cbd397c) Thanks [@benjervis](https://github.com/benjervis)! - Change the overlap calculation system in findMergeCandidates to improve performance
|
|
227
|
+
|
|
228
|
+
- Updated dependencies [[`10fbcfb`](https://github.com/atlassian-labs/atlaspack/commit/10fbcfbfa49c7a83da5d7c40983e36e87f524a75), [`85c52d3`](https://github.com/atlassian-labs/atlaspack/commit/85c52d3f7717b3c84a118d18ab98cfbfd71dcbd2), [`e39c6cf`](https://github.com/atlassian-labs/atlaspack/commit/e39c6cf05f7e95ce5420dbcea66f401b1cbd397c)]:
|
|
229
|
+
- @atlaspack/feature-flags@2.18.0
|
|
230
|
+
- @atlaspack/utils@2.15.0
|
|
231
|
+
- @atlaspack/graph@3.5.2
|
|
232
|
+
- @atlaspack/plugin@2.14.12
|
|
233
|
+
|
|
234
|
+
## 3.0.2
|
|
235
|
+
|
|
236
|
+
### Patch Changes
|
|
237
|
+
|
|
238
|
+
- [#613](https://github.com/atlassian-labs/atlaspack/pull/613) [`4ca19d8`](https://github.com/atlassian-labs/atlaspack/commit/4ca19d8060dfcd279183e4039f2ecb43334ac44c) Thanks [@marcins](https://github.com/marcins)! - Ensure that constant modules are correctly included in MSBs even if they wouldn't otherwise be.
|
|
239
|
+
|
|
240
|
+
- Updated dependencies [[`73ea3c4`](https://github.com/atlassian-labs/atlaspack/commit/73ea3c4d85d4401fdd15abcbf988237e890e7ad3), [`b1b3693`](https://github.com/atlassian-labs/atlaspack/commit/b1b369317c66f8a431c170df2ebba4fa5b2e38ef)]:
|
|
241
|
+
- @atlaspack/feature-flags@2.17.0
|
|
242
|
+
- @atlaspack/graph@3.5.1
|
|
243
|
+
- @atlaspack/utils@2.14.11
|
|
244
|
+
- @atlaspack/plugin@2.14.11
|
|
245
|
+
|
|
246
|
+
## 3.0.1
|
|
247
|
+
|
|
248
|
+
### Patch Changes
|
|
249
|
+
|
|
250
|
+
- [#608](https://github.com/atlassian-labs/atlaspack/pull/608) [`471b99e`](https://github.com/atlassian-labs/atlaspack/commit/471b99e41b4d97328c88f65e90bea284372cb1b0) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Fix require of ES Module error
|
|
251
|
+
|
|
252
|
+
## 3.0.0
|
|
253
|
+
|
|
254
|
+
### Major Changes
|
|
255
|
+
|
|
256
|
+
- [#600](https://github.com/atlassian-labs/atlaspack/pull/600) [`1b52b99`](https://github.com/atlassian-labs/atlaspack/commit/1b52b99db4298b04c1a6eb0f97994d75a2d436f9) Thanks [@mattcompiles](https://github.com/mattcompiles)! - ### Breaking change
|
|
257
|
+
|
|
258
|
+
This new config replaces the previously released `sharedBundleMergeThreshold`.
|
|
259
|
+
|
|
260
|
+
The following options are available for each merge group.
|
|
261
|
+
|
|
262
|
+
### Options
|
|
263
|
+
|
|
264
|
+
#### overlapThreshold
|
|
265
|
+
|
|
266
|
+
> The same as `sharedBundleMergeThreshold` from #535
|
|
267
|
+
|
|
268
|
+
Merge bundles share a percentage of source bundles
|
|
269
|
+
|
|
270
|
+
```json
|
|
271
|
+
"@atlaspack/bundler-default": {
|
|
272
|
+
"sharedBundleMerge": [{
|
|
273
|
+
"overlapThreshold": 0.75
|
|
274
|
+
}]
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
#### maxBundleSize
|
|
279
|
+
|
|
280
|
+
Merge bundles that are smaller than a configured amount of bytes.
|
|
281
|
+
|
|
282
|
+
> Keep in mind these bytes are pre-optimisation
|
|
283
|
+
|
|
284
|
+
```json
|
|
285
|
+
"@atlaspack/bundler-default": {
|
|
286
|
+
"sharedBundleMerge": [{
|
|
287
|
+
"maxBundleSize": 20000
|
|
288
|
+
}]
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
#### sourceBundles
|
|
293
|
+
|
|
294
|
+
Merge bundles that share a set of source bundles. The matching is relative to the project root, like how manual shared bundle roots work.
|
|
295
|
+
|
|
296
|
+
```json
|
|
297
|
+
"@atlaspack/bundler-default": {
|
|
298
|
+
"sharedBundleMerge": [{
|
|
299
|
+
"sourceBundles": ["src/important-route", "src/important-route-2"]
|
|
300
|
+
}]
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
#### minBundlesInGroup
|
|
305
|
+
|
|
306
|
+
Merge bundles that belong to a bundle group that's larger than a set amount. This is useful for targetting bundles that would be deleted by the `maxParallelRequests` option.
|
|
307
|
+
|
|
308
|
+
```json
|
|
309
|
+
"@atlaspack/bundler-default": {
|
|
310
|
+
"maxParallelRequests": 30,
|
|
311
|
+
"sharedBundleMerge": [{
|
|
312
|
+
"minBundlesInGroup": 30
|
|
313
|
+
}]
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
## Combining options
|
|
318
|
+
|
|
319
|
+
When multiple options are provided, all must be true for a merge to be relevant.
|
|
320
|
+
|
|
321
|
+
For example, merge bundles that are smaller than 20kb and share at least 50% of the same source bundles.
|
|
322
|
+
|
|
323
|
+
```json
|
|
324
|
+
"@atlaspack/bundler-default": {
|
|
325
|
+
"sharedBundleMerge": [{
|
|
326
|
+
"overlapThreshold": 0.5,
|
|
327
|
+
"maxBundleSize": 20000
|
|
328
|
+
}]
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
## Multiple merges
|
|
333
|
+
|
|
334
|
+
You can also have multiple merge configs.
|
|
335
|
+
|
|
336
|
+
```json
|
|
337
|
+
"@atlaspack/bundler-default": {
|
|
338
|
+
"sharedBundleMerge": [
|
|
339
|
+
{
|
|
340
|
+
"overlapThreshold": 0.75,
|
|
341
|
+
"maxBundleSize": 20000
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"minBundlesInGroup": 30
|
|
345
|
+
"sourceBundles": ["src/important-route", "src/important-route-2"]
|
|
346
|
+
}
|
|
347
|
+
]
|
|
348
|
+
}
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### Patch Changes
|
|
352
|
+
|
|
353
|
+
- Updated dependencies [[`1b52b99`](https://github.com/atlassian-labs/atlaspack/commit/1b52b99db4298b04c1a6eb0f97994d75a2d436f9)]:
|
|
354
|
+
- @atlaspack/graph@3.5.0
|
|
355
|
+
|
|
356
|
+
## 2.16.3
|
|
357
|
+
|
|
358
|
+
### Patch Changes
|
|
359
|
+
|
|
360
|
+
- Updated dependencies [[`35fdd4b`](https://github.com/atlassian-labs/atlaspack/commit/35fdd4b52da0af20f74667f7b8adfb2f90279b7c), [`6dd4ccb`](https://github.com/atlassian-labs/atlaspack/commit/6dd4ccb753541de32322d881f973d571dd57e4ca)]:
|
|
361
|
+
- @atlaspack/rust@3.3.5
|
|
362
|
+
- @atlaspack/plugin@2.14.10
|
|
363
|
+
- @atlaspack/utils@2.14.10
|
|
364
|
+
|
|
365
|
+
## 2.16.2
|
|
366
|
+
|
|
367
|
+
### Patch Changes
|
|
368
|
+
|
|
369
|
+
- Updated dependencies [[`124b7ff`](https://github.com/atlassian-labs/atlaspack/commit/124b7fff44f71aac9fbad289a9a9509b3dfc9aaa), [`e052521`](https://github.com/atlassian-labs/atlaspack/commit/e0525210850ed1606146eb86991049cf567c5dec), [`15c6d70`](https://github.com/atlassian-labs/atlaspack/commit/15c6d7000bd89da876bc590aa75b17a619a41896), [`e4d966c`](https://github.com/atlassian-labs/atlaspack/commit/e4d966c3c9c4292c5013372ae65b10d19d4bacc6), [`209692f`](https://github.com/atlassian-labs/atlaspack/commit/209692ffb11eae103a0d65c5e1118a5aa1625818), [`42a775d`](https://github.com/atlassian-labs/atlaspack/commit/42a775de8eec638ad188f3271964170d8c04d84b), [`29c2f10`](https://github.com/atlassian-labs/atlaspack/commit/29c2f106de9679adfb5afa04e1910471dc65a427), [`f4da1e1`](https://github.com/atlassian-labs/atlaspack/commit/f4da1e120e73eeb5e8b8927f05e88f04d6148c7b), [`1ef91fc`](https://github.com/atlassian-labs/atlaspack/commit/1ef91fcc863fdd2831511937083dbbc1263b3d9d)]:
|
|
370
|
+
- @atlaspack/rust@3.3.4
|
|
371
|
+
- @atlaspack/feature-flags@2.16.0
|
|
372
|
+
- @atlaspack/utils@2.14.9
|
|
373
|
+
- @atlaspack/graph@3.4.7
|
|
374
|
+
- @atlaspack/plugin@2.14.9
|
|
375
|
+
|
|
376
|
+
## 2.16.1
|
|
377
|
+
|
|
378
|
+
### Patch Changes
|
|
379
|
+
|
|
380
|
+
- Updated dependencies [[`30f6017`](https://github.com/atlassian-labs/atlaspack/commit/30f60175ba4d272c5fc193973c63bc298584775b), [`1ab0a27`](https://github.com/atlassian-labs/atlaspack/commit/1ab0a275aeca40350415e2b03e7440d1dddc6228), [`b8a4ae8`](https://github.com/atlassian-labs/atlaspack/commit/b8a4ae8f83dc0a83d8b145c5f729936ce52080a3)]:
|
|
381
|
+
- @atlaspack/feature-flags@2.15.1
|
|
382
|
+
- @atlaspack/rust@3.3.3
|
|
383
|
+
- @atlaspack/graph@3.4.6
|
|
384
|
+
- @atlaspack/utils@2.14.8
|
|
385
|
+
- @atlaspack/plugin@2.14.8
|
|
386
|
+
|
|
3
387
|
## 2.16.0
|
|
4
388
|
|
|
5
389
|
### Minor Changes
|
package/lib/DefaultBundler.js
CHANGED
|
@@ -59,6 +59,7 @@ var _default = exports.default = new (_plugin().Bundler)({
|
|
|
59
59
|
logger
|
|
60
60
|
}) {
|
|
61
61
|
let targetMap = getEntryByTarget(bundleGraph); // Organize entries by target output folder/ distDir
|
|
62
|
+
// @ts-expect-error TS2304
|
|
62
63
|
let graphs = [];
|
|
63
64
|
for (let entries of targetMap.values()) {
|
|
64
65
|
let singleFileEntries = new Map();
|
|
@@ -94,7 +95,11 @@ function getEntryByTarget(bundleGraph) {
|
|
|
94
95
|
// Find entries from assetGraph per target
|
|
95
96
|
let targets = new (_utils().DefaultMap)(() => new Map());
|
|
96
97
|
bundleGraph.traverse({
|
|
97
|
-
enter(
|
|
98
|
+
enter(
|
|
99
|
+
// @ts-expect-error TS2304
|
|
100
|
+
node, context,
|
|
101
|
+
// @ts-expect-error TS2304
|
|
102
|
+
actions) {
|
|
98
103
|
if (node.type !== 'asset') {
|
|
99
104
|
return node;
|
|
100
105
|
}
|
package/lib/MonolithicBundler.js
CHANGED
|
@@ -4,6 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.addJSMonolithBundle = addJSMonolithBundle;
|
|
7
|
+
function _featureFlags() {
|
|
8
|
+
const data = require("@atlaspack/feature-flags");
|
|
9
|
+
_featureFlags = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
7
14
|
function _nullthrows() {
|
|
8
15
|
const data = _interopRequireDefault(require("nullthrows"));
|
|
9
16
|
_nullthrows = function () {
|
|
@@ -18,7 +25,8 @@ function addJSMonolithBundle(bundleGraph, entryAsset, entryDep) {
|
|
|
18
25
|
// Create a single bundle to hold all JS assets
|
|
19
26
|
let bundle = bundleGraph.createBundle({
|
|
20
27
|
entryAsset,
|
|
21
|
-
target
|
|
28
|
+
target,
|
|
29
|
+
needsStableName: (0, _featureFlags().getFeatureFlag)('singleFileOutputStableName')
|
|
22
30
|
});
|
|
23
31
|
bundleGraph.traverse((node, _, actions) => {
|
|
24
32
|
// JS assets can be added to the bundle, but the rest are ignored
|
|
@@ -38,8 +46,8 @@ function addJSMonolithBundle(bundleGraph, entryAsset, entryDep) {
|
|
|
38
46
|
}
|
|
39
47
|
let assets = bundleGraph.getDependencyAssets(dependency);
|
|
40
48
|
for (const asset of assets) {
|
|
41
|
-
if (asset.bundleBehavior === 'isolated') {
|
|
42
|
-
throw new Error('Isolated assets are not supported for single file output builds
|
|
49
|
+
if (asset.bundleBehavior === 'isolated' || asset.bundleBehavior === 'inlineIsolated') {
|
|
50
|
+
throw new Error(`${asset.bundleBehavior === 'isolated' ? 'Isolated' : 'Inline isolated'} assets are not supported for single file output builds`);
|
|
43
51
|
}
|
|
44
52
|
|
|
45
53
|
// For assets marked as inline, we create new bundles and let other
|
package/lib/bundleMerge.js
CHANGED
|
@@ -25,67 +25,136 @@ function _graph() {
|
|
|
25
25
|
};
|
|
26
26
|
return data;
|
|
27
27
|
}
|
|
28
|
+
function _utils() {
|
|
29
|
+
const data = require("@atlaspack/utils");
|
|
30
|
+
_utils = function () {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
var _memoize = require("./memoize");
|
|
28
36
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
37
|
+
function getBundlesForBundleGroup(bundleGraph, bundleGroupId) {
|
|
38
|
+
let count = 0;
|
|
39
|
+
bundleGraph.traverse(nodeId => {
|
|
40
|
+
const node = bundleGraph.getNode(nodeId);
|
|
41
|
+
if (node && (node === 'root' || node.bundleBehavior !== 'inline' && node.bundleBehavior !== 'inlineIsolated')) {
|
|
42
|
+
count++;
|
|
43
|
+
}
|
|
44
|
+
}, bundleGroupId);
|
|
45
|
+
return count;
|
|
46
|
+
}
|
|
47
|
+
let getBundleOverlap = (sourceBundlesA, sourceBundlesB) => {
|
|
48
|
+
let allSourceBundles = (0, _utils().setUnion)(sourceBundlesA, sourceBundlesB);
|
|
49
|
+
let sharedSourceBundles = (0, _utils().setIntersectStatic)(sourceBundlesA, sourceBundlesB);
|
|
50
|
+
return sharedSourceBundles.size / allSourceBundles.size;
|
|
51
|
+
};
|
|
52
|
+
|
|
29
53
|
// Returns a decimal showing the proportion source bundles are common to
|
|
30
54
|
// both bundles versus the total number of source bundles.
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
55
|
+
function checkBundleThreshold(bundleA, bundleB, threshold) {
|
|
56
|
+
return getBundleOverlap(bundleA.bundle.sourceBundles, bundleB.bundle.sourceBundles) >= threshold;
|
|
57
|
+
}
|
|
58
|
+
let checkSharedSourceBundles = (0, _memoize.memoize)((bundle, importantAncestorBundles) => {
|
|
59
|
+
return importantAncestorBundles.every(ancestorId => bundle.sourceBundles.has(ancestorId));
|
|
60
|
+
});
|
|
61
|
+
let hasSuitableBundleGroup = (0, _memoize.memoize)((bundleGraph, bundle, minBundlesInGroup) => {
|
|
62
|
+
for (let sourceBundle of bundle.sourceBundles) {
|
|
63
|
+
let bundlesInGroup = getBundlesForBundleGroup(bundleGraph, sourceBundle);
|
|
64
|
+
if (bundlesInGroup >= minBundlesInGroup) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return false;
|
|
69
|
+
});
|
|
70
|
+
function validMerge(bundleGraph, config, bundleA, bundleB) {
|
|
71
|
+
if (config.maxBundleSize != null) {
|
|
72
|
+
if (bundleA.bundle.size > config.maxBundleSize || bundleB.bundle.size > config.maxBundleSize) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (config.overlapThreshold != null) {
|
|
77
|
+
if (!checkBundleThreshold(bundleA, bundleB, config.overlapThreshold)) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (config.sourceBundles != null) {
|
|
82
|
+
if (!checkSharedSourceBundles(bundleA.bundle, config.sourceBundles) || !checkSharedSourceBundles(bundleB.bundle, config.sourceBundles)) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (config.minBundlesInGroup != null) {
|
|
87
|
+
if (!hasSuitableBundleGroup(bundleGraph, bundleA.bundle, config.minBundlesInGroup) || !hasSuitableBundleGroup(bundleGraph, bundleB.bundle, config.minBundlesInGroup)) {
|
|
88
|
+
return false;
|
|
37
89
|
}
|
|
38
90
|
}
|
|
39
|
-
return
|
|
91
|
+
return true;
|
|
40
92
|
}
|
|
41
93
|
function getMergeClusters(graph, candidates) {
|
|
42
94
|
let clusters = [];
|
|
43
|
-
for (let candidate of candidates) {
|
|
95
|
+
for (let [candidate, edgeType] of candidates.entries()) {
|
|
44
96
|
let cluster = [];
|
|
45
97
|
graph.traverse(nodeId => {
|
|
46
98
|
cluster.push((0, _nullthrows().default)(graph.getNode(nodeId)));
|
|
47
99
|
// Remove node from candidates as it has already been processed
|
|
48
100
|
candidates.delete(nodeId);
|
|
49
|
-
}, candidate);
|
|
101
|
+
}, candidate, edgeType);
|
|
50
102
|
clusters.push(cluster);
|
|
51
103
|
}
|
|
52
104
|
return clusters;
|
|
53
105
|
}
|
|
54
|
-
function
|
|
106
|
+
function getPossibleMergeCandidates(bundleGraph, bundles) {
|
|
107
|
+
let mergeCandidates = bundles.map(bundleId => {
|
|
108
|
+
let bundle = bundleGraph.getNode(bundleId);
|
|
109
|
+
(0, _assert().default)(bundle && bundle !== 'root', 'Bundle should exist');
|
|
110
|
+
return {
|
|
111
|
+
id: bundleId,
|
|
112
|
+
bundle,
|
|
113
|
+
contentKey: bundleId.toString()
|
|
114
|
+
};
|
|
115
|
+
});
|
|
116
|
+
const uniquePairs = [];
|
|
117
|
+
for (let i = 0; i < mergeCandidates.length; i++) {
|
|
118
|
+
for (let j = i + 1; j < mergeCandidates.length; j++) {
|
|
119
|
+
let a = mergeCandidates[i];
|
|
120
|
+
let b = mergeCandidates[j];
|
|
121
|
+
|
|
122
|
+
// @ts-expect-error TS18048
|
|
123
|
+
if (a.bundle.internalizedAssets.equals(b.bundle.internalizedAssets)) {
|
|
124
|
+
uniquePairs.push([a, b]);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return uniquePairs;
|
|
129
|
+
}
|
|
130
|
+
function findMergeCandidates(bundleGraph, bundles, config) {
|
|
55
131
|
let graph = new (_graph().ContentGraph)();
|
|
56
|
-
let
|
|
57
|
-
let
|
|
132
|
+
let candidates = new Map();
|
|
133
|
+
let allPossibleMergeCandidates = getPossibleMergeCandidates(bundleGraph, bundles);
|
|
58
134
|
|
|
59
135
|
// Build graph of clustered merge candidates
|
|
60
|
-
for (let
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (bundleId === otherBundleId) {
|
|
136
|
+
for (let i = 0; i < config.length; i++) {
|
|
137
|
+
// Ensure edge type coresponds to config index
|
|
138
|
+
let edgeType = i + 1;
|
|
139
|
+
for (let group of allPossibleMergeCandidates) {
|
|
140
|
+
let candidateA = group[0];
|
|
141
|
+
let candidateB = group[1];
|
|
142
|
+
if (!validMerge(bundleGraph, config[i], candidateA, candidateB)) {
|
|
68
143
|
continue;
|
|
69
144
|
}
|
|
70
|
-
let
|
|
71
|
-
|
|
72
|
-
continue;
|
|
73
|
-
}
|
|
74
|
-
seen.add(key);
|
|
75
|
-
let otherBundle = bundleGraph.getNode(otherBundleId);
|
|
76
|
-
(0, _assert().default)(otherBundle && otherBundle !== 'root');
|
|
77
|
-
let score = scoreBundleMerge(bundle, otherBundle);
|
|
78
|
-
if (score >= threshold) {
|
|
79
|
-
let bundleNode = graph.addNodeByContentKeyIfNeeded(bundleId.toString(), bundleId);
|
|
80
|
-
let otherBundleNode = graph.addNodeByContentKeyIfNeeded(otherBundleId.toString(), otherBundleId);
|
|
145
|
+
let bundleNode = graph.addNodeByContentKeyIfNeeded(candidateA.contentKey, candidateA.id);
|
|
146
|
+
let otherBundleNode = graph.addNodeByContentKeyIfNeeded(candidateB.contentKey, candidateB.id);
|
|
81
147
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
148
|
+
// Add edge in both directions
|
|
149
|
+
graph.addEdge(bundleNode, otherBundleNode, edgeType);
|
|
150
|
+
graph.addEdge(otherBundleNode, bundleNode, edgeType);
|
|
151
|
+
candidates.set(bundleNode, edgeType);
|
|
152
|
+
candidates.set(otherBundleNode, edgeType);
|
|
88
153
|
}
|
|
154
|
+
|
|
155
|
+
// Remove bundles that have been allocated to a higher priority merge
|
|
156
|
+
allPossibleMergeCandidates = allPossibleMergeCandidates.filter(group => !graph.hasContentKey(group[0].contentKey) && !graph.hasContentKey(group[1].contentKey));
|
|
89
157
|
}
|
|
158
|
+
(0, _memoize.clearCaches)();
|
|
90
159
|
return getMergeClusters(graph, candidates);
|
|
91
160
|
}
|