@module-federation/utilities 1.2.0 → 1.3.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/CHANGELOG.md CHANGED
@@ -2,81 +2,76 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
- # [1.2.0](https://github.com/module-federation/nextjs-mf/compare/utils-1.1.2...utils-1.2.0) (2023-01-31)
6
-
7
-
8
- ### Bug Fixes
9
-
10
- * **typescript:** throw error when `vue-tsc` is requested and is not available ([#547](https://github.com/module-federation/nextjs-mf/issues/547)) ([c6f7998](https://github.com/module-federation/nextjs-mf/commit/c6f79981f84fd0042447037c1323fa750566ac0d))
5
+ # [1.3.0](https://github.com/module-federation/nextjs-mf/compare/utils-1.2.1...utils-1.3.0) (2023-02-09)
11
6
 
12
7
 
13
8
  ### Features
14
9
 
15
- * add getModule and getContainer to utilities ([#476](https://github.com/module-federation/nextjs-mf/issues/476)) ([fe381e3](https://github.com/module-federation/nextjs-mf/commit/fe381e33cfb20b3b723daffca2f5c4fb4b843cfb))
16
- * **typescript:** support vue typescript compiler ([#542](https://github.com/module-federation/nextjs-mf/issues/542)) ([cde5952](https://github.com/module-federation/nextjs-mf/commit/cde5952c42ec19f87c5bc4dddb8d8be6f97c1c55)), closes [#502](https://github.com/module-federation/nextjs-mf/issues/502)
10
+ * Delegate Modules ([#509](https://github.com/module-federation/nextjs-mf/issues/509)) ([1a085e7](https://github.com/module-federation/nextjs-mf/commit/1a085e7e03ca0afd5c64389b4b169f3db3382f6b))
17
11
 
18
12
 
19
13
 
20
- ## [1.1.2](https://github.com/module-federation/nextjs-mf/compare/utils-1.1.1...utils-1.1.2) (2023-01-21)
14
+ ## [1.2.1](https://github.com/module-federation/nextjs-mf/compare/utils-1.2.0...utils-1.2.1) (2023-02-09)
21
15
 
22
16
 
23
17
  ### Bug Fixes
24
18
 
25
- * Utilities - Remove module side effect ([#488](https://github.com/module-federation/nextjs-mf/issues/488)) ([3554de7](https://github.com/module-federation/nextjs-mf/commit/3554de7912eaf7b379a6a863677c4b01da0ccf2c)), closes [#487](https://github.com/module-federation/nextjs-mf/issues/487) [#500](https://github.com/module-federation/nextjs-mf/issues/500) [#496](https://github.com/module-federation/nextjs-mf/issues/496) [#495](https://github.com/module-federation/nextjs-mf/issues/495) [#492](https://github.com/module-federation/nextjs-mf/issues/492) [#455](https://github.com/module-federation/nextjs-mf/issues/455) [#491](https://github.com/module-federation/nextjs-mf/issues/491) [#496](https://github.com/module-federation/nextjs-mf/issues/496) [#495](https://github.com/module-federation/nextjs-mf/issues/495)
19
+ * **federation-boundary:** make custom boundary optional ([#570](https://github.com/module-federation/nextjs-mf/issues/570)) ([e43a387](https://github.com/module-federation/nextjs-mf/commit/e43a387f90587d62a78c40584ed9104328202f8e))
20
+ * **utilities:** fix FederationBoundary implementation ([#575](https://github.com/module-federation/nextjs-mf/issues/575)) ([b94fc28](https://github.com/module-federation/nextjs-mf/commit/b94fc282503c4f5ce2ae267518f7d6f5d4746c24))
26
21
 
27
22
 
28
23
 
29
- ## [1.1.1](https://github.com/module-federation/nextjs-mf/compare/utils-1.1.0...utils-1.1.1) (2023-01-11)
24
+ # [1.2.0](https://github.com/module-federation/nextjs-mf/compare/utils-1.1.2...utils-1.2.0) (2023-01-31)
30
25
 
26
+ ### Bug Fixes
31
27
 
28
+ - **typescript:** throw error when `vue-tsc` is requested and is not available ([#547](https://github.com/module-federation/nextjs-mf/issues/547)) ([c6f7998](https://github.com/module-federation/nextjs-mf/commit/c6f79981f84fd0042447037c1323fa750566ac0d))
32
29
 
33
- # [1.1.0](https://github.com/module-federation/nextjs-mf/compare/utils-1.0.4...utils-1.1.0) (2022-12-30)
30
+ ### Features
34
31
 
32
+ - add getModule and getContainer to utilities ([#476](https://github.com/module-federation/nextjs-mf/issues/476)) ([fe381e3](https://github.com/module-federation/nextjs-mf/commit/fe381e33cfb20b3b723daffca2f5c4fb4b843cfb))
33
+ - **typescript:** support vue typescript compiler ([#542](https://github.com/module-federation/nextjs-mf/issues/542)) ([cde5952](https://github.com/module-federation/nextjs-mf/commit/cde5952c42ec19f87c5bc4dddb8d8be6f97c1c55)), closes [#502](https://github.com/module-federation/nextjs-mf/issues/502)
35
34
 
36
- ### Bug Fixes
35
+ ## [1.1.2](https://github.com/module-federation/nextjs-mf/compare/utils-1.1.1...utils-1.1.2) (2023-01-21)
37
36
 
38
- * **utilities:** move tslib from peer deps into deps ([#474](https://github.com/module-federation/nextjs-mf/issues/474)) ([792806c](https://github.com/module-federation/nextjs-mf/commit/792806c805c746cd681d6345bec88a47462cb26f))
39
- * **utilities:** set webpack peer dep to ^5.40.0 ([#473](https://github.com/module-federation/nextjs-mf/issues/473)) ([d1ae77e](https://github.com/module-federation/nextjs-mf/commit/d1ae77e63993b6f67d329bce5a30d04776a02b76))
37
+ ### Bug Fixes
40
38
 
39
+ - Utilities - Remove module side effect ([#488](https://github.com/module-federation/nextjs-mf/issues/488)) ([3554de7](https://github.com/module-federation/nextjs-mf/commit/3554de7912eaf7b379a6a863677c4b01da0ccf2c)), closes [#487](https://github.com/module-federation/nextjs-mf/issues/487) [#500](https://github.com/module-federation/nextjs-mf/issues/500) [#496](https://github.com/module-federation/nextjs-mf/issues/496) [#495](https://github.com/module-federation/nextjs-mf/issues/495) [#492](https://github.com/module-federation/nextjs-mf/issues/492) [#455](https://github.com/module-federation/nextjs-mf/issues/455) [#491](https://github.com/module-federation/nextjs-mf/issues/491) [#496](https://github.com/module-federation/nextjs-mf/issues/496) [#495](https://github.com/module-federation/nextjs-mf/issues/495)
41
40
 
42
- ### Features
41
+ ## [1.1.1](https://github.com/module-federation/nextjs-mf/compare/utils-1.1.0...utils-1.1.1) (2023-01-11)
43
42
 
44
- * Utilities - Add async callback to importRemote ([#459](https://github.com/module-federation/nextjs-mf/issues/459)) ([508d83c](https://github.com/module-federation/nextjs-mf/commit/508d83ca1060e1fcc80cde44978b186bdf1feefc)), closes [#461](https://github.com/module-federation/nextjs-mf/issues/461) [#451](https://github.com/module-federation/nextjs-mf/issues/451) [#463](https://github.com/module-federation/nextjs-mf/issues/463)
43
+ # [1.1.0](https://github.com/module-federation/nextjs-mf/compare/utils-1.0.4...utils-1.1.0) (2022-12-30)
45
44
 
45
+ ### Bug Fixes
46
46
 
47
+ - **utilities:** move tslib from peer deps into deps ([#474](https://github.com/module-federation/nextjs-mf/issues/474)) ([792806c](https://github.com/module-federation/nextjs-mf/commit/792806c805c746cd681d6345bec88a47462cb26f))
48
+ - **utilities:** set webpack peer dep to ^5.40.0 ([#473](https://github.com/module-federation/nextjs-mf/issues/473)) ([d1ae77e](https://github.com/module-federation/nextjs-mf/commit/d1ae77e63993b6f67d329bce5a30d04776a02b76))
47
49
 
48
- ## [1.0.4](https://github.com/module-federation/nextjs-mf/compare/utils-1.0.3...utils-1.0.4) (2022-12-29)
50
+ ### Features
49
51
 
52
+ - Utilities - Add async callback to importRemote ([#459](https://github.com/module-federation/nextjs-mf/issues/459)) ([508d83c](https://github.com/module-federation/nextjs-mf/commit/508d83ca1060e1fcc80cde44978b186bdf1feefc)), closes [#461](https://github.com/module-federation/nextjs-mf/issues/461) [#451](https://github.com/module-federation/nextjs-mf/issues/451) [#463](https://github.com/module-federation/nextjs-mf/issues/463)
50
53
 
54
+ ## [1.0.4](https://github.com/module-federation/nextjs-mf/compare/utils-1.0.3...utils-1.0.4) (2022-12-29)
51
55
 
52
56
  ## [1.0.3](https://github.com/module-federation/nextjs-mf/compare/utils-1.0.2...utils-1.0.3) (2022-12-27)
53
57
 
54
-
55
58
  ### Bug Fixes
56
59
 
57
- * bad references to webpack globals ([#458](https://github.com/module-federation/nextjs-mf/issues/458)) ([8ef224b](https://github.com/module-federation/nextjs-mf/commit/8ef224bd08f1e39475cac3795f09debae50bbc0f))
58
-
59
-
60
+ - bad references to webpack globals ([#458](https://github.com/module-federation/nextjs-mf/issues/458)) ([8ef224b](https://github.com/module-federation/nextjs-mf/commit/8ef224bd08f1e39475cac3795f09debae50bbc0f))
60
61
 
61
62
  ## [1.0.2](https://github.com/module-federation/nextjs-mf/compare/utils-1.0.1...utils-1.0.2) (2022-12-27)
62
63
 
63
-
64
-
65
64
  ## [1.0.1](https://github.com/module-federation/nextjs-mf/compare/utils-1.0.0...utils-1.0.1) (2022-11-20)
66
65
 
67
-
68
-
69
66
  # [1.0.0](https://github.com/module-federation/nextjs-mf/compare/utils-0.5.0...utils-1.0.0) (2022-11-20)
70
67
 
71
-
72
68
  ### Features
73
69
 
74
- * **typescript:** excessive recompilation prevention ([#306](https://github.com/module-federation/nextjs-mf/issues/306)) ([6e1967f](https://github.com/module-federation/nextjs-mf/commit/6e1967f019afb25dfbcfe83627b08ae8b1fe97b2))
75
-
70
+ - **typescript:** excessive recompilation prevention ([#306](https://github.com/module-federation/nextjs-mf/issues/306)) ([6e1967f](https://github.com/module-federation/nextjs-mf/commit/6e1967f019afb25dfbcfe83627b08ae8b1fe97b2))
76
71
 
77
72
  ### BREAKING CHANGES
78
73
 
79
- * **typescript:** Reimplemented the whole plugin from round-up to enhance performance, prevent excessive recompilation and other issues.
74
+ - **typescript:** Reimplemented the whole plugin from round-up to enhance performance, prevent excessive recompilation and other issues.
80
75
 
81
76
  Some key changes to the plugin includes:
82
77
 
@@ -86,19 +81,15 @@ Some key changes to the plugin includes:
86
81
 
87
82
  Please go through plugin `readme.md` file to understand what's changed and how to use the plugin.
88
83
 
89
-
90
-
91
84
  # [1.0.0](https://github.com/module-federation/nextjs-mf/compare/utils-0.5.0...utils-1.0.0) (2022-11-20)
92
85
 
93
-
94
86
  ### Features
95
87
 
96
- * **typescript:** excessive recompilation prevention ([#306](https://github.com/module-federation/nextjs-mf/issues/306)) ([6e1967f](https://github.com/module-federation/nextjs-mf/commit/6e1967f019afb25dfbcfe83627b08ae8b1fe97b2))
97
-
88
+ - **typescript:** excessive recompilation prevention ([#306](https://github.com/module-federation/nextjs-mf/issues/306)) ([6e1967f](https://github.com/module-federation/nextjs-mf/commit/6e1967f019afb25dfbcfe83627b08ae8b1fe97b2))
98
89
 
99
90
  ### BREAKING CHANGES
100
91
 
101
- * **typescript:** Reimplemented the whole plugin from round-up to enhance performance, prevent excessive recompilation and other issues.
92
+ - **typescript:** Reimplemented the whole plugin from round-up to enhance performance, prevent excessive recompilation and other issues.
102
93
 
103
94
  Some key changes to the plugin includes:
104
95
 
@@ -108,125 +99,81 @@ Some key changes to the plugin includes:
108
99
 
109
100
  Please go through plugin `readme.md` file to understand what's changed and how to use the plugin.
110
101
 
111
-
112
-
113
102
  # [0.5.0](https://github.com/module-federation/nextjs-mf/compare/utils-0.4.1...utils-0.5.0) (2022-10-31)
114
103
 
115
-
116
104
  ### Features
117
105
 
118
- * **utils:** configurable logger using webpack infrastructure logger ([#355](https://github.com/module-federation/nextjs-mf/issues/355)) ([d6ffcd0](https://github.com/module-federation/nextjs-mf/commit/d6ffcd0de1662c410f33a7742db1fd02aba24aef)), closes [#243](https://github.com/module-federation/nextjs-mf/issues/243)
119
-
120
-
106
+ - **utils:** configurable logger using webpack infrastructure logger ([#355](https://github.com/module-federation/nextjs-mf/issues/355)) ([d6ffcd0](https://github.com/module-federation/nextjs-mf/commit/d6ffcd0de1662c410f33a7742db1fd02aba24aef)), closes [#243](https://github.com/module-federation/nextjs-mf/issues/243)
121
107
 
122
108
  ## [0.4.1](https://github.com/module-federation/nextjs-mf/compare/utils-0.4.0...utils-0.4.1) (2022-10-26)
123
109
 
124
-
125
110
  ### Bug Fixes
126
111
 
127
- * set peer dependencies ([#341](https://github.com/module-federation/nextjs-mf/issues/341)) ([fec9608](https://github.com/module-federation/nextjs-mf/commit/fec960813a4e3859a5fb24863bb55e463a2fdfa3))
128
-
129
-
112
+ - set peer dependencies ([#341](https://github.com/module-federation/nextjs-mf/issues/341)) ([fec9608](https://github.com/module-federation/nextjs-mf/commit/fec960813a4e3859a5fb24863bb55e463a2fdfa3))
130
113
 
131
114
  # [0.4.0](https://github.com/module-federation/nextjs-mf/compare/utils-0.3.4...utils-0.4.0) (2022-10-26)
132
115
 
133
-
134
116
  ### Features
135
117
 
136
- * Automatic Async boundary loader ([#330](https://github.com/module-federation/nextjs-mf/issues/330)) ([7e3c08c](https://github.com/module-federation/nextjs-mf/commit/7e3c08cf7835c0407bdce7ed6865b864153074a4))
137
-
138
-
118
+ - Automatic Async boundary loader ([#330](https://github.com/module-federation/nextjs-mf/issues/330)) ([7e3c08c](https://github.com/module-federation/nextjs-mf/commit/7e3c08cf7835c0407bdce7ed6865b864153074a4))
139
119
 
140
120
  ## [0.3.4](https://github.com/module-federation/nextjs-mf/compare/utils-0.3.3...utils-0.3.4) (2022-10-17)
141
121
 
142
-
143
122
  ### Bug Fixes
144
123
 
145
- * remove exports field from package.json ([#318](https://github.com/module-federation/nextjs-mf/issues/318)) ([a9148ae](https://github.com/module-federation/nextjs-mf/commit/a9148ae27f1c05fe4c1586ed5769c79054a7033e))
146
-
147
-
124
+ - remove exports field from package.json ([#318](https://github.com/module-federation/nextjs-mf/issues/318)) ([a9148ae](https://github.com/module-federation/nextjs-mf/commit/a9148ae27f1c05fe4c1586ed5769c79054a7033e))
148
125
 
149
126
  ## [0.3.3](https://github.com/module-federation/nextjs-mf/compare/utils-0.3.2...utils-0.3.3) (2022-10-13)
150
127
 
151
-
152
128
  ### Bug Fixes
153
129
 
154
- * **typescript:** fix exposePages type ([#309](https://github.com/module-federation/nextjs-mf/issues/309)) ([c0be839](https://github.com/module-federation/nextjs-mf/commit/c0be839787f97c5e23cea3d7cf501caaa469972f))
155
-
156
-
130
+ - **typescript:** fix exposePages type ([#309](https://github.com/module-federation/nextjs-mf/issues/309)) ([c0be839](https://github.com/module-federation/nextjs-mf/commit/c0be839787f97c5e23cea3d7cf501caaa469972f))
157
131
 
158
132
  ## [0.3.2](https://github.com/module-federation/nextjs-mf/compare/utils-0.3.1...utils-0.3.2) (2022-10-12)
159
133
 
160
-
161
-
162
134
  ## [0.3.1](https://github.com/module-federation/nextjs-mf/compare/utils-0.3.0...utils-0.3.1) (2022-10-11)
163
135
 
164
-
165
-
166
136
  # [0.3.0](https://github.com/module-federation/nextjs-mf/compare/utils-0.2.1...utils-0.3.0) (2022-10-07)
167
137
 
168
-
169
138
  ### Features
170
139
 
171
- * implement __webpack_require__.l functionality in server builds ([99d1231](https://github.com/module-federation/nextjs-mf/commit/99d12314f68ac526000fa5410a14072a11b260a4))
172
-
173
-
140
+ - implement **webpack_require**.l functionality in server builds ([99d1231](https://github.com/module-federation/nextjs-mf/commit/99d12314f68ac526000fa5410a14072a11b260a4))
174
141
 
175
142
  ## [0.2.1](https://github.com/module-federation/nextjs-mf/compare/utils-0.2.0...utils-0.2.1) (2022-10-07)
176
143
 
177
-
178
144
  ### Bug Fixes
179
145
 
180
- * fix node plugin fs augments when outside next child compiler ([#284](https://github.com/module-federation/nextjs-mf/issues/284)) ([dfa99c8](https://github.com/module-federation/nextjs-mf/commit/dfa99c86fdd8d73091764532d52be5f81b89a508))
181
- * **package.json:** fix package export fields for utils ([#285](https://github.com/module-federation/nextjs-mf/issues/285)) ([99d6b77](https://github.com/module-federation/nextjs-mf/commit/99d6b779696b5dbebea9cf3c870a5caa5d9d7c6f))
182
-
183
-
146
+ - fix node plugin fs augments when outside next child compiler ([#284](https://github.com/module-federation/nextjs-mf/issues/284)) ([dfa99c8](https://github.com/module-federation/nextjs-mf/commit/dfa99c86fdd8d73091764532d52be5f81b89a508))
147
+ - **package.json:** fix package export fields for utils ([#285](https://github.com/module-federation/nextjs-mf/issues/285)) ([99d6b77](https://github.com/module-federation/nextjs-mf/commit/99d6b779696b5dbebea9cf3c870a5caa5d9d7c6f))
184
148
 
185
149
  ## [0.2.1](https://github.com/module-federation/nextjs-mf/compare/utils-0.2.0...utils-0.2.1) (2022-10-07)
186
150
 
187
-
188
151
  ### Bug Fixes
189
152
 
190
- * fix node plugin fs augments when outside next child compiler ([#284](https://github.com/module-federation/nextjs-mf/issues/284)) ([dfa99c8](https://github.com/module-federation/nextjs-mf/commit/dfa99c86fdd8d73091764532d52be5f81b89a508))
191
- * **package.json:** fix package export fields for utils ([#285](https://github.com/module-federation/nextjs-mf/issues/285)) ([99d6b77](https://github.com/module-federation/nextjs-mf/commit/99d6b779696b5dbebea9cf3c870a5caa5d9d7c6f))
192
-
193
-
153
+ - fix node plugin fs augments when outside next child compiler ([#284](https://github.com/module-federation/nextjs-mf/issues/284)) ([dfa99c8](https://github.com/module-federation/nextjs-mf/commit/dfa99c86fdd8d73091764532d52be5f81b89a508))
154
+ - **package.json:** fix package export fields for utils ([#285](https://github.com/module-federation/nextjs-mf/issues/285)) ([99d6b77](https://github.com/module-federation/nextjs-mf/commit/99d6b779696b5dbebea9cf3c870a5caa5d9d7c6f))
194
155
 
195
156
  ## [0.2.1](https://github.com/module-federation/nextjs-mf/compare/utils-0.2.0...utils-0.2.1) (2022-10-06)
196
157
 
197
-
198
158
  ### Bug Fixes
199
159
 
200
- * fix node plugin fs augments when outside next child compiler ([#284](https://github.com/module-federation/nextjs-mf/issues/284)) ([dfa99c8](https://github.com/module-federation/nextjs-mf/commit/dfa99c86fdd8d73091764532d52be5f81b89a508))
201
- * **package.json:** fix package export fields for utils ([#285](https://github.com/module-federation/nextjs-mf/issues/285)) ([99d6b77](https://github.com/module-federation/nextjs-mf/commit/99d6b779696b5dbebea9cf3c870a5caa5d9d7c6f))
202
-
203
-
160
+ - fix node plugin fs augments when outside next child compiler ([#284](https://github.com/module-federation/nextjs-mf/issues/284)) ([dfa99c8](https://github.com/module-federation/nextjs-mf/commit/dfa99c86fdd8d73091764532d52be5f81b89a508))
161
+ - **package.json:** fix package export fields for utils ([#285](https://github.com/module-federation/nextjs-mf/issues/285)) ([99d6b77](https://github.com/module-federation/nextjs-mf/commit/99d6b779696b5dbebea9cf3c870a5caa5d9d7c6f))
204
162
 
205
163
  ## [0.2.1](https://github.com/module-federation/nextjs-mf/compare/utils-0.2.0...utils-0.2.1) (2022-10-06)
206
164
 
207
-
208
165
  ### Bug Fixes
209
166
 
210
- * fix node plugin fs augments when outside next child compiler ([#284](https://github.com/module-federation/nextjs-mf/issues/284)) ([dfa99c8](https://github.com/module-federation/nextjs-mf/commit/dfa99c86fdd8d73091764532d52be5f81b89a508))
211
-
212
-
167
+ - fix node plugin fs augments when outside next child compiler ([#284](https://github.com/module-federation/nextjs-mf/issues/284)) ([dfa99c8](https://github.com/module-federation/nextjs-mf/commit/dfa99c86fdd8d73091764532d52be5f81b89a508))
213
168
 
214
169
  # [0.2.0](https://github.com/module-federation/nextjs-mf/compare/utils-0.1.0...utils-0.2.0) (2022-10-06)
215
170
 
216
-
217
-
218
171
  ## [0.1.1](https://github.com/module-federation/nextjs-mf/compare/utils-0.1.0...utils-0.1.1) (2022-10-06)
219
172
 
220
-
221
-
222
173
  ## [0.1.1](https://github.com/module-federation/nextjs-mf/compare/utils-0.1.0...utils-0.1.1) (2022-10-06)
223
174
 
224
-
225
-
226
175
  ## [0.1.1](https://github.com/module-federation/nextjs-mf/compare/utils-0.1.0...utils-0.1.1) (2022-10-06)
227
176
 
228
-
229
-
230
177
  ## [0.1.1](https://github.com/module-federation/nextjs-mf/compare/utils-0.1.0...utils-0.1.1) (2022-10-06)
231
178
 
232
179
  # [0.2.0](https://github.com/module-federation/nextjs-mf/compare/utils-0.1.0...utils-0.2.0) (2022-10-05)
package/README.md CHANGED
@@ -25,15 +25,19 @@ Any extra props will be passed directly to the imported module.
25
25
  Usage looks something like this:
26
26
 
27
27
  ```js
28
- import { FederationBoundary } from '@module-federation/utilities/src/react';
28
+ import { FederationBoundary } from '@module-federation/utilities/src/utils/react';
29
+
30
+ // defining dynamicImport and fallback outside the Component to keep the component identity
31
+ // another alternative would be to use useMemo
32
+ const dynamicImport = () =>
33
+ import('some_remote_host_name').then((m) => m.Component);
34
+ const fallback = () => import('@npm/backup').then((m) => m.Component);
29
35
 
30
36
  const MyPage = () => {
31
37
  return (
32
38
  <FederationBoundary
33
- dynamicImport={() =>
34
- import('some_remote_host_name').then((m) => m.Component)
35
- }
36
- fallback={() => import('@npm/backup').then((m) => m.Component)}
39
+ dynamicImporter={dynamicImport}
40
+ fallback={fallback}
37
41
  customBoundary={CustomErrorBoundary}
38
42
  />
39
43
  );
@@ -114,6 +118,24 @@ return (
114
118
  );
115
119
  ```
116
120
 
121
+ ```js
122
+ // You can also combine importRemote and FederationBoundary to have a dynamic remote URL and a fallback when there is an error on the remote
123
+
124
+ const dynamicImporter = () =>
125
+ importRemote({
126
+ url: 'http://localhost:3001',
127
+ scope: 'Foo',
128
+ module: 'Bar',
129
+ });
130
+ const fallback = () => import('@npm/backup').then((m) => m.Component);
131
+
132
+ const Bar = () => {
133
+ return (
134
+ <FederationBoundary dynamicImporter={dynamicImporter} fallback={fallback} />
135
+ );
136
+ };
137
+ ```
138
+
117
139
  Apart from **url**, **scope** and **module** you can also pass additional options to the **importRemote()** function:
118
140
 
119
141
  - **remoteEntryFileName**: The name of the remote entry file. Defaults to "remoteEntry.js".
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/utilities",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "type": "commonjs",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -9,19 +9,25 @@
9
9
  "registry": "https://registry.npmjs.org/"
10
10
  },
11
11
  "repository": "https://github.com/module-federation/nextjs-mf/tree/main/packages/utilities",
12
- "optionalDependencies": {
13
- "react": "^17 || ^18",
14
- "next": "^12 || ^13"
15
- },
16
12
  "devDependencies": {
17
- "react": "18.2.0",
18
- "next": "13.1.6"
13
+ "next": "13.1.6",
14
+ "react": "18.2.0"
19
15
  },
20
16
  "peerDependencies": {
21
- "webpack": "^5.40.0",
22
- "next": "13.1.6"
17
+ "next": "^12 || ^13",
18
+ "react": "^16 || ^17 || ^18",
19
+ "react-dom": "^16 || ^17 || ^18",
20
+ "webpack": "^5.40.0"
23
21
  },
24
- "dependencies": {
25
- "tslib": "2.4.0"
22
+ "peerDependenciesMeta": {
23
+ "next": {
24
+ "optional": true
25
+ },
26
+ "react": {
27
+ "optional": true
28
+ },
29
+ "react-dom": {
30
+ "optional": true
31
+ }
26
32
  }
27
33
  }
package/src/Logger.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Compilation } from 'webpack';
2
- export declare type LoggerInstance = Compilation['logger'] | Console;
2
+ export type LoggerInstance = Compilation['logger'] | Console;
3
3
  export declare class Logger {
4
4
  private static loggerInstance;
5
5
  static getLogger(): LoggerInstance;
@@ -0,0 +1,19 @@
1
+ import React, { type ErrorInfo } from 'react';
2
+ export interface ErrorBoundaryProps {
3
+ children: React.ReactNode;
4
+ }
5
+ export interface ErrorBoundaryState {
6
+ hasError: boolean;
7
+ }
8
+ /**
9
+ * Generic error boundary component.
10
+ */
11
+ declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
12
+ constructor(props: ErrorBoundaryProps);
13
+ static getDerivedStateFromError(): {
14
+ hasError: boolean;
15
+ };
16
+ componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
17
+ render(): React.ReactNode;
18
+ }
19
+ export default ErrorBoundary;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ var react_1 = tslib_1.__importDefault(require("react"));
5
+ /**
6
+ * Generic error boundary component.
7
+ */
8
+ var ErrorBoundary = /** @class */ (function (_super) {
9
+ tslib_1.__extends(ErrorBoundary, _super);
10
+ function ErrorBoundary(props) {
11
+ var _this = _super.call(this, props) || this;
12
+ _this.state = {
13
+ hasError: false,
14
+ };
15
+ return _this;
16
+ }
17
+ ErrorBoundary.getDerivedStateFromError = function ( /*error: Error*/) {
18
+ return {
19
+ hasError: true,
20
+ };
21
+ };
22
+ ErrorBoundary.prototype.componentDidCatch = function (error, errorInfo) {
23
+ console.error(error, errorInfo);
24
+ };
25
+ ErrorBoundary.prototype.render = function () {
26
+ if (this.state.hasError) {
27
+ return 'An error has occurred.';
28
+ }
29
+ return this.props.children;
30
+ };
31
+ return ErrorBoundary;
32
+ }(react_1.default.Component));
33
+ exports.default = ErrorBoundary;
34
+ //# sourceMappingURL=ErrorBoundary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorBoundary.js","sourceRoot":"","sources":["../../../../../packages/utilities/src/components/ErrorBoundary.tsx"],"names":[],"mappings":";;;AAAA,wDAA8C;AAU9C;;GAEG;AACH;IAA4B,yCAG3B;IACC,uBAAY,KAAyB;QAArC,YACE,kBAAM,KAAK,CAAC,SAIb;QAHC,KAAI,CAAC,KAAK,GAAG;YACX,QAAQ,EAAE,KAAK;SAChB,CAAC;;IACJ,CAAC;IAEM,sCAAwB,GAA/B,WAAgC,gBAAgB;QAC9C,OAAO;YACL,QAAQ,EAAE,IAAI;SACf,CAAC;IACJ,CAAC;IAEQ,yCAAiB,GAA1B,UAA2B,KAAY,EAAE,SAAoB;QAC3D,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAClC,CAAC;IAEQ,8BAAM,GAAf;QACE,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;YACvB,OAAO,wBAAwB,CAAC;SACjC;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;IACH,oBAAC;AAAD,CAAC,AA5BD,CAA4B,eAAK,CAAC,SAAS,GA4B1C;AAED,kBAAe,aAAa,CAAC"}
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import type { ComponentClass, ComponentType, PropsWithChildren } from 'react';
3
+ export interface FederationBoundaryProps {
4
+ dynamicImporter: () => Promise<ComponentType<any>>;
5
+ fallback?: () => Promise<ComponentType<any>>;
6
+ customBoundary?: ComponentClass<PropsWithChildren<any>>;
7
+ [props: string]: any;
8
+ }
9
+ /**
10
+ * Wrapper around dynamic import.
11
+ * Adds error boundaries and fallback options.
12
+ */
13
+ declare const FederationBoundary: React.FC<FederationBoundaryProps>;
14
+ export default FederationBoundary;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ var react_1 = tslib_1.__importStar(require("react"));
5
+ var dynamic_1 = tslib_1.__importDefault(require("next/dynamic"));
6
+ var ErrorBoundary_1 = tslib_1.__importDefault(require("./ErrorBoundary"));
7
+ /**
8
+ * A fallback component that renders nothing.
9
+ */
10
+ var FallbackComponent = function () {
11
+ return null;
12
+ };
13
+ /**
14
+ * Wrapper around dynamic import.
15
+ * Adds error boundaries and fallback options.
16
+ */
17
+ var FederationBoundary = function (_a) {
18
+ var dynamicImporter = _a.dynamicImporter, _b = _a.fallback, fallback = _b === void 0 ? function () { return Promise.resolve(FallbackComponent); } : _b, _c = _a.customBoundary, CustomBoundary = _c === void 0 ? ErrorBoundary_1.default : _c, rest = tslib_1.__rest(_a, ["dynamicImporter", "fallback", "customBoundary"]);
19
+ var ImportResult = (0, react_1.useMemo)(function () {
20
+ return (0, dynamic_1.default)(function () {
21
+ return dynamicImporter().catch(function (e) {
22
+ console.error(e);
23
+ return fallback();
24
+ });
25
+ }, {
26
+ ssr: false,
27
+ });
28
+ }, [dynamicImporter, fallback]);
29
+ return (react_1.default.createElement(CustomBoundary, null,
30
+ react_1.default.createElement(ImportResult, tslib_1.__assign({}, rest))));
31
+ };
32
+ exports.default = FederationBoundary;
33
+ //# sourceMappingURL=FederationBoundary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FederationBoundary.js","sourceRoot":"","sources":["../../../../../packages/utilities/src/components/FederationBoundary.tsx"],"names":[],"mappings":";;;AAAA,qDAAuC;AAEvC,iEAAmC;AACnC,0EAA4C;AAE5C;;GAEG;AACH,IAAM,iBAAiB,GAAa;IAClC,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAaF;;;GAGG;AACH,IAAM,kBAAkB,GAAsC,UAAC,EAK9D;IAJC,IAAA,eAAe,qBAAA,EACf,gBAAmD,EAAnD,QAAQ,mBAAG,cAAM,OAAA,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAlC,CAAkC,KAAA,EACnD,sBAA8C,EAA9B,cAAc,mBAAG,uBAAa,KAAA,EAC3C,IAAI,sBAJsD,iDAK9D,CADQ;IAEP,IAAM,YAAY,GAAG,IAAA,eAAO,EAAC;QAC3B,OAAO,IAAA,iBAAO,EACZ;YACE,OAAA,eAAe,EAAE,CAAC,KAAK,CAAC,UAAC,CAAQ;gBAC/B,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACjB,OAAO,QAAQ,EAAE,CAAC;YACpB,CAAC,CAAC;QAHF,CAGE,EACJ;YACE,GAAG,EAAE,KAAK;SACX,CACF,CAAC;IACJ,CAAC,EAAE,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEhC,OAAO,CACL,8BAAC,cAAc;QACb,8BAAC,YAAY,uBAAK,IAAI,EAAI,CACX,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,kBAAkB,CAAC"}
@@ -1,10 +1,10 @@
1
1
  /// <reference types="webpack/module" />
2
2
  import type { container, WebpackOptionsNormalized } from 'webpack';
3
- export declare type ModuleFederationPluginOptions = ConstructorParameters<typeof container.ModuleFederationPlugin>['0'];
4
- export declare type WebpackRequire = {
5
- l: (url: string, cb: (event: any) => void, id: string) => Record<string, unknown>;
3
+ export type ModuleFederationPluginOptions = ConstructorParameters<typeof container.ModuleFederationPlugin>['0'];
4
+ export type WebpackRequire = {
5
+ l: (url: string | undefined, cb: (event: any) => void, id: string | number) => Record<string, unknown>;
6
6
  };
7
- export declare type WebpackShareScopes = Record<string, Record<string, {
7
+ export type WebpackShareScopes = Record<string, Record<string, {
8
8
  loaded?: 1;
9
9
  get: () => Promise<unknown>;
10
10
  from: string;
@@ -24,41 +24,42 @@ export interface NextFederationPluginExtraOptions {
24
24
  export interface NextFederationPluginOptions extends ModuleFederationPluginOptions {
25
25
  extraOptions: NextFederationPluginExtraOptions;
26
26
  }
27
- export declare type Shared = ModuleFederationPluginOptions['shared'];
28
- export declare type Remotes = ModuleFederationPluginOptions['remotes'];
29
- export declare type SharedObject = Extract<Shared, ModuleFederationPluginOptions>;
30
- export declare type SharedConfig = Extract<SharedObject[keyof SharedObject], {
27
+ export type Shared = ModuleFederationPluginOptions['shared'];
28
+ export type Remotes = ModuleFederationPluginOptions['remotes'];
29
+ export type SharedObject = Extract<Shared, ModuleFederationPluginOptions>;
30
+ export type SharedConfig = Extract<SharedObject[keyof SharedObject], {
31
31
  eager?: boolean;
32
32
  }>;
33
- export declare type ExternalsType = Required<ModuleFederationPluginOptions['remoteType']>;
34
- declare type ModulePath = string;
35
- export declare type WebpackRemoteContainer = {
33
+ export type ExternalsType = Required<ModuleFederationPluginOptions['remoteType']>;
34
+ type ModulePath = string;
35
+ export type WebpackRemoteContainer = {
36
+ __initialized?: boolean;
36
37
  get(modulePath: ModulePath): () => any;
37
38
  init: (obj?: typeof __webpack_share_scopes__) => void;
38
39
  };
39
- export declare type AsyncContainer = Promise<WebpackRemoteContainer>;
40
- export declare type RemoteData = {
40
+ export type AsyncContainer = Promise<WebpackRemoteContainer>;
41
+ export type RemoteData = {
41
42
  global: string;
42
43
  url: string;
43
44
  uniqueKey?: string;
44
45
  };
45
- export declare type RuntimeRemote = Partial<RemoteData> & {
46
+ export type RuntimeRemote = Partial<RemoteData> & {
46
47
  asyncContainer?: AsyncContainer;
47
48
  };
48
- export declare type RuntimeRemotesMap = Record<string, RuntimeRemote>;
49
- declare type Module = WebpackOptionsNormalized['module'];
50
- declare type Rules = Module['rules'];
51
- export declare type RuleSetRuleUnion = Rules[0];
52
- declare type RuleSetRule = Extract<RuleSetRuleUnion, {
49
+ export type RuntimeRemotesMap = Record<string, RuntimeRemote>;
50
+ type Module = WebpackOptionsNormalized['module'];
51
+ type Rules = Module['rules'];
52
+ export type RuleSetRuleUnion = Rules[0];
53
+ type RuleSetRule = Extract<RuleSetRuleUnion, {
53
54
  loader?: string;
54
55
  }>;
55
- export declare type Loader = Extract<RuleSetRule['use'], {
56
+ export type Loader = Extract<RuleSetRule['use'], {
56
57
  loader?: string;
57
58
  }>;
58
- export declare type EventTypes = 'loadStart' | 'loadComplete' | 'loadError';
59
- declare type NextRoute = string;
60
- export declare type PageMap = Record<NextRoute, ModulePath>;
61
- export declare type GetModuleOptions = {
59
+ export type EventTypes = 'loadStart' | 'loadComplete' | 'loadError';
60
+ type NextRoute = string;
61
+ export type PageMap = Record<NextRoute, ModulePath>;
62
+ export type GetModuleOptions = {
62
63
  modulePath: string;
63
64
  exportName?: string;
64
65
  remoteContainer: string | RemoteData;
@@ -1,5 +1,9 @@
1
1
  import type { Remotes, RuntimeRemote, WebpackRemoteContainer, RemoteData, GetModuleOptions } from '../types';
2
2
  export declare const extractUrlAndGlobal: (urlAndGlobal: string) => [string, string];
3
+ export declare const importDelegatedModule: (keyOrRuntimeRemoteItem: string | RuntimeRemote) => Promise<any>;
4
+ export declare const createDelegatedModule: (delegate: string, params: {
5
+ [key: string]: any;
6
+ }) => string;
3
7
  /**
4
8
  * Return initialized remote container by remote's key or its runtime remote item data.
5
9
  *
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /* eslint-disable @typescript-eslint/ban-ts-comment */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getModule = exports.getContainer = exports.createRuntimeVariables = exports.injectScript = exports.extractUrlAndGlobal = void 0;
4
+ exports.getModule = exports.getContainer = exports.createRuntimeVariables = exports.injectScript = exports.createDelegatedModule = exports.importDelegatedModule = exports.extractUrlAndGlobal = void 0;
5
5
  var tslib_1 = require("tslib");
6
6
  // split the @ syntax into url and global
7
7
  var extractUrlAndGlobal = function (urlAndGlobal) {
@@ -13,43 +13,96 @@ var extractUrlAndGlobal = function (urlAndGlobal) {
13
13
  };
14
14
  exports.extractUrlAndGlobal = extractUrlAndGlobal;
15
15
  var getRuntimeRemotes = function () {
16
- //@ts-ignore
17
- var remoteVars = (process.env.REMOTES || {});
18
- var runtimeRemotes = Object.entries(remoteVars).reduce(function (acc, item) {
19
- var key = item[0], value = item[1];
20
- // if its an object with a thenable (eagerly executing function)
21
- if (typeof value === 'object' && typeof value.then === 'function') {
22
- acc[key] = { asyncContainer: value };
23
- }
24
- // if its a function that must be called (lazily executing function)
25
- else if (typeof value === 'function') {
26
- // @ts-ignore
27
- acc[key] = { asyncContainer: value };
28
- }
29
- // if its just a string (global@url)
30
- else if (typeof value === 'string') {
31
- var _a = (0, exports.extractUrlAndGlobal)(value), url = _a[0], global_1 = _a[1];
32
- acc[key] = { global: global_1, url: url };
33
- }
34
- // we dont know or currently support this type
35
- else {
36
- //@ts-ignore
37
- console.log('remotes process', process.env.REMOTES);
38
- throw new Error("[mf] Invalid value received for runtime_remote \"".concat(key, "\""));
16
+ try {
17
+ //@ts-ignore
18
+ var remoteVars = (process.env.REMOTES || {});
19
+ var runtimeRemotes = Object.entries(remoteVars).reduce(function (acc, item) {
20
+ var key = item[0], value = item[1];
21
+ // if its an object with a thenable (eagerly executing function)
22
+ if (typeof value === 'object' && typeof value.then === 'function') {
23
+ acc[key] = { asyncContainer: value };
24
+ }
25
+ // if its a function that must be called (lazily executing function)
26
+ else if (typeof value === 'function') {
27
+ // @ts-ignore
28
+ acc[key] = { asyncContainer: value };
29
+ }
30
+ // if its just a string (global@url)
31
+ else if (typeof value === 'string') {
32
+ var _a = (0, exports.extractUrlAndGlobal)(value), url = _a[0], global_1 = _a[1];
33
+ acc[key] = { global: global_1, url: url };
34
+ }
35
+ // we dont know or currently support this type
36
+ else {
37
+ //@ts-ignore
38
+ console.log('remotes process', process.env.REMOTES);
39
+ throw new Error("[mf] Invalid value received for runtime_remote \"".concat(key, "\""));
40
+ }
41
+ return acc;
42
+ }, {});
43
+ return runtimeRemotes;
44
+ }
45
+ catch (err) {
46
+ console.warn('Unable to retrieve runtime remotes: ', err);
47
+ }
48
+ return {};
49
+ };
50
+ var importDelegatedModule = function (keyOrRuntimeRemoteItem) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
51
+ return tslib_1.__generator(this, function (_a) {
52
+ // @ts-ignore
53
+ return [2 /*return*/, loadScript(keyOrRuntimeRemoteItem)
54
+ .then(function (asyncContainer) {
55
+ return asyncContainer;
56
+ })
57
+ .then(function (asyncContainer) {
58
+ // most of this is only needed because of legacy promise based implementation
59
+ // can remove proxies once we remove promise based implementations
60
+ if (typeof window === 'undefined') {
61
+ //TODO: need to solve chunk flushing with delegated modules
62
+ return asyncContainer;
63
+ }
64
+ else {
65
+ var proxy_1 = {
66
+ get: asyncContainer.get,
67
+ //@ts-ignore
68
+ init: function (shareScope, initScope) {
69
+ try {
70
+ //@ts-ignore
71
+ asyncContainer.init(shareScope, initScope);
72
+ // for legacy reasons, we must mark container a initialized
73
+ // here otherwise older promise based implementation will try to init again with diff object
74
+ //@ts-ignore
75
+ proxy_1.__initialized = true;
76
+ }
77
+ catch (e) {
78
+ return 1;
79
+ }
80
+ },
81
+ };
82
+ // @ts-ignore
83
+ if (!proxy_1.__initialized) {
84
+ //@ts-ignore
85
+ proxy_1.init(__webpack_share_scopes__.default);
86
+ }
87
+ return proxy_1;
88
+ }
89
+ })];
90
+ });
91
+ }); };
92
+ exports.importDelegatedModule = importDelegatedModule;
93
+ var createDelegatedModule = function (delegate, params) {
94
+ var queries = [];
95
+ for (var _i = 0, _a = Object.entries(params); _i < _a.length; _i++) {
96
+ var _b = _a[_i], key = _b[0], value = _b[1];
97
+ if (Array.isArray(value) || typeof value === 'object') {
98
+ throw new Error("[Module Federation] Delegated module params cannot be an array or object. Key \"".concat(key, "\" should be a string or number"));
39
99
  }
40
- return acc;
41
- }, {});
42
- return runtimeRemotes;
100
+ queries.push("".concat(key, "=").concat(value));
101
+ }
102
+ return "internal ".concat(delegate, "?").concat(queries.join('&'));
43
103
  };
44
- /**
45
- * Return initialized remote container by remote's key or its runtime remote item data.
46
- *
47
- * `runtimeRemoteItem` might be
48
- * { global, url } - values obtained from webpack remotes option `global@url`
49
- * or
50
- * { asyncContainer } - async container is a promise that resolves to the remote container
51
- */
52
- var injectScript = function (keyOrRuntimeRemoteItem) {
104
+ exports.createDelegatedModule = createDelegatedModule;
105
+ var loadScript = function (keyOrRuntimeRemoteItem) {
53
106
  var runtimeRemotes = getRuntimeRemotes();
54
107
  // 1) Load remote container if needed
55
108
  var asyncContainer;
@@ -72,9 +125,30 @@ var injectScript = function (keyOrRuntimeRemoteItem) {
72
125
  ? reference.uniqueKey
73
126
  : remoteGlobal_1;
74
127
  var __webpack_error__1 = new Error();
128
+ //@ts-ignore
129
+ if (!global.__remote_scope__) {
130
+ // create a global scope for container, similar to how remotes are set on window in the browser
131
+ //@ts-ignore
132
+ global.__remote_scope__ = {
133
+ _config: {},
134
+ };
135
+ }
75
136
  var globalScope_1 =
76
137
  //@ts-ignore
77
138
  typeof window !== 'undefined' ? window : global.__remote_scope__; // TODO: fix types
139
+ if (typeof window === 'undefined') {
140
+ //@ts-ignore
141
+ globalScope_1._config[containerKey_1] = reference.url;
142
+ }
143
+ else {
144
+ // to match promise template system, can be removed once promise template is gone
145
+ if (!globalScope_1.remoteLoading) {
146
+ globalScope_1.remoteLoading = {};
147
+ }
148
+ if (globalScope_1.remoteLoading[containerKey_1]) {
149
+ return globalScope_1.remoteLoading[containerKey_1];
150
+ }
151
+ }
78
152
  asyncContainer = new Promise(function (resolve, reject) {
79
153
  function resolveRemoteGlobal() {
80
154
  var asyncContainer = globalScope_1[remoteGlobal_1];
@@ -103,8 +177,13 @@ var injectScript = function (keyOrRuntimeRemoteItem) {
103
177
  reject(__webpack_error__1);
104
178
  }, containerKey_1);
105
179
  });
180
+ if (typeof window !== 'undefined') {
181
+ globalScope_1.remoteLoading[containerKey_1] = asyncContainer;
182
+ }
106
183
  }
107
- // 2) Initialize remote container
184
+ return asyncContainer;
185
+ };
186
+ var createContainerSharingScope = function (asyncContainer) {
108
187
  // @ts-ignore
109
188
  return asyncContainer
110
189
  .then(function (container) {
@@ -135,6 +214,18 @@ var injectScript = function (keyOrRuntimeRemoteItem) {
135
214
  return container;
136
215
  });
137
216
  };
217
+ /**
218
+ * Return initialized remote container by remote's key or its runtime remote item data.
219
+ *
220
+ * `runtimeRemoteItem` might be
221
+ * { global, url } - values obtained from webpack remotes option `global@url`
222
+ * or
223
+ * { asyncContainer } - async container is a promise that resolves to the remote container
224
+ */
225
+ var injectScript = function (keyOrRuntimeRemoteItem) {
226
+ var asyncContainer = loadScript(keyOrRuntimeRemoteItem);
227
+ return createContainerSharingScope(asyncContainer);
228
+ };
138
229
  exports.injectScript = injectScript;
139
230
  var createRuntimeVariables = function (remotes) {
140
231
  if (!remotes) {
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../packages/utilities/src/utils/common.ts"],"names":[],"mappings":";AAAA,sDAAsD;;;;AAmBtD,yCAAyC;AAClC,IAAM,mBAAmB,GAAG,UAAC,YAAoB;IACtD,IAAM,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACxC,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,KAAK,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;QACnD,MAAM,IAAI,KAAK,CAAC,4BAAoB,YAAY,OAAG,CAAC,CAAC;KACtD;IACD,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AAC/E,CAAC,CAAC;AANW,QAAA,mBAAmB,uBAM9B;AAEF,IAAM,iBAAiB,GAAG;IACxB,YAAY;IACZ,IAAM,UAAU,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,CAAe,CAAC;IAE7D,IAAM,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,UACvD,GAAG,EACH,IAAI;QAEG,IAAA,GAAG,GAAW,IAAI,GAAf,EAAE,KAAK,GAAI,IAAI,GAAR,CAAS;QAC1B,gEAAgE;QAChE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C,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,EAAC;qBACrE;yBAAM;wBACL,sBAAO,GAAG,EAAC;qBACZ;;;;oBAED,OAAO,CAAC,GAAG,CAAC,OAAK,CAAC,CAAC;oBACnB,sBAAO,SAAS,EAAC;;;;;CAEpB,CAAC;AAnBW,QAAA,SAAS,aAmBpB"}
@@ -1,4 +1,4 @@
1
- declare type RemoteUrl = string | (() => Promise<string>);
1
+ type RemoteUrl = string | (() => Promise<string>);
2
2
  export interface ImportRemoteOptions {
3
3
  url: RemoteUrl;
4
4
  scope: string;
@@ -1,10 +1 @@
1
- import type { ComponentType } from 'react';
2
- /**
3
- * Wrapper around dynamic import.
4
- * Adds error boundaries and fallback options
5
- */
6
- export declare const FederationBoundary: ({ dynamicImporter, fallback, customBoundary: CustomBoundary, ...rest }: {
7
- dynamicImporter: () => Promise<any>;
8
- fallback: () => Promise<any> | null;
9
- customBoundary: ComponentType;
10
- }) => JSX.Element;
1
+ export { default as FederationBoundary } from '../components/FederationBoundary';
@@ -1,42 +1,9 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.FederationBoundary = void 0;
4
- var tslib_1 = require("tslib");
5
- var react_1 = tslib_1.__importStar(require("react"));
6
- var dynamic_1 = tslib_1.__importDefault(require("next/dynamic"));
7
- var ErrorBoundary = /** @class */ (function (_super) {
8
- tslib_1.__extends(ErrorBoundary, _super);
9
- function ErrorBoundary(props) {
10
- return _super.call(this, props) || this;
11
- }
12
- ErrorBoundary.prototype.componentDidCatch = function (error, errorInfo) {
13
- // You can also log the error to an error reporting service
14
- console.error(error, errorInfo);
15
- };
16
- ErrorBoundary.prototype.render = function () {
17
- return this.props['children'];
18
- };
19
- return ErrorBoundary;
20
- }(react_1.default.Component));
21
- /**
22
- * Wrapper around dynamic import.
23
- * Adds error boundaries and fallback options
24
- */
25
- var FederationBoundary = function (_a) {
26
- var dynamicImporter = _a.dynamicImporter, _b = _a.fallback, fallback = _b === void 0 ? function () { return null; } : _b, CustomBoundary = _a.customBoundary, rest = tslib_1.__rest(_a, ["dynamicImporter", "fallback", "customBoundary"]);
27
- return (0, react_1.useMemo)(function () {
28
- var ImportResult = (0, dynamic_1.default)(function () {
29
- return dynamicImporter().catch(function (e) {
30
- console.error(e);
31
- return fallback();
32
- });
33
- }, {
34
- ssr: false,
35
- });
36
- var Boundary = CustomBoundary !== undefined ? CustomBoundary : ErrorBoundary;
37
- return (react_1.default.createElement(Boundary, null,
38
- react_1.default.createElement(ImportResult, tslib_1.__assign({}, rest))));
39
- }, [dynamicImporter, fallback]);
40
- };
41
- exports.FederationBoundary = FederationBoundary;
7
+ var FederationBoundary_1 = require("../components/FederationBoundary");
8
+ Object.defineProperty(exports, "FederationBoundary", { enumerable: true, get: function () { return __importDefault(FederationBoundary_1).default; } });
42
9
  //# sourceMappingURL=react.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"react.js","sourceRoot":"","sources":["../../../../../packages/utilities/src/utils/react.tsx"],"names":[],"mappings":";;;;AACA,qDAAuC;AACvC,iEAAmC;AAQnC;IAA4B,yCAAyB;IACnD,uBAAY,KAAoB;eAC9B,kBAAM,KAAK,CAAC;IACd,CAAC;IAEQ,yCAAiB,GAA1B,UAA2B,KAAY,EAAE,SAAc;QACrD,2DAA2D;QAC3D,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAClC,CAAC;IAEQ,8BAAM,GAAf;QACE,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAChC,CAAC;IACH,oBAAC;AAAD,CAAC,AAbD,CAA4B,eAAK,CAAC,SAAS,GAa1C;AAED;;;GAGG;AAEI,IAAM,kBAAkB,GAAG,UAAC,EAS9B;IARH,IAAA,eAAe,qBAAA,EACf,gBAAqB,EAArB,QAAQ,mB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