@patternslib/dev 4.0.2 → 4.1.0

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/CHANGES.md CHANGED
@@ -2,839 +2,105 @@
2
2
 
3
3
 
4
4
 
5
- ## [4.0.2](https://github.com/Patternslib/dev/compare/4.0.1...4.0.2) (2026-09-05)
6
-
7
- ### Bug Fixes
8
-
9
-
10
- * Fix repeated changelog entries. ([1a1095d](https://github.com/Patternslib/dev/commit/1a1095d500fbc9a9148142d7a1181b1479743a8d))
11
-
12
- When releasing the changelog file got messed up by repeating already
13
- included changelog entries. That was due to a setting, which should have
14
- combined all pre-release changes into a final release.
15
-
16
- This was given up in favor of a clean changelog entry list. The final
17
- release will not combine all pre-release changes. This is what most
18
- projects do anyways, so this change is fine, IMO.
19
-
20
- ## [4.0.1](https://github.com/Patternslib/dev/compare/4.0.0...4.0.1) (2026-09-05)
21
-
22
- ### Bug Fixes
23
-
24
-
25
- * Fix problems with recent releases. ([ece3ae5](https://github.com/Patternslib/dev/commit/ece3ae5342157097f35b9bba0829c685661b5456))
26
-
27
- The following problems are now fixed:
28
-
29
- - Whole history included in new changelog entries.
30
- - No dist/ published due to silent failures.
31
- - No GitHub release page updates.
32
- - No GutHub bundle zip upload.
33
-
34
-
35
- ### Maintenance
36
-
37
-
38
- * **release-it:** Allow to release from version-branches (e.g. 2.0.x or 2.x). ([c4cd074](https://github.com/Patternslib/dev/commit/c4cd074b6e2b689fec3e28b0c0855b7503c7a06f))
39
-
40
- ## [4.0.0](https://github.com/Patternslib/dev/compare/3.9.0-alpha.1...4.0.0) (2026-04-23)
41
-
42
- ### Features
43
-
44
-
45
- * Makefile: Release npm and github in one go, avoiding many of the quirks like double builds and double changelog generation. ([8f01836](https://github.com/Patternslib/dev/commit/8f018368819be86bc9c4e703f7d9574a16fc3322))
46
-
47
-
48
- * Makefile: Update browserslist database before bundling. ([8e3da59](https://github.com/Patternslib/dev/commit/8e3da5993cc657bf8aee3fef40fcc414f0ed3cff))
49
-
50
- Makefiles extending from this Makefile need to switch to a double-colon
51
- target (``bundle-pre::``), so that the base target is also run.
52
-
53
-
54
- ### Bug Fixes
55
-
56
-
57
- * Makefile‌: checkout changes before running release-it which would break if it is modified. ([db0e89e](https://github.com/Patternslib/dev/commit/db0e89ec0fb918cd64accdd2c285e09202936396))
58
-
59
-
60
- * Remove version pin for conventional-changelog-conventionalcommits. This is finally fixed upstream in conventional-changelog/commitlint. ([333c802](https://github.com/Patternslib/dev/commit/333c802d9913e18fe8673b2263a24776bba9bc34))
61
-
62
-
63
- ### Maintenance
64
-
65
-
66
- * Add missing @eslint/js dependency. ([02eb557](https://github.com/Patternslib/dev/commit/02eb5573591d13f114f7fce0b9e81b8ad07fd986))
67
-
68
-
69
- * eslint latest ECMA script and drop @babel/eslint-parser. ([efdc5f1](https://github.com/Patternslib/dev/commit/efdc5f145b1a3bb32c4c2469e8aeeec8b0d29e44))
70
-
71
- The current @babel/eslint-parser version 7 is not compatible with
72
- eslint 10. Also eslint supports with the latest ECMA script version
73
- configuration recent enough JavaScript, so that we can drop the
74
- dependency on @babel/eslint-parser.
75
-
76
-
77
- * Upgrade dependencies. ([4ae9820](https://github.com/Patternslib/dev/commit/4ae98209d0ff5a2e3db882996c4b462cb94ca6a6))
78
-
79
- NOTE: you might need to update your tests for Jest 30.3.0 support.
80
- E.g. expect.toThrowError has changed to expect.toThrow.
81
- See: https://jestjs.io/docs/upgrading-to-jest30
82
-
83
- ## 3.9.0-alpha.1 (2025-12-17)
84
-
85
- ### Bug Fixes
86
-
87
-
88
- * Fix GLOB for JS in .editorconfig config. ([f1de9ba](https://github.com/Patternslib/dev/commit/f1de9baf27740f6f694cdc6940faaadeea0dad3f))
89
-
90
-
91
- ### Maintenance
92
-
93
-
94
- * Pin conventional-changelog-conventionalcommits. ([369e6a6](https://github.com/Patternslib/dev/commit/369e6a6e8b309d6c07c69173a06f9900ba65256b))
95
-
96
- This should solve the conventional changelog upgrade problem related to:
97
- https://github.com/release-it/conventional-changelog/issues/110.
98
-
99
-
100
- * Upgrade commitlint and conventional-changelog. ([987206d](https://github.com/Patternslib/dev/commit/987206d0305739e309108a421d87e7d401cfd4e6))
101
-
102
-
103
- * Upgrade dependencies. ([666d225](https://github.com/Patternslib/dev/commit/666d225c1c8a601fe39fceb65cb739460e4fc449))
104
-
105
- ## 3.9.0-alpha.0 (2025-09-20)
106
-
107
- ### Features
108
-
109
-
110
- * Add prettier Makefile target to format files. ([c84e312](https://github.com/Patternslib/dev/commit/c84e31255f914982c45e0025625951556df27f9e))
111
-
112
-
113
- ### Maintenance
114
-
115
-
116
- * Install caniuse-lite and maintain it at it's latest version. ([43ebf53](https://github.com/Patternslib/dev/commit/43ebf535b1b1fc6cd43bd38ad3080f3a1ce6ef7b))
117
-
118
- Explicitly install caniuse-lite, which is used by browserslist, webpack,
119
- babel etc.
120
- This allows us to maintain it ourselves at the latest version and prevent build
121
- messages to update the browserslist database.
122
-
123
-
124
- * Update the compatible node version to the current LTS version. ([9bdc66e](https://github.com/Patternslib/dev/commit/9bdc66e9b04d44c6fbb68c6ae3ab1a3165f235f6))
125
-
126
-
127
- * Upgrade dependencies. ([137063d](https://github.com/Patternslib/dev/commit/137063d0c697c500847b315dfc89ef5799ad791d))
128
-
129
- ## 3.8.1 (2025-05-08)
130
-
131
- ### Maintenance
132
-
133
-
134
- * Downgrade @release-it/conventional-changelog to < 9 again. ([f02e92b](https://github.com/Patternslib/dev/commit/f02e92bfe414f60a213f6cc2dac4c660f2686c56))
135
-
136
- The resolutions are not passed to client packages, so we still end up
137
- installing conventtional-changelog-conventionalcommits 7 and 8, where we
138
- need only 8. Staying on @release-it/conventional-changelog version 8
139
- until this is fixed upstream.
140
-
141
- See: https://github.com/release-it/conventional-changelog/issues/110.
142
-
143
- ## 3.8.0 (2025-05-08)
144
-
145
- ### Features
146
-
147
-
148
- * Add new changelog category "tech" for technical changes which are not user-visible features. ([a3785df](https://github.com/Patternslib/dev/commit/a3785df8e992e61bf7fbe5214d066b6cec03e069))
149
-
150
-
151
- ### Maintenance
152
-
153
-
154
- * Upgrade dependencies. ([96b7bcd](https://github.com/Patternslib/dev/commit/96b7bcd2f83214ac83faf041afbcb7331d9b6f7b))
155
-
156
- ## 3.7.4 (2025-05-06)
157
-
158
- ### Bug Fixes
159
-
160
-
161
- * Pin conventional-changelog-conventionalcommits to ^8.0.0 for support of @release-it/conventional-changelog > 9. ([428f974](https://github.com/Patternslib/dev/commit/428f9744dc9f0f16d0298024f40f9b0ab295aef4))
162
-
163
- See: https://github.com/release-it/conventional-changelog/issues/110.
164
-
165
-
166
- ### Maintenance
167
-
168
-
169
- * Upgrade dependencies. ([12e7f38](https://github.com/Patternslib/dev/commit/12e7f388d28fd07f4cc49401ab6eb3edce177f8f))
170
-
171
- ## 3.7.3 (2025-04-04)
172
-
173
- ### Maintenance
174
-
175
-
176
- * Upgrade dependencies. ([2a61f15](https://github.com/Patternslib/dev/commit/2a61f1507eb082ab4839d093642709ad41745c58))
177
-
178
-
179
- * Upgrade dependencies. ([c6fca14](https://github.com/Patternslib/dev/commit/c6fca142f6f55efe1633e9eba361f4fb7f17f7f3))
180
-
181
- ## 3.7.2 (2025-02-14)
182
-
183
- ### Bug Fixes
184
-
185
-
186
- * Fix postinstall when no make upgrade is available. ([616be80](https://github.com/Patternslib/dev/commit/616be8076c60fa2e4753d2d0f0fab66de94caecb))
187
-
188
- ## 3.7.1 (2025-02-14)
189
-
190
- ### Maintenance
191
-
192
-
193
- * Downgrade conventional-changelog to not break our Changelog templates. ([18aa235](https://github.com/Patternslib/dev/commit/18aa235ff66d732014ce8ba2423c52d859d794d3))
194
-
195
- ## 3.7.0 (2025-02-13)
196
-
197
- ### Maintenance
198
-
199
-
200
- * Add postinstall script to upgrade dev. ([16b900d](https://github.com/Patternslib/dev/commit/16b900d554591c4c6511b2cbd3f503dc882b14d1))
201
-
202
- Note: the "make upgrade" target is run in the directory where npm
203
- install is invoked. If you install "@patternslib/dev" as a dependency in
204
- "@pattersnlib/patternslib", the Patternslib project is upgraded.
205
-
206
-
207
- * Add upgrade to remove husky. ([6e3629c](https://github.com/Patternslib/dev/commit/6e3629c08c349224b48863d9e922cce303c4e2c4))
208
-
209
-
210
- * Directly use git's commit hooks and remove dependency on husky. ([ae05dd3](https://github.com/Patternslib/dev/commit/ae05dd37bc3df6261db4a5eecbaed3d789812300))
211
-
212
-
213
- * Makefile: Define targets as phony, if they are. ([d4c63b7](https://github.com/Patternslib/dev/commit/d4c63b71909c07dc1915f755c5f54da0dd3e5737))
214
-
215
-
216
- * Makefile: Let the install target depend on yarn.lock file to allow reinstalls when yarn.lock changes. ([9de2d28](https://github.com/Patternslib/dev/commit/9de2d28d15601ec8c81527753ba480eac7bc720d))
217
-
218
-
219
- * Upgrade dependencies. ([74027e8](https://github.com/Patternslib/dev/commit/74027e89abe08a511a8d6f9c82a2e852c36584d6))
220
-
221
-
222
- * Upgrade to eslint v9. ([1279e70](https://github.com/Patternslib/dev/commit/1279e70f4f276a46eb0459cd0b6dd1ab628c4c44))
223
-
224
- ## 3.6.1 (2024-08-14)
225
-
226
- ### Bug Fixes
227
-
228
-
229
- * Webpack style loader. ([ecec3cf](https://github.com/Patternslib/dev/commit/ecec3cf5654050c8ec96a924fcaa8bad618d526c))
230
-
231
- Webpack style loader's insert option needs a different way to reference functions.
232
- Also deprecate webpack-helpers module.
233
-
234
- ## 3.6.0 (2024-08-14)
235
-
236
- ### Features
237
-
238
-
239
- * Add husky commitlint also to this package. ([1bdcf63](https://github.com/Patternslib/dev/commit/1bdcf636324a0a05946754af84faa78c4c7f71f4))
240
-
241
-
242
- * Add WebP as asset/resource along to the other formats for the Webpack loader. ([58f369c](https://github.com/Patternslib/dev/commit/58f369c256eadd3f631f0ea79ed509a93fdfd3d1))
243
-
244
-
245
- ### Bug Fixes
246
-
247
-
248
- * Do not upgrade husky and keep at pre 9.x. ([fe89852](https://github.com/Patternslib/dev/commit/fe8985223c11cc4258e44e475aeebaa1926ed327))
249
-
250
- Husky has some breaking changes which we should only upgrade with the next major release of @patternslib/dev.
251
-
252
-
253
- * Require minimum node v18.18. ([807147a](https://github.com/Patternslib/dev/commit/807147a98527520b7455061629a04ebac6941740))
254
-
255
- This is Webpack's minimum required version.
256
- Note: As time of this commit, versions below 18 are unmaintained.
257
-
258
-
259
- ### Maintenance
260
-
261
-
262
- * Remove plugin-transform-optional-chaining from babel. ([9facee8](https://github.com/Patternslib/dev/commit/9facee8b35a9f09c24c6e466228503d0a257445b))
263
-
264
- The optional chaining feature is already included in preset-env ES2020.
265
-
266
-
267
- * Upgrade dependencies. ([c3d64fd](https://github.com/Patternslib/dev/commit/c3d64fdd0c543e199e04088fc661c7bd9315bbe3))
268
-
269
- Upgrade all except eslint, which needs to migrate from `.eslintrc.js` to
270
- `eslint.config.js`. This will be done in an upcoming major release.
271
-
272
-
273
- * Upgrade GitHub Actions node version. ([4c96faa](https://github.com/Patternslib/dev/commit/4c96faa2e34b4fdf50d2d38b6a230704f7d9c7ed))
274
-
275
-
276
- * Upgrade GitHub Actions. ([f687bee](https://github.com/Patternslib/dev/commit/f687bee3dcd94b50b14fd5df3370aa9ecf245943))
277
-
278
- ## 3.5.3 (2023-11-23)
279
-
280
- ### Maintenance
281
-
282
-
283
- * Upgrade dependencies. ([8c20da1](https://github.com/Patternslib/dev/commit/8c20da1249a793c6deac64f4cddcb46932e8efa4))
284
-
285
- ## 3.5.2 (2023-10-16)
286
-
287
- ### Maintenance
288
-
289
-
290
- * Upgrade dependencies. ([e5fb5b8](https://github.com/Patternslib/dev/commit/e5fb5b8bb004eb5990d6326fe93d8ed02cbbf362))
291
-
292
- ## 3.5.1 (2023-09-23)
293
-
294
- ### Maintenance
295
-
296
-
297
- * Upgrade dependencies. ([b1ffc64](https://github.com/Patternslib/dev/commit/b1ffc6453551b7312e4643f4f6aa679286baa379))
298
-
299
- ## 3.5.0 (2023-08-30)
300
-
301
- ### Features
302
-
303
-
304
- * **Tests:** Add helper for conditional test skipping and node version parsing. ([611b77b](https://github.com/Patternslib/dev/commit/611b77b2b4469226ebcf942e5b68851e7927c630))
305
-
306
-
307
- ### Maintenance
308
-
309
-
310
- * Upgrade dependencies. ([1e146a9](https://github.com/Patternslib/dev/commit/1e146a99047786ffbf69cc0da97763885af3736f))
311
-
312
- ## 3.4.1 (2023-08-11)
313
-
314
- ### Bug Fixes
315
-
316
-
317
- * Correct comment in Makefile. ([5fb33c6](https://github.com/Patternslib/dev/commit/5fb33c6f94464c8df5678556197bac4692d6b878))
318
-
319
-
320
- ### Maintenance
321
-
322
-
323
- * Upgrade dependencies. ([4fcf179](https://github.com/Patternslib/dev/commit/4fcf1791317ad8bc6b06cc1406eeb5672c3e2a4d))
324
-
325
- ## 3.4.0 (2023-07-27)
326
-
327
- ### Maintenance
328
-
329
-
330
- * Depend on the minimum actively maintained Node.js version >= 16. ([603a024](https://github.com/Patternslib/dev/commit/603a024f1962d7731d8aa09457c90c48c73f2302))
331
-
332
-
333
- * Upgrade dependencies. ([b3bb92f](https://github.com/Patternslib/dev/commit/b3bb92f0e78c723fb20950e0a47404d9fd2f47af))
334
-
335
- ## 3.3.5 (2023-05-29)
336
-
337
- ### Bug Fixes
338
-
339
-
340
- * Fix hook config from 3.3.4. ([b4f02f6](https://github.com/Patternslib/dev/commit/b4f02f69fda38b8c6a0ef8402511fc8cd87eff9d))
341
-
342
- ## 3.3.4 (2023-05-29)
343
-
344
- ### Bug Fixes
345
-
346
-
347
- * Include the correct bundle version in entry file header comment. ([ea32b4d](https://github.com/Patternslib/dev/commit/ea32b4dd9e6bc02fcbc4011798174eb0e057dd82))
348
-
349
- In order to have the correct version specifier in the bundle's entry
350
- script header comment the bundle must be built after the version bump.
351
- Use release-it hooks to do that.
352
-
353
-
354
- ### Maintenance
355
-
356
-
357
- * Upgrade dependencies. ([56eda65](https://github.com/Patternslib/dev/commit/56eda655d463fa8c0e3fb36a4b35d258a22bf815))
358
-
359
- ## 3.3.3 (2023-05-28)
360
-
361
- ### Bug Fixes
362
-
363
-
364
- * Add pre-built bundles to the npm distribution again. ([c85dbdc](https://github.com/Patternslib/dev/commit/c85dbdc22cf3a29017677020fcd8e2acc65803b7))
365
-
366
- This was lost in a previous Makefile update.
367
- Now you can again reference jsdelivr and and unpkg to include bundles.
368
-
369
-
370
- * Change optional chaining babel plugin name. ([e57793a](https://github.com/Patternslib/dev/commit/e57793a4abf59d3859aaa8ba757cbd0d41871396))
371
-
372
-
373
- ### Maintenance
374
-
375
-
376
- * Remove dependency on semver which is not needed since the recent Makefile improvements. ([1dd1c3a](https://github.com/Patternslib/dev/commit/1dd1c3afc1494634f5a8f72f30c4ba5a138376b8))
377
-
378
-
379
- * Upgrade dependencies. ([6d052b7](https://github.com/Patternslib/dev/commit/6d052b7d6d7cbc52812d8483dd713d336c11aa54))
380
-
381
- ## 3.3.2 (2023-05-11)
382
-
383
- ### Maintenance
384
-
385
-
386
- * Upgrade dependencies. ([0075b94](https://github.com/Patternslib/dev/commit/0075b947c5f3490627b2a20fea46c6acac71dd52))
387
-
388
- ## 3.3.1 (2023-04-21)
389
-
390
- ## 3.3.0 (2023-04-17)
391
-
392
- ### Bug Fixes
393
-
394
-
395
- * Simplify release make commands. ([49077d2](https://github.com/Patternslib/dev/commit/49077d2c6d79d7b98898c6576d0aaa01e003a0d6))
396
-
397
- Change the prerelease commands back to pre-3.2.0 names.
398
- This was necessary because the previous change did create for each
399
- command a new increment, which was not what we wanted.
400
- Instead the Makefile is now restructured:
401
- - First the npm release is done and the package.json written with the
402
- correct version. If no increment is given (in case of the prerelease
403
- targets) an interactive prompt asks the user to define one.
404
- - Second the GitHub release is done. It's no more necessary to guess the
405
- next version before the npm version was done. Instead we now rely on
406
- release-it choosing it for us.
407
- Now we do have again the "prerelease-alpha" and "prerelease-beta"
408
- Makefile targets.
5
+ ## [4.1.0](https://github.com/Patternslib/dev/compare/4.1.0-alpha.0...4.1.0) (2026-09-16)
409
6
 
410
- ## 3.2.0 (2023-04-17)
7
+ ## [4.1.0-alpha.0](https://github.com/Patternslib/dev/compare/4.0.2...4.1.0-alpha.0) (2026-09-11)
411
8
 
412
9
  ### Features
413
10
 
414
11
 
415
- * Change prerelease commands to prerelease-INCREMENT-PREID ([6b488e1](https://github.com/Patternslib/dev/commit/6b488e120761951ba01eae524563bdd490a9b739))
416
-
417
- Change the prerelease commands to define the increment level.
418
- Instead of "prerelease-alpha" there are now "prerelease-major-alpha",
419
- "prerelease-minor-alpha" and "prerelease-patch-alpha".
420
- Instead of "prerelease-beta" there are now "prerelease-major-beta",
421
- "prerelease-minor-beta" and "prerelease-patch-beta".
422
- This fixes a problem where the first prerelease for major or minor
423
- increments got only a patch-level increment.
424
-
425
-
426
- ### Maintenance
427
-
428
-
429
- * Upgrade dependencies. ([68f4ca8](https://github.com/Patternslib/dev/commit/68f4ca8b4d243f1b1b25ffacb404be71103b86aa))
430
-
431
- ## 3.1.13 (2023-04-17)
432
-
433
- ### Bug Fixes
434
-
435
-
436
- * Improve the release-it commit template to include a newline between each commit and add any commit references to the end. ([1603d0b](https://github.com/Patternslib/dev/commit/1603d0b1a08aab290f021b20562c92dab45f75c1))
437
-
438
-
439
- * Improve the release-it commit template to include a newline between header and body text. ([14ace2b](https://github.com/Patternslib/dev/commit/14ace2b2c2c2dd2bc77c4cd0cf9b47744d5ca1c1))
440
-
441
-
442
- * Include all changes since last regular release only in GitHub releases. ([ec86755](https://github.com/Patternslib/dev/commit/ec8675589217f5c66ffcfab273942c11b845a79c))
443
-
444
- When doing regular releases include all the changes since the last
445
- regular release - including changes from pre-releases in the release
446
- notes on GitHub, but not in the CHANGES.md file. In the CHANGES.md file
447
- every change can be seen at once. Including all the changes since the
448
- previous regular release is useful for the GitHub release page only.
449
-
450
-
451
- ### Maintenance
452
-
453
-
454
- * Update dependencies. ([b02c37b](https://github.com/Patternslib/dev/commit/b02c37b0a41a347f955a7a7a8fb47d8e1f4c4f11))
455
-
456
- ## 3.1.12 (2023-04-03)
457
-
458
- ### Maintenance
459
-
460
-
461
- * Upgrade dependencies. ([b3930ef](https://github.com/Patternslib/dev/commit/b3930efa5b2d5aebe5182d15e07e75f65ea7fed1))
462
-
463
- ## 3.1.11 (2023-03-09)
464
-
465
- ### Maintenance
466
-
467
-
468
- * Upgrade dependencies. ([cc4a9be](https://github.com/Patternslib/dev/commit/cc4a9be73406070bd9e057f395a7baaf991a4120))
469
-
470
- ## 3.1.10 (2023-02-14)
471
-
472
- ### Maintenance
473
-
474
-
475
- * Upgrade dependencies. ([4aad9c8](https://github.com/Patternslib/dev/commit/4aad9c8fc76df2d098f0d5abbac6c271cbe8edbe))
476
-
477
-
478
- * When doing a final release, set tagExclude to ignore pre-releases when finding the last release. This should include all changelog entrief from the pre-releases. ([4abf750](https://github.com/Patternslib/dev/commit/4abf750b95b2c3d106feccb19c7f0c27d7bfc8c4))
479
-
480
- ## 3.1.9 (2023-01-25)
481
-
482
- ### Maintenance
483
-
484
-
485
- * enable source maps for development again. ([fdf8a86](https://github.com/Patternslib/dev/commit/fdf8a86086053f8021f74514810fdccb5d7b7724))
486
-
487
-
488
- * Upgrade dependencies. ([feb26ce](https://github.com/Patternslib/dev/commit/feb26cee1a2cb805c6b13407f37f6d9e85b817d6))
489
-
490
- ## 3.1.8 (2022-12-19)
491
-
492
- ### Maintenance
493
-
494
-
495
- * For non-minified development builds, do not generate source maps. ([babf289](https://github.com/Patternslib/dev/commit/babf2893638b17f84e651a79c3e67fbbd81d1914))
496
-
497
-
498
- * Upgrade dependencies. ([20f7b31](https://github.com/Patternslib/dev/commit/20f7b315e1b0f6fa110c96ddc7c97ae206203676))
499
-
500
- ## 3.1.7 (2022-12-11)
501
-
502
- ### Maintenance
503
-
504
-
505
- * Include changelog from pre-releases in final. ([b053a10](https://github.com/Patternslib/dev/commit/b053a103ae859b1c33904d48fd80076cbec040eb))
506
-
507
- When doing a final release after a series of pre-releases, include all
508
- the pre-releases changelog items in the final release.
509
- See: https://github.com/release-it/release-it/blob/master/docs/pre-releases.md
510
-
511
-
512
- * Upgrade dependencies. ([98d81a3](https://github.com/Patternslib/dev/commit/98d81a3682ba68058bdc3e263300c0a131f5a4c5))
12
+ * **module federation:** resolve a promise once all remote bundles are initialized ([e2f0f22](https://github.com/Patternslib/dev/commit/e2f0f22d6433960ddd297fd15e53f752a30a9486))
513
13
 
514
- ## 3.1.6 (2022-12-07)
14
+ The document-ready handler started the initialization of all Module
15
+ Federation remote bundles but did not wait for them: the
16
+ ``patternslib__mf--loaded`` event fired before any remote had actually
17
+ loaded and run its main module. Consumers had no way to know when the
18
+ remotes' patterns and components were registered.
515
19
 
516
- ### Maintenance
517
-
518
-
519
- * Remove core-js. ([2abfe2b](https://github.com/Patternslib/dev/commit/2abfe2b1904aec7a61c498f83b69f44f4b2161ba))
520
-
521
-
522
- * Upgrade dependencies. ([0a1b506](https://github.com/Patternslib/dev/commit/0a1b5068e724c049acc4dc9caca0c4ce420f5178))
523
-
524
- ## 3.1.5 (2022-11-18)
525
-
526
- ### Bug Fixes
527
-
528
-
529
- * **Build:** Get the correct version increment for prereleases. ([8947884](https://github.com/Patternslib/dev/commit/8947884e2a91fd39305ea9499d112c2dd8c845ae))
530
-
531
- ## 3.1.4 (2022-11-18)
532
-
533
- ### Bug Fixes
534
-
535
-
536
- * **Makefile:** Change the 'check' target to not be a double-colon rule, which cannot be overwritten. See: https://www.gnu.org/software/make/manual/html_node/Double_002dColon.html ([5f0f08c](https://github.com/Patternslib/dev/commit/5f0f08cd8266f5c2cf5689f3b95a6294990e3dd6))
537
-
538
- ## 3.1.3 (2022-11-18)
539
-
540
- ### Bug Fixes
541
-
542
-
543
- * **Webpack:** Add the version banner only to the entry point files. ([6f82df1](https://github.com/Patternslib/dev/commit/6f82df1d3215c07d4ff4cc00d3d6fc56f9f1fdca))
544
-
545
- This fixes a problem where each chunk file was changed with a new release, even if nothing else than the version has changed.
546
- Adding the version banner only to the entry points still allows to check the version while keeping the changeset for releases small.
547
-
548
-
549
- ### Maintenance
20
+ The helper now initializes all remotes in parallel, waits for all of
21
+ them to settle (a failing remote is logged and does not block the
22
+ others), and only then dispatches the event. The new promise
23
+ ``window.__patternslib_mf_initialized`` is created at module load time,
24
+ so it can be awaited by code running before or after document ready —
25
+ the Patternslib registry uses it to defer the initial DOM scan.
550
26
 
27
+ A remote's main module usually only does ``import("./bundle")`` — the
28
+ async boundary needed to consume shared modules — and the registrations
29
+ happen in that chunk. If the main module exports that promise as its
30
+ default export (``export default import("./bundle")``), the helper
31
+ waits for it as well. Remotes without the export keep working as
32
+ before.
551
33
 
552
- * Upgrade dependencies. ([b2167b4](https://github.com/Patternslib/dev/commit/b2167b458711f73480797505e18e75cf3ef8ce33))
553
-
554
- ## 3.1.2 (2022-11-15)
555
34
 
556
35
  ### Bug Fixes
557
36
 
558
37
 
559
- * Fix Makefile to not emit an error when no compiled bundle is found. ([15363a7](https://github.com/Patternslib/dev/commit/15363a7e50bc290a7b394f7d3aeeac1634e8ab1d))
38
+ * Cleanup changelog entries. ([c311b84](https://github.com/Patternslib/dev/commit/c311b84d22c3c10721525d3c56423d7a200d4450))
560
39
 
561
- ## 3.1.1 (2022-11-15)
40
+ ## [4.0.2](https://github.com/Patternslib/dev/compare/4.0.1...4.0.2) (2026-09-05)
562
41
 
563
42
  ### Bug Fixes
564
43
 
44
+ - Fix repeated changelog entries. ([1a1095d](https://github.com/Patternslib/dev/commit/1a1095d500fbc9a9148142d7a1181b1479743a8d))
565
45
 
566
- * Fix Makefile error with GitHub release. ([7df20db](https://github.com/Patternslib/dev/commit/7df20db4ef54c820b07e49db9123823b23ee1161))
567
-
568
- ## 3.1.0 (2022-11-15)
569
-
570
- ### Features
571
-
572
-
573
- * Allow to add the compiled bundles to npm packages. ([84bdefd](https://github.com/Patternslib/dev/commit/84bdefd339b9aa553ef78e9448e4cdd998178d40))
574
-
575
- Creating a npm release with the Makefile prepares now a bundle build
576
- with the correct package version added as a comment to the bundle files.
577
- The compiled bundle can then be uploaded to npm if it is part of the git
578
- repository (included by .gitignore) or part of the npm release
579
- (preferred, included by .npmignore).
580
-
581
- Adding the compiled bundle to npm allows to directly include it via a
582
- CDN like so:
583
-
584
- https://cdn.jsdelivr.net/npm/@patternslib/patternslib@9.7.0-alpha.2/dist/bundle.min.js
585
- or
586
- https://unpkg.com/@patternslib/patternslib@9.7.0-alpha.2/dist/bundle.min.js
587
-
588
- We have to compile the bundle with the correct version BEFORE the npm
589
- package is created with release-it. The next version is queried using
590
- the LEVEL parameter (set by the different release targets) and the
591
- "semver" tool.
592
-
593
-
594
- ### Maintenance
595
-
596
-
597
- * Upgrade dependencies. ([e687405](https://github.com/Patternslib/dev/commit/e6874052cf9ae2cd359996659c091de532b6f5cb))
598
-
599
- ## 3.0.0 (2022-10-15)
600
-
601
- ### Breaking Changes
602
-
603
-
604
- * **Build:** Remove the showdown-prettify loading config and the now unused imports-loader. ([27ba90f](https://github.com/Patternslib/dev/commit/27ba90fc9e615c57b4be0ae20b84c2f16a918759))
605
-
606
-
607
- * **Tests:** Remove dependency on jQuery. ([259d801](https://github.com/Patternslib/dev/commit/259d801ab0a203ea64073e3cc0366976a38f1e0c))
608
-
609
- Use the following in your test setup to provide jQuery to external
610
- libraries if they depend on a global jQuery object or extend from the
611
- jest config from @patternslib/patternslib:
612
-
613
- ```js
614
- import jquery from "jquery";
615
- global.$ = global.jQuery = jquery;
616
- ```
617
-
618
-
619
- * **Tests:** Remove the Dependency on @patternslib/patternslib. ([afe8fee](https://github.com/Patternslib/dev/commit/afe8feec6304d2ce184afd587d429f3ae5bd533c))
46
+ When releasing the changelog file got messed up by repeating already
47
+ included changelog entries. That was due to a setting, which should have
48
+ combined all pre-release changes into a final release.
620
49
 
621
- If you need Patternslib specific test setup, extend from Patternslib.
622
-
623
-
624
- ### Features
625
-
626
-
627
- * **Build:** Add Module Federation configuration for webpack. ([b84c2fb](https://github.com/Patternslib/dev/commit/b84c2fb8053837206c044e3148522d9a54afa300))
628
-
629
-
630
- ### Maintenance
631
-
632
-
633
- * Upgrade dependencies. ([f868454](https://github.com/Patternslib/dev/commit/f868454982447190e968ab9eab4988bfee01c43a))
634
-
635
- ## 2.7.2 (2022-09-28)
636
-
637
- ### Maintenance
638
-
639
-
640
- * Upgrade dependencies. ([1edd750](https://github.com/Patternslib/dev/commit/1edd7508ff8571110c00939f29843ab9a99986d5))
641
-
642
- ## 2.7.1 (2022-09-20)
643
-
644
- ### Maintenance
645
-
646
-
647
- * Upgrade dependencies. ([2fa0672](https://github.com/Patternslib/dev/commit/2fa067203c73524e95c3e1a5f70b198a8b8d56da))
648
-
649
- ## 2.7.0 (2022-09-15)
650
-
651
- ### Features
652
-
653
-
654
- * Define the close, show and showModal methods in dialog elements. ([3b59aed](https://github.com/Patternslib/dev/commit/3b59aed8556c5103ada9efa175896f83e0fac6c0))
655
-
656
-
657
- ### Maintenance
658
-
659
-
660
- * Upgrade dependencies. ([087dca5](https://github.com/Patternslib/dev/commit/087dca5d9de49423f80ce670e342bef9629dab1c))
50
+ This was given up in favor of a clean changelog entry list. The final
51
+ release will not combine all pre-release changes. This is what most
52
+ projects do anyways, so this change is fine, IMO.
661
53
 
662
- ## 2.6.0 (2022-09-05)
54
+ ## [4.0.1](https://github.com/Patternslib/dev/compare/4.0.0...4.0.1) (2026-09-05)
663
55
 
664
56
  ### Bug Fixes
665
57
 
58
+ - Fix problems with recent releases. ([ece3ae5](https://github.com/Patternslib/dev/commit/ece3ae5342157097f35b9bba0829c685661b5456))
666
59
 
667
- * Fix GitHub Actions branch name. ([e59126a](https://github.com/Patternslib/dev/commit/e59126ab8ba9cc1b284c7b964dabe905de9f9fd1))
668
-
669
-
670
- ### Maintenance
671
-
672
-
673
- * Upgrade dependencies. ([0720aad](https://github.com/Patternslib/dev/commit/0720aadc0d8f8064996b8ec5568ee8d30c84a70c))
674
-
675
- ## 2.5.0 (2022-08-19)
676
-
677
- ### Features
678
-
679
-
680
- * **Makefile:** Add empty bundle-pre target for customization. ([0290e61](https://github.com/Patternslib/dev/commit/0290e61fac9230e24428dd0b846c5bace145f56d))
681
-
682
- The empty bundle-pre target is run before the bundle target and can be
683
- overwritten in extending projects to add some tasks before bundle generation.
684
- This can be used to unlink and reinstall any dependencies before bundle generation.
685
-
686
-
687
- ### Maintenance
688
-
689
-
690
- * Upgrade dependencies. ([64094da](https://github.com/Patternslib/dev/commit/64094da766b42c245dad7640216009b1d0c2701e))
691
-
692
- ## 2.4.0 (2022-08-11)
693
-
694
- ### Features
695
-
696
-
697
- * **Webpack:** Add bundle name and version to the banner. ([1058b6d](https://github.com/Patternslib/dev/commit/1058b6d58b6e05c0c841a02a753a7fd823688595))
698
-
699
- For this, you have to pass your project's package.json as argument to the webpack config factory.
700
- Both values - name and version - are taken from the package.json data.
701
-
702
-
703
- * **Webpack:** Add config export with named parameters. ([f7b2471](https://github.com/Patternslib/dev/commit/f7b24711ce223eaa51e0ea819643a656cae846f3))
704
-
705
- Add config export along with the default export to support named parameters via parameter destructuring.
60
+ The following problems are now fixed:
706
61
 
62
+ * Whole history included in new changelog entries.
63
+ * No dist/ published due to silent failures.
64
+ * No GitHub release page updates.
65
+ * No GutHub bundle zip upload.
707
66
 
708
67
  ### Maintenance
709
68
 
69
+ - **release-it:** Allow to release from version-branches (e.g. 2.0.x or 2.x). ([c4cd074](https://github.com/Patternslib/dev/commit/c4cd074b6e2b689fec3e28b0c0855b7503c7a06f))
710
70
 
711
- * Upgrade dependencies. ([9039642](https://github.com/Patternslib/dev/commit/90396428d8b00dc6d60137387280e26f335d6128))
712
-
713
-
714
- * **Webpack:** Correct API doc for shared_from_dependencies. ([f2b0031](https://github.com/Patternslib/dev/commit/f2b003193312a332a100b8e1f6939dedcdc0e23d))
715
-
716
- ## 2.3.0 (2022-07-07)
71
+ ## [4.0.0](https://github.com/Patternslib/dev/compare/3.9.0-alpha.1...4.0.0) (2026-04-23)
717
72
 
718
73
  ### Features
719
74
 
75
+ - Makefile: Release npm and github in one go, avoiding many of the quirks like double builds and double changelog generation. ([8f01836](https://github.com/Patternslib/dev/commit/8f018368819be86bc9c4e703f7d9574a16fc3322))
720
76
 
721
- * **Module Federation:** Add a shared parameter for MF config factory. ([22e4b5e](https://github.com/Patternslib/dev/commit/22e4b5e0a4d933a61008c5f203c90ad94d6b084f))
722
-
723
- The shared parameter allows to directly provide the shared object for the Webpack Module Federation Plugin.
724
- It extends generated shared definitions from the dependencies object and will overwrite existing entries.
725
-
726
- ## 2.2.1 (2022-07-06)
727
-
728
- ### Maintenance
729
-
730
-
731
- * Upgrade dependencies. ([41adefd](https://github.com/Patternslib/dev/commit/41adefd711a2ba68ba7327236a365889b4f76205))
732
-
733
- ## 2.2.0 (2022-06-27)
734
-
735
- ### Breaking Changes
736
-
737
-
738
- * **webpack module federation:** Make wepack module federation config factory more explicit. ([efd266c](https://github.com/Patternslib/dev/commit/efd266cfc82372c467eb6a8b470360b72647b9bd))
739
-
740
- Change signature of the webpack mf config factory to make it simpler, more flexible and more explicit at the cost of having to pass more options.
741
-
742
- - Remove parameters ``package_json`` and ``shared`` in favor of ``dependencies``.
743
- - Explicitly pass all dependencies via ``dependencies``, also the base ones from @patternslib/patternslib if wanted.
744
- - Always explicitly pass the module federation name (e.g. the package.json's package name).
745
-
746
- This makes the MF config factory simpler although you probably have to pass more options.
747
- You now can easily just add the dependencies you want instead of having
748
- always @patternslib/patternslib dependencies added.
77
+ - Makefile: Update browserslist database before bundling. ([8e3da59](https://github.com/Patternslib/dev/commit/8e3da5993cc657bf8aee3fef40fcc414f0ed3cff))
749
78
 
79
+ Makefiles extending from this Makefile need to switch to a double-colon
80
+ target (`bundle-pre::`), so that the base target is also run.
750
81
 
751
82
  ### Bug Fixes
752
83
 
84
+ - Makefile‌: checkout changes before running release-it which would break if it is modified. ([db0e89e](https://github.com/Patternslib/dev/commit/db0e89ec0fb918cd64accdd2c285e09202936396))
753
85
 
754
- * Fix missing parentheses in release-zip. ([72d435d](https://github.com/Patternslib/dev/commit/72d435d500cbf9ec460bf4f5961027025e554221))
755
-
756
-
757
- ### Maintenance
758
-
759
-
760
- * Add [@plone](https://github.com/plone) to jest and webpack transform ignores. ([678bf09](https://github.com/Patternslib/dev/commit/678bf090be043c90c462075980db5ac1a9470d39))
761
-
762
-
763
- * Remove unnecessary import from webpack.config.js. ([6658497](https://github.com/Patternslib/dev/commit/6658497746e9fd948dbbacd5ad6cfa42b98168af))
764
-
765
-
766
- * Upgrade dependencies. ([e1e423e](https://github.com/Patternslib/dev/commit/e1e423eb3371f5c4792ad246e9df8ed2d3d434d9))
767
-
768
- ## 2.1.0 (2022-06-25)
769
-
770
- ### Features
771
-
772
-
773
- * Do not build a bundle and a release-zip for @patternslib/dev. ([085a019](https://github.com/Patternslib/dev/commit/085a019c16a8494a2d6fa0203d880325c996aba6))
774
-
775
- Still, we have the Makefile targets ``bundle`` and ``release-zip``
776
- defined in the Makefile, making it possible to let other packages
777
- include this Makefile and extend from it while it is fully functioning
778
- for @patternslib/dev too.
779
-
86
+ - Remove version pin for conventional-changelog-conventionalcommits. This is finally fixed upstream in conventional-changelog/commitlint. ([333c802](https://github.com/Patternslib/dev/commit/333c802d9913e18fe8673b2263a24776bba9bc34))
780
87
 
781
88
  ### Maintenance
782
89
 
90
+ - Add missing @eslint/js dependency. ([02eb557](https://github.com/Patternslib/dev/commit/02eb5573591d13f114f7fce0b9e81b8ad07fd986))
783
91
 
784
- * Add jquery and @patternslib/patternslib to devDependencies, so that setup_tests.js does not fail when testing this package. ([edae3f7](https://github.com/Patternslib/dev/commit/edae3f771ac71f0a26e87c2e78d16e0b2aaaf122))
785
-
786
-
787
- * Also remove eventual @plone/ from bundle name. ([7696d7d](https://github.com/Patternslib/dev/commit/7696d7d2ec8dd1600dc8f2e0cdb85b8aabc44930))
788
-
789
-
790
- * Ignore .git directory when watching for changes. ([14ff7e9](https://github.com/Patternslib/dev/commit/14ff7e905794a340ce23f8afe1c77a2e20b987ca))
791
-
792
-
793
- * Make @patternslib/patternslib a peer dependency which must be installed if e.g. the webpack.mf.js Webpack config is used. ([987b421](https://github.com/Patternslib/dev/commit/987b42175acbf3fc4d2df5416dd3329b610c8116))
794
-
795
-
796
- * Upgrade dependencies. ([7fac8d7](https://github.com/Patternslib/dev/commit/7fac8d79b4ce0e3acd62861bd7bcbe3866f32adc))
797
-
798
-
799
- * Upgrade dependencies. ([c632f09](https://github.com/Patternslib/dev/commit/c632f099f0ba3b542af136feba89b28aeb457385))
800
-
801
- ## 2.0.0 (2022-06-15)
802
-
803
- ### Maintenance
804
-
805
-
806
- * Add test script to package.json. ([55e8a8b](https://github.com/Patternslib/dev/commit/55e8a8b00a645b9c3ff1d2f395ee2170c9f64bfb))
807
-
808
-
809
- * Allow releases from master and from main branches. ([f4f9528](https://github.com/Patternslib/dev/commit/f4f952893a67c790bd1d14a151e62e9c84aff4ea))
810
-
811
-
812
- * Configure commitlint for extendability. ([6488bba](https://github.com/Patternslib/dev/commit/6488bbac33e82d713a7d14cf7c94e6206f957983))
813
-
814
-
815
- * Configure dependencies. ([4db723d](https://github.com/Patternslib/dev/commit/4db723dedd245f2c71fe9367b7f82bec1179c024))
816
-
817
- Use dependencies field in package.json to install all development dependencies.
818
- This way, when another package depends on it via ``devDependencies``,
819
- all dependencies will be installed.
820
-
821
-
822
- * Configure jest for extendability. ([f4eeb3c](https://github.com/Patternslib/dev/commit/f4eeb3cdbe63e63c3d7f9a79dd6f66759837a417))
823
-
824
-
825
- * Configure prettier for extendability. ([0f27162](https://github.com/Patternslib/dev/commit/0f2716286fff157b66a7d6e16b1048d35e00b6f2))
826
-
827
-
828
- * Configure release-it for extendability. ([4aedd68](https://github.com/Patternslib/dev/commit/4aedd68faea2a6b7a56850ce07e28e03af367b6a))
829
-
830
-
831
- * Configure webpack for extendability. ([f805856](https://github.com/Patternslib/dev/commit/f805856274ccae9f3cad17186dbf5029f8524b9c))
832
-
92
+ - eslint latest ECMA script and drop @babel/eslint-parser. ([efdc5f1](https://github.com/Patternslib/dev/commit/efdc5f145b1a3bb32c4c2469e8aeeec8b0d29e44))
833
93
 
834
- * Initial dev setup, based on @patternslib/patternslib. ([12968fb](https://github.com/Patternslib/dev/commit/12968fb0c9ee8d0b858acc88d8d3077a70cfa6d2))
94
+ The current @babel/eslint-parser version 7 is not compatible with
95
+ eslint 10. Also eslint supports with the latest ECMA script version
96
+ configuration recent enough JavaScript, so that we can drop the
97
+ dependency on @babel/eslint-parser.
835
98
 
99
+ - Upgrade dependencies. ([4ae9820](https://github.com/Patternslib/dev/commit/4ae98209d0ff5a2e3db882996c4b462cb94ca6a6))
836
100
 
837
- * Upgrade dependencies. ([134295d](https://github.com/Patternslib/dev/commit/134295d67fe7c479c73c7878fd1d3ef0a07e5a83))
101
+ NOTE: you might need to update your tests for Jest 30.3.0 support.
102
+ E.g. expect.toThrowError has changed to expect.toThrow.
103
+ See: https://jestjs.io/docs/upgrading-to-jest30
838
104
 
839
105
  ## [3.9.0-alpha.1](https://github.com/Patternslib/dev/compare/3.9.0-alpha.0...3.9.0-alpha.1) (2025-12-17)
840
106
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternslib/dev",
3
- "version": "4.0.2",
3
+ "version": "4.1.0",
4
4
  "description": "Development base files for working with Patternslib and add-ons.",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -0,0 +1,116 @@
1
+ jest.mock("../webpack/module_federation--dynamic-federation", () => ({
2
+ __esModule: true,
3
+ default: jest.fn(async (remote) => globalThis[remote]),
4
+ }));
5
+
6
+ describe("webpack/module_federation", () => {
7
+ const FAKE = "__patternslib_mf__fake";
8
+ const BROKEN = "__patternslib_mf__broken";
9
+ let events;
10
+ const on_loaded = () => events.push("loaded");
11
+
12
+ beforeEach(() => {
13
+ jest.resetModules();
14
+ events = [];
15
+ document.addEventListener("patternslib__mf--loaded", on_loaded);
16
+ });
17
+
18
+ afterEach(() => {
19
+ document.removeEventListener("patternslib__mf--loaded", on_loaded);
20
+ delete window[FAKE];
21
+ delete window[BROKEN];
22
+ delete window.__patternslib_mf_initialized;
23
+ delete window.__patternslib_container_map;
24
+ jest.restoreAllMocks();
25
+ });
26
+
27
+ it("resolves the initialization promise only after all remotes are initialized", async () => {
28
+ let release;
29
+ const factory = jest.fn(() => ({}));
30
+ window[FAKE] = {
31
+ get: jest.fn(
32
+ () => new Promise((resolve) => (release = () => resolve(factory))),
33
+ ),
34
+ };
35
+
36
+ require("../webpack/module_federation");
37
+
38
+ const promise = window.__patternslib_mf_initialized;
39
+ expect(promise).toBeInstanceOf(Promise);
40
+
41
+ let settled = false;
42
+ promise.then(() => (settled = true));
43
+
44
+ // document ready has fired, the remote is being loaded but not done yet.
45
+ await new Promise((resolve) => setTimeout(resolve, 10));
46
+ expect(window[FAKE].get).toHaveBeenCalledWith("./main");
47
+ expect(settled).toBe(false);
48
+ expect(events).toEqual([]);
49
+
50
+ release();
51
+ const bundles = await promise;
52
+
53
+ expect(bundles).toEqual([FAKE]);
54
+ expect(factory).toHaveBeenCalled();
55
+ expect(window.__patternslib_container_map[`${FAKE}-./main`]).toBe(true);
56
+ // The event is dispatched after the promise resolved.
57
+ expect(events).toEqual(["loaded"]);
58
+ });
59
+
60
+ it("resolves even when a remote fails to initialize", async () => {
61
+ const error_spy = jest.spyOn(console, "error").mockImplementation(() => {});
62
+ window[BROKEN] = {
63
+ get: jest.fn(async () => {
64
+ throw new Error("boom");
65
+ }),
66
+ };
67
+ window[FAKE] = { get: jest.fn(async () => () => ({})) };
68
+
69
+ require("../webpack/module_federation");
70
+ const bundles = await window.__patternslib_mf_initialized;
71
+
72
+ expect(bundles.sort()).toEqual([BROKEN, FAKE].sort());
73
+ expect(error_spy).toHaveBeenCalledWith(
74
+ expect.stringContaining(BROKEN),
75
+ expect.any(Error),
76
+ );
77
+ expect(window.__patternslib_container_map[`${FAKE}-./main`]).toBe(true);
78
+ expect(window.__patternslib_container_map[`${BROKEN}-./main`]).toBeUndefined();
79
+ expect(events).toEqual(["loaded"]);
80
+ });
81
+
82
+ it("waits for the promise a remote's main module exports as default", async () => {
83
+ let release;
84
+ const bundle_code = jest.fn();
85
+ // The main module only starts the dynamic import of the bundle code and
86
+ // exports that promise.
87
+ const main_module = {
88
+ default: new Promise((resolve) => (release = () => resolve(bundle_code()))),
89
+ };
90
+ window[FAKE] = { get: jest.fn(async () => () => main_module) };
91
+
92
+ require("../webpack/module_federation");
93
+
94
+ let settled = false;
95
+ window.__patternslib_mf_initialized.then(() => (settled = true));
96
+ await new Promise((resolve) => setTimeout(resolve, 10));
97
+
98
+ // main has run, but the bundle code has not — still waiting.
99
+ expect(window[FAKE].get).toHaveBeenCalled();
100
+ expect(settled).toBe(false);
101
+ expect(events).toEqual([]);
102
+
103
+ release();
104
+ await window.__patternslib_mf_initialized;
105
+
106
+ expect(bundle_code).toHaveBeenCalled();
107
+ expect(events).toEqual(["loaded"]);
108
+ });
109
+
110
+ it("resolves immediately when no remotes are registered", async () => {
111
+ require("../webpack/module_federation");
112
+ const bundles = await window.__patternslib_mf_initialized;
113
+ expect(bundles).toEqual([]);
114
+ expect(events).toEqual(["loaded"]);
115
+ });
116
+ });
@@ -22,10 +22,23 @@ export async function initialize_remote({ remote_name, exposed_module = "./main"
22
22
  const factory = await container.get(exposed_module);
23
23
  const module = factory();
24
24
 
25
+ // A remote's main module usually only does a dynamic import of the
26
+ // actual bundle code (``import("./bundle")``) — the async boundary
27
+ // webpack needs to consume shared modules. The patterns and components
28
+ // are only registered once that chunk has run. If the main module
29
+ // exports that import promise as its default export
30
+ // (``export default import("./bundle")``), wait for it, so that
31
+ // ``__patternslib_mf_initialized`` really resolves after the remote's
32
+ // registrations are done. Remotes without such an export keep working
33
+ // as before.
34
+ if (typeof module?.default?.then === "function") {
35
+ await module.default;
36
+ }
37
+
25
38
  container_map[`${remote_name}-${exposed_module}`] = true;
26
39
 
27
40
  console.debug(
28
- `Patternslib Module Federation: Loaded and initialized bundle "${remote_name}".`
41
+ `Patternslib Module Federation: Loaded and initialized bundle "${remote_name}".`,
29
42
  );
30
43
 
31
44
  return module;
@@ -41,17 +54,41 @@ function document_ready(fn) {
41
54
  }
42
55
  }
43
56
 
44
- document_ready(function () {
57
+ // A promise which resolves once all Module Federation enabled bundles have
58
+ // been loaded and initialized (or failed to do so). It is created right at
59
+ // module load time, so consumers like the Patternslib registry can wait for
60
+ // it no matter whether they run before or after document ready.
61
+ // The Patternslib registry uses this to defer the initial DOM scan until all
62
+ // remote bundles had the chance to register their patterns and components.
63
+ let resolve_initialized;
64
+ window.__patternslib_mf_initialized = new Promise((resolve) => {
65
+ resolve_initialized = resolve;
66
+ });
67
+
68
+ document_ready(async function () {
45
69
  // Automatically initialize all Module Federation enabled Patternslib based
46
70
  // bundles by filtering for the prefix ``__patternslib_mf__``.
47
71
  // Do this on document ready, as this is the time where all MF bundles have
48
72
  // been registered in the global namespace.
49
73
  const bundles = Object.keys(window).filter((it) => it.indexOf(MF_NAME_PREFIX) === 0);
50
- for (const bundle_name of bundles) {
51
- // Now load + initialize each bundle.
52
- initialize_remote({ remote_name: bundle_name });
74
+
75
+ // Load + initialize all bundles in parallel and wait for all of them to
76
+ // settle. A failing bundle must not block the others, nor the
77
+ // initialization of the page.
78
+ const results = await Promise.allSettled(
79
+ bundles.map((bundle_name) => initialize_remote({ remote_name: bundle_name })),
80
+ );
81
+ for (const [index, result] of results.entries()) {
82
+ if (result.status === "rejected") {
83
+ console.error(
84
+ `Patternslib Module Federation: Failed to initialize bundle "${bundles[index]}".`,
85
+ result.reason,
86
+ );
87
+ }
53
88
  }
89
+
90
+ resolve_initialized(bundles);
54
91
  document.dispatchEvent(
55
- new Event("patternslib__mf--loaded", { bubbles: true, cancelable: false })
92
+ new Event("patternslib__mf--loaded", { bubbles: true, cancelable: false }),
56
93
  );
57
94
  });