@module-federation/native-federation-tests 0.2.0 → 0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Matteo Pietro Dazzi and NearForm Limited
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -13,9 +13,11 @@ npm i -D @module-federation/native-federation-tests
13
13
  This module provides two plugins:
14
14
 
15
15
  ### NativeFederationTestsRemote
16
+
16
17
  This plugin is used to concat the components that will be used in tests.
17
18
 
18
19
  #### Configuration
20
+
19
21
  ```typescript
20
22
  {
21
23
  moduleFederationConfig: any; // the same configuration provided to the module federation plugin, it is MANDATORY
@@ -27,10 +29,12 @@ This plugin is used to concat the components that will be used in tests.
27
29
  ```
28
30
 
29
31
  #### Additional configuration
32
+
30
33
  Note that, for Webpack, the plugin automatically inject the `devServer.static.directory` configuration.
31
34
  For the other bundlers, you should configure it by yourself.
32
35
 
33
36
  ### NativeFederationTestsHost
37
+
34
38
  This plugin is used to download the concatenated components mock that will be used for tests.
35
39
 
36
40
  ### Configuration
@@ -41,6 +45,7 @@ This plugin is used to download the concatenated components mock that will be us
41
45
  testsFolder?: string; // folder where all the files have been stored, default is '@mf-tests',
42
46
  mocksFolder?: string; // folder where the concatenated files will be stored, default is './__mocks__',
43
47
  deleteTestsFolder?: boolean; // indicate if the tests mock folder will be deleted before the job starts, default is 'true'
48
+ maxRetries?: number; // The number of times the plugin will try to download the mocks before failing, default is 3
44
49
  }
45
50
  ```
46
51
 
@@ -51,30 +56,35 @@ This plugin is used to download the concatenated components mock that will be us
51
56
 
52
57
  ```ts
53
58
  // vite.config.ts
54
- import {NativeFederationTestsHost, NativeFederationTestsRemote} from '@module-federation/native-federation-tests/vite'
59
+ import { NativeFederationTestsHost, NativeFederationTestsRemote } from '@module-federation/native-federation-tests/vite';
55
60
 
56
61
  export default defineConfig({
57
62
  plugins: [
58
- NativeFederationTestsRemote({ /* options */ }),
59
- NativeFederationTestsHost({ /* options */ }),
63
+ NativeFederationTestsRemote({
64
+ /* options */
65
+ }),
66
+ NativeFederationTestsHost({
67
+ /* options */
68
+ }),
60
69
  ],
61
70
  /* ... */
62
- server: { // This is needed to emulate the devServer.static.directory of WebPack and correctly serve the zip file
71
+ server: {
72
+ // This is needed to emulate the devServer.static.directory of WebPack and correctly serve the zip file
63
73
  /* ... */
64
74
  proxy: {
65
75
  '/@mf-types.zip': {
66
- target: 'http://localhost:3000',
67
- changeOrigin: true,
68
- rewrite: () => `/@fs/${process.cwd()}/dist/@mf-types.zip`
69
- }
76
+ target: 'http://localhost:3000',
77
+ changeOrigin: true,
78
+ rewrite: () => `/@fs/${process.cwd()}/dist/@mf-types.zip`,
79
+ },
70
80
  },
71
81
  fs: {
72
82
  /* ... */
73
- allow: ['./dist']
83
+ allow: ['./dist'],
74
84
  /* ... */
75
- }
76
- }
77
- })
85
+ },
86
+ },
87
+ });
78
88
  ```
79
89
 
80
90
  <br>
@@ -84,14 +94,18 @@ export default defineConfig({
84
94
 
85
95
  ```ts
86
96
  // rollup.config.js
87
- import {NativeFederationTestsHost, NativeFederationTestsRemote} from '@module-federation/native-federation-tests/rollup'
97
+ import { NativeFederationTestsHost, NativeFederationTestsRemote } from '@module-federation/native-federation-tests/rollup';
88
98
 
89
99
  export default {
90
100
  plugins: [
91
- NativeFederationTestsRemote({ /* options */ }),
92
- NativeFederationTestsHost({ /* options */ }),
101
+ NativeFederationTestsRemote({
102
+ /* options */
103
+ }),
104
+ NativeFederationTestsHost({
105
+ /* options */
106
+ }),
93
107
  ],
94
- }
108
+ };
95
109
  ```
96
110
 
97
111
  <br>
@@ -101,14 +115,18 @@ export default {
101
115
 
102
116
  ```ts
103
117
  // webpack.config.js
104
- const {NativeFederationTestsHost, NativeFederationTestsRemote} = require('@module-federation/native-federation-tests/webpack')
118
+ const { NativeFederationTestsHost, NativeFederationTestsRemote } = require('@module-federation/native-federation-tests/webpack');
105
119
  module.exports = {
106
120
  /* ... */
107
121
  plugins: [
108
- NativeFederationTestsRemote({ /* options */ }),
109
- NativeFederationTestsHost({ /* options */ })
110
- ]
111
- }
122
+ NativeFederationTestsRemote({
123
+ /* options */
124
+ }),
125
+ NativeFederationTestsHost({
126
+ /* options */
127
+ }),
128
+ ],
129
+ };
112
130
  ```
113
131
 
114
132
  <br>
@@ -118,15 +136,19 @@ module.exports = {
118
136
 
119
137
  ```ts
120
138
  // esbuild.config.js
121
- import { build } from 'esbuild'
122
- import {NativeFederationTestsHost, NativeFederationTestsRemote} from '@module-federation/native-federation-tests/esbuild'
139
+ import { build } from 'esbuild';
140
+ import { NativeFederationTestsHost, NativeFederationTestsRemote } from '@module-federation/native-federation-tests/esbuild';
123
141
 
124
142
  build({
125
143
  plugins: [
126
- NativeFederationTestsRemote({ /* options */ }),
127
- NativeFederationTestsHost({ /* options */ })
144
+ NativeFederationTestsRemote({
145
+ /* options */
146
+ }),
147
+ NativeFederationTestsHost({
148
+ /* options */
149
+ }),
128
150
  ],
129
- })
151
+ });
130
152
  ```
131
153
 
132
154
  <br>
@@ -137,15 +159,19 @@ build({
137
159
 
138
160
  ```ts
139
161
  // rspack.config.js
140
- const {NativeFederationTestsHost, NativeFederationTestsRemote} = require('@module-federation/native-federation-tests/rspack')
162
+ const { NativeFederationTestsHost, NativeFederationTestsRemote } = require('@module-federation/native-federation-tests/rspack');
141
163
 
142
164
  module.exports = {
143
165
  /* ... */
144
166
  plugins: [
145
- NativeFederationTestsRemote({ /* options */ }),
146
- NativeFederationTestsHost({ /* options */ })
147
- ]
148
- }
167
+ NativeFederationTestsRemote({
168
+ /* options */
169
+ }),
170
+ NativeFederationTestsHost({
171
+ /* options */
172
+ }),
173
+ ],
174
+ };
149
175
  ```
150
176
 
151
177
  <br>
@@ -0,0 +1,497 @@
1
+ # [1.0.0-canary.1](https://github.com/module-federation/universe/compare/native-federation-tests-0.2.1...native-federation-tests-1.0.0-canary.1) (2023-11-06)
2
+
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - bb0302b: feat: configurable maxRetries package unzip
8
+
9
+ ### Bug Fixes
10
+
11
+ - **deps:** update dependency antd to v4.24.11 ([#1029](https://github.com/module-federation/universe/issues/1029)) ([f9e64c0](https://github.com/module-federation/universe/commit/f9e64c04aa1e5802fdc0cdc8f07f2ee728c3ff1c))
12
+ - **deps:** update dependency antd to v4.24.12 ([#1074](https://github.com/module-federation/universe/issues/1074)) ([46c25e0](https://github.com/module-federation/universe/commit/46c25e0a873ada88d2888a4e995bfa7133c01953))
13
+ - **deps:** update dependency antd to v4.24.14 ([#1309](https://github.com/module-federation/universe/issues/1309)) ([d0a2314](https://github.com/module-federation/universe/commit/d0a231470e37dbad85a11df1f12695657ba3b984))
14
+ - **deps:** update dependency axios to v1.5.0 ([#1275](https://github.com/module-federation/universe/issues/1275)) ([f163df1](https://github.com/module-federation/universe/commit/f163df1073740bf4218bb35ba57cea5dc409fe43))
15
+ - **deps:** update dependency axios to v1.5.1 ([ae9a06a](https://github.com/module-federation/universe/commit/ae9a06a0cc35fad27a0b493a25370b92617c39fb))
16
+ - **deps:** update dependency core-js to v3.31.0 ([#1048](https://github.com/module-federation/universe/issues/1048)) ([96a99f2](https://github.com/module-federation/universe/commit/96a99f2f531b165f14aa36c73eef0691abe3f12c))
17
+ - **deps:** update dependency core-js to v3.32.2 ([18d2746](https://github.com/module-federation/universe/commit/18d2746763f38fe295a14df3f1bcd4218fade5b8))
18
+ - **deps:** update dependency core-js to v3.33.0 ([30894ca](https://github.com/module-federation/universe/commit/30894cafbe5dea4350dc7c633548038d7ec5f8a8))
19
+ - **deps:** update dependency fast-glob to v3.3.0 ([#1078](https://github.com/module-federation/universe/issues/1078)) ([14bb0b5](https://github.com/module-federation/universe/commit/14bb0b5e7ca6a72190fa9d9df817b57586221b66))
20
+ - **deps:** update dependency fast-glob to v3.3.1 ([#1197](https://github.com/module-federation/universe/issues/1197)) ([5743543](https://github.com/module-federation/universe/commit/57435430bd0912e3bf370ce08b46f610b12d00e3))
21
+ - **deps:** update dependency react-router-dom to v6.14.0 ([#1049](https://github.com/module-federation/universe/issues/1049)) ([ada4160](https://github.com/module-federation/universe/commit/ada416019bbbf589a5a39094b5f608db39a456b2))
22
+ - **deps:** update dependency react-router-dom to v6.14.1 ([#1081](https://github.com/module-federation/universe/issues/1081)) ([8515c31](https://github.com/module-federation/universe/commit/8515c314ae2d6159c25fc0fcdc992b24c1fa1a93))
23
+ - **deps:** update dependency react-router-dom to v6.15.0 ([#1276](https://github.com/module-federation/universe/issues/1276)) ([850e2fa](https://github.com/module-federation/universe/commit/850e2fac60f49b456aef3b5df9827fc3ac5a6006))
24
+ - **deps:** update dependency react-router-dom to v6.16.0 ([0618339](https://github.com/module-federation/universe/commit/061833912f7e5748011cd60ed679a68c1b659f77))
25
+ - **deps:** update dependency tsup to v7 ([#1042](https://github.com/module-federation/universe/issues/1042)) ([f319c8a](https://github.com/module-federation/universe/commit/f319c8a8d876e547eeadd59e5bde30dcc367edaf))
26
+ - **deps:** update dependency typedoc to ^0.25.0 ([#1277](https://github.com/module-federation/universe/issues/1277)) ([8d6a72e](https://github.com/module-federation/universe/commit/8d6a72e18a57b69b2f63802621e8b4b479554fed))
27
+ - **deps:** update dependency typedoc to v0.25.1 ([#1304](https://github.com/module-federation/universe/issues/1304)) ([abf84fe](https://github.com/module-federation/universe/commit/abf84fefd5c20b5de7c9a74d1c49235f44d36dc6))
28
+ - **deps:** update dependency typedoc to v0.25.2 ([46c6524](https://github.com/module-federation/universe/commit/46c65247e187cee9e15625402c1570ac351bb1fe))
29
+ - **deps:** update dependency undici to v5.24.0 ([573e644](https://github.com/module-federation/universe/commit/573e644333da6d24cb4286ce08221a1aa82415e4))
30
+ - **deps:** update dependency undici to v5.25.2 ([da3e539](https://github.com/module-federation/universe/commit/da3e539a41ed23ccb5086b1dd428fbee0f8d652c))
31
+ - **deps:** update dependency undici to v5.25.4 ([1d4f91e](https://github.com/module-federation/universe/commit/1d4f91ec93da4326c8a42eef28f150d5d09738bb))
32
+ - **deps:** update dependency undici to v5.26.2 [security] ([410a8b8](https://github.com/module-federation/universe/commit/410a8b8bd1558dfb5119ae10941d2b3816a0d0e0))
33
+ - **deps:** update dependency unplugin to v1.5.0 ([936b3f8](https://github.com/module-federation/universe/commit/936b3f8d8061fd9d481d1788fb35b88588928d14))
34
+ - Fix call undefined delegate ([#1149](https://github.com/module-federation/universe/issues/1149)) ([87a5896](https://github.com/module-federation/universe/commit/87a5896221a726578c3433071755fba3465824f4)), closes [#1151](https://github.com/module-federation/universe/issues/1151)
35
+ - override semantic-release-plugin-decorators ([18675de](https://github.com/module-federation/universe/commit/18675defef65570d2b3bb6a9caa3fd039badee29))
36
+ - switch to @goestav/nx-semantic-release ([63a3350](https://github.com/module-federation/universe/commit/63a3350a6a1a12235e3c9f1e7c724d54f0476356))
37
+
38
+ ### Features
39
+
40
+ - core package for module federation ([#1093](https://github.com/module-federation/universe/issues/1093)) ([d460400](https://github.com/module-federation/universe/commit/d46040053e9b627321b5fe8e05556c5bb727c238)), closes [#851](https://github.com/module-federation/universe/issues/851) [#864](https://github.com/module-federation/universe/issues/864) [#835](https://github.com/module-federation/universe/issues/835) [#851](https://github.com/module-federation/universe/issues/851) [#864](https://github.com/module-federation/universe/issues/864) [#871](https://github.com/module-federation/universe/issues/871) [#851](https://github.com/module-federation/universe/issues/851) [#864](https://github.com/module-federation/universe/issues/864) [#872](https://github.com/module-federation/universe/issues/872) [#875](https://github.com/module-federation/universe/issues/875) [#884](https://github.com/module-federation/universe/issues/884) [#887](https://github.com/module-federation/universe/issues/887) [#893](https://github.com/module-federation/universe/issues/893) [#885](https://github.com/module-federation/universe/issues/885) [#899](https://github.com/module-federation/universe/issues/899) [#904](https://github.com/module-federation/universe/issues/904) [#932](https://github.com/module-federation/universe/issues/932) [#936](https://github.com/module-federation/universe/issues/936) [#959](https://github.com/module-federation/universe/issues/959) [#960](https://github.com/module-federation/universe/issues/960) [#969](https://github.com/module-federation/universe/issues/969) [#971](https://github.com/module-federation/universe/issues/971) [#1234](https://github.com/module-federation/universe/issues/1234) [#1235](https://github.com/module-federation/universe/issues/1235)
41
+ - Dynamic Filesystem ([#1274](https://github.com/module-federation/universe/issues/1274)) ([2bec98a](https://github.com/module-federation/universe/commit/2bec98a2472b44898a7f14ec6868a2368cfb6d82))
42
+ - fork module federation ([0ad7430](https://github.com/module-federation/universe/commit/0ad7430f6170458a47144be392133b7b2fa1ade0))
43
+ - improved async init ([ae3a450](https://github.com/module-federation/universe/commit/ae3a4503ff9de86492b13029d6334b281ddd9493))
44
+ - native self forming node federation ([#1291](https://github.com/module-federation/universe/issues/1291)) ([1dd5ed1](https://github.com/module-federation/universe/commit/1dd5ed17c981e036336925e807203e94b58c36d6))
45
+ - new actions, remove gpt integration ([370229e](https://github.com/module-federation/universe/commit/370229e02cc352fcfaeaa0f3cf1f9f2d4966d1bb))
46
+ - Next Federation 7 ([#726](https://github.com/module-federation/universe/issues/726)) ([d50ca1e](https://github.com/module-federation/universe/commit/d50ca1e4636c4e0a402190f6e9c3f69ed9ec8eac)), closes [#851](https://github.com/module-federation/universe/issues/851) [#864](https://github.com/module-federation/universe/issues/864) [#835](https://github.com/module-federation/universe/issues/835) [#851](https://github.com/module-federation/universe/issues/851) [#864](https://github.com/module-federation/universe/issues/864) [#871](https://github.com/module-federation/universe/issues/871) [#851](https://github.com/module-federation/universe/issues/851) [#864](https://github.com/module-federation/universe/issues/864) [#872](https://github.com/module-federation/universe/issues/872) [#875](https://github.com/module-federation/universe/issues/875) [#884](https://github.com/module-federation/universe/issues/884) [#887](https://github.com/module-federation/universe/issues/887) [#893](https://github.com/module-federation/universe/issues/893) [#885](https://github.com/module-federation/universe/issues/885) [#899](https://github.com/module-federation/universe/issues/899) [#904](https://github.com/module-federation/universe/issues/904) [#932](https://github.com/module-federation/universe/issues/932) [#936](https://github.com/module-federation/universe/issues/936) [#959](https://github.com/module-federation/universe/issues/959) [#960](https://github.com/module-federation/universe/issues/960) [#969](https://github.com/module-federation/universe/issues/969) [#971](https://github.com/module-federation/universe/issues/971) [#974](https://github.com/module-federation/universe/issues/974) [#984](https://github.com/module-federation/universe/issues/984) [#986](https://github.com/module-federation/universe/issues/986) [#1015](https://github.com/module-federation/universe/issues/1015) [#1086](https://github.com/module-federation/universe/issues/1086) [#1084](https://github.com/module-federation/universe/issues/1084)
47
+ - **node:** node federation demo/testing apps added ([27d545d](https://github.com/module-federation/universe/commit/27d545d99095da7134c392dbcd9fb135a170f6ef))
48
+ - **typedoc-parsetr:** merged main ([cf6e65a](https://github.com/module-federation/universe/commit/cf6e65a4aa895d7c2dba8fdbd8ec22ec7bd8f514))
49
+ - **typedoc-parsetr:** merged main ([2ff0d5a](https://github.com/module-federation/universe/commit/2ff0d5a075df3f241742cc7e516cd0378e8e1b3e))
50
+ - **typedoc-parsetr:** python script implementation ([0a533cb](https://github.com/module-federation/universe/commit/0a533cb60e0c3ca269ab45df740c1367be175e80))
51
+
52
+ ### Reverts
53
+
54
+ - Revert "chore: upgrade nx" (#1064) ([3eadaf6](https://github.com/module-federation/universe/commit/3eadaf6f2d8ecc64b45c8e10dbc93f18293f45d5)), closes [#1064](https://github.com/module-federation/universe/issues/1064)
55
+
56
+ ### BREAKING CHANGES
57
+
58
+ - automaticAsyncBoundary option has been removed
59
+
60
+ - fix: exclude specific pages from page map automatically
61
+
62
+ - refactor: conslidate codebase
63
+
64
+ - fix: improve hot reload share recovery
65
+
66
+ - refactor: remove server jsonp template
67
+
68
+ - chore: remove dead code from runtime modules
69
+
70
+ - fix: clean up jsonp getCustomJsonpCode
71
+
72
+ getting chunk loading global from compiler output options
73
+
74
+ - feat: adding cleanInitArrays runtime helper
75
+
76
+ - chore: remove share scope hoist and module hoisting system
77
+
78
+ - chore: cleanup code
79
+
80
+ - chore: remove dead code from add module runtime plugin
81
+
82
+ likely can remove whole plugin in future
83
+
84
+ - chore: remove logs from delegate modules
85
+
86
+ - chore: remove old utils
87
+
88
+ - fix: add warning on auto page stitch
89
+
90
+ - fix: remove commented out code from InvertedContainerPlugin.ts
91
+
92
+ - chore: improve logging to see if its local load or remote load
93
+
94
+ - chore: clean up old custom promises factories
95
+
96
+ - fix: remove container proxy code
97
+
98
+ - fix: remove container proxy code
99
+ - automaticAsyncBoundary option has been removed
100
+
101
+ - fix: exclude specific pages from page map automatically
102
+
103
+ - refactor: conslidate codebase
104
+
105
+ - fix: improve hot reload share recovery
106
+
107
+ - refactor: remove server jsonp template
108
+
109
+ - chore: remove dead code from runtime modules
110
+
111
+ - fix: clean up jsonp getCustomJsonpCode
112
+
113
+ getting chunk loading global from compiler output options
114
+
115
+ - feat: adding cleanInitArrays runtime helper
116
+
117
+ - chore: remove share scope hoist and module hoisting system
118
+
119
+ - chore: cleanup code
120
+
121
+ - chore: remove dead code from add module runtime plugin
122
+
123
+ likely can remove whole plugin in future
124
+
125
+ - chore: remove logs from delegate modules
126
+
127
+ - chore: remove old utils
128
+
129
+ - fix: add warning on auto page stitch
130
+
131
+ - fix: remove commented out code from InvertedContainerPlugin.ts
132
+
133
+ - chore: improve logging to see if its local load or remote load
134
+
135
+ - chore: clean up old custom promises factories
136
+
137
+ - fix: remove container proxy code
138
+
139
+ - fix: remove container proxy code
140
+
141
+ - chore: fix project.json
142
+
143
+ - debugging
144
+
145
+ - fix: resolve backmerge issues with build
146
+
147
+ - Merge branch 'kill_child_compilers' into fix_backmerge_issues
148
+
149
+ # Conflicts:
150
+
151
+ # package-lock.json
152
+
153
+ # package.json
154
+
155
+ # packages/nextjs-mf/src/plugins/NextFederationPlugin/index.ts
156
+
157
+ # packages/nextjs-mf/src/plugins/container/InvertedContainerPlugin.ts
158
+
159
+ # packages/nextjs-mf/src/plugins/container/InvertedContainerRuntimeModule.ts
160
+
161
+ - feat: enable eager sharing
162
+
163
+ - refactor: improve module hooks for eager loading and search
164
+
165
+ - refactor: cleanup custom jsonp and make es5
166
+
167
+ - refactor: cleanup inverted container code
168
+
169
+ - refactor: cleanup inverted container code
170
+ - automaticAsyncBoundary option has been removed
171
+
172
+ - fix: exclude specific pages from page map automatically
173
+
174
+ - refactor: conslidate codebase
175
+
176
+ - fix: improve hot reload share recovery
177
+
178
+ - refactor: remove server jsonp template
179
+
180
+ - chore: remove dead code from runtime modules
181
+
182
+ - fix: clean up jsonp getCustomJsonpCode
183
+
184
+ getting chunk loading global from compiler output options
185
+
186
+ - feat: adding cleanInitArrays runtime helper
187
+
188
+ - chore: remove share scope hoist and module hoisting system
189
+
190
+ - chore: cleanup code
191
+
192
+ - chore: remove dead code from add module runtime plugin
193
+
194
+ likely can remove whole plugin in future
195
+
196
+ - chore: remove logs from delegate modules
197
+
198
+ - chore: remove old utils
199
+
200
+ - fix: add warning on auto page stitch
201
+
202
+ - fix: remove commented out code from InvertedContainerPlugin.ts
203
+
204
+ - chore: improve logging to see if its local load or remote load
205
+
206
+ - chore: clean up old custom promises factories
207
+
208
+ - fix: remove container proxy code
209
+
210
+ - fix: remove container proxy code
211
+
212
+ - fix: resolve backmerge issues with build
213
+
214
+ - Merge branch 'kill_child_compilers' into fix_backmerge_issues
215
+
216
+ # Conflicts:
217
+
218
+ # package-lock.json
219
+
220
+ # package.json
221
+
222
+ # packages/nextjs-mf/src/plugins/NextFederationPlugin/index.ts
223
+
224
+ # packages/nextjs-mf/src/plugins/container/InvertedContainerPlugin.ts
225
+
226
+ # packages/nextjs-mf/src/plugins/container/InvertedContainerRuntimeModule.ts
227
+
228
+ - feat: enable eager sharing
229
+
230
+ - refactor: improve module hooks for eager loading and search
231
+
232
+ - refactor: cleanup custom jsonp and make es5
233
+
234
+ - refactor: cleanup inverted container code
235
+
236
+ - refactor: cleanup inverted container code
237
+
238
+ - ci: fix install step with npm and NX
239
+
240
+ - test: remove tests for now
241
+
242
+ - chore(utils): release version 1.7.3-beta.0
243
+
244
+ - chore(utils): release version 1.7.3
245
+
246
+ - chore(node): release version 0.14.4-beta.0
247
+
248
+ - chore(node): release version 0.14.4
249
+
250
+ - chore(nextjs-mf): release version 6.4.1-beta.4
251
+
252
+ - fix: remove debugging runtime variable
253
+
254
+ - chore(nextjs-mf): release version 6.4.1-beta.5
255
+ - automaticAsyncBoundary option has been removed
256
+
257
+ - fix: exclude specific pages from page map automatically
258
+
259
+ - refactor: conslidate codebase
260
+
261
+ - fix: improve hot reload share recovery
262
+
263
+ - refactor: remove server jsonp template
264
+
265
+ - chore: remove dead code from runtime modules
266
+
267
+ - fix: clean up jsonp getCustomJsonpCode
268
+
269
+ getting chunk loading global from compiler output options
270
+
271
+ - feat: adding cleanInitArrays runtime helper
272
+
273
+ - chore: remove share scope hoist and module hoisting system
274
+
275
+ - chore: cleanup code
276
+
277
+ - chore: remove dead code from add module runtime plugin
278
+
279
+ likely can remove whole plugin in future
280
+
281
+ - chore: remove logs from delegate modules
282
+
283
+ - chore: remove old utils
284
+
285
+ - fix: add warning on auto page stitch
286
+
287
+ - fix: remove commented out code from InvertedContainerPlugin.ts
288
+
289
+ - chore: improve logging to see if its local load or remote load
290
+
291
+ - chore: clean up old custom promises factories
292
+
293
+ - fix: remove container proxy code
294
+
295
+ - fix: remove container proxy code
296
+ - automaticAsyncBoundary option has been removed
297
+
298
+ - fix: exclude specific pages from page map automatically
299
+
300
+ - refactor: conslidate codebase
301
+
302
+ - fix: improve hot reload share recovery
303
+
304
+ - refactor: remove server jsonp template
305
+
306
+ - chore: remove dead code from runtime modules
307
+
308
+ - fix: clean up jsonp getCustomJsonpCode
309
+
310
+ getting chunk loading global from compiler output options
311
+
312
+ - feat: adding cleanInitArrays runtime helper
313
+
314
+ - chore: remove share scope hoist and module hoisting system
315
+
316
+ - chore: cleanup code
317
+
318
+ - chore: remove dead code from add module runtime plugin
319
+
320
+ likely can remove whole plugin in future
321
+
322
+ - chore: remove logs from delegate modules
323
+
324
+ - chore: remove old utils
325
+
326
+ - fix: add warning on auto page stitch
327
+
328
+ - fix: remove commented out code from InvertedContainerPlugin.ts
329
+
330
+ - chore: improve logging to see if its local load or remote load
331
+
332
+ - chore: clean up old custom promises factories
333
+
334
+ - fix: remove container proxy code
335
+
336
+ - fix: remove container proxy code
337
+
338
+ - chore: fix project.json
339
+
340
+ - debugging
341
+
342
+ - fix: resolve backmerge issues with build
343
+
344
+ - Merge branch 'kill_child_compilers' into fix_backmerge_issues
345
+
346
+ # Conflicts:
347
+
348
+ # package-lock.json
349
+
350
+ # package.json
351
+
352
+ # packages/nextjs-mf/src/plugins/NextFederationPlugin/index.ts
353
+
354
+ # packages/nextjs-mf/src/plugins/container/InvertedContainerPlugin.ts
355
+
356
+ # packages/nextjs-mf/src/plugins/container/InvertedContainerRuntimeModule.ts
357
+
358
+ - feat: enable eager sharing
359
+
360
+ - refactor: improve module hooks for eager loading and search
361
+
362
+ - refactor: cleanup custom jsonp and make es5
363
+
364
+ - refactor: cleanup inverted container code
365
+
366
+ - refactor: cleanup inverted container code
367
+ - automaticAsyncBoundary option has been removed
368
+
369
+ - fix: exclude specific pages from page map automatically
370
+
371
+ - refactor: conslidate codebase
372
+
373
+ - fix: improve hot reload share recovery
374
+
375
+ - refactor: remove server jsonp template
376
+
377
+ - chore: remove dead code from runtime modules
378
+
379
+ - fix: clean up jsonp getCustomJsonpCode
380
+
381
+ getting chunk loading global from compiler output options
382
+
383
+ - feat: adding cleanInitArrays runtime helper
384
+
385
+ - chore: remove share scope hoist and module hoisting system
386
+
387
+ - chore: cleanup code
388
+
389
+ - chore: remove dead code from add module runtime plugin
390
+
391
+ likely can remove whole plugin in future
392
+
393
+ - chore: remove logs from delegate modules
394
+
395
+ - chore: remove old utils
396
+
397
+ - fix: add warning on auto page stitch
398
+
399
+ - fix: remove commented out code from InvertedContainerPlugin.ts
400
+
401
+ - chore: improve logging to see if its local load or remote load
402
+
403
+ - chore: clean up old custom promises factories
404
+
405
+ - fix: remove container proxy code
406
+
407
+ - fix: remove container proxy code
408
+
409
+ - fix: resolve backmerge issues with build
410
+
411
+ - Merge branch 'kill_child_compilers' into fix_backmerge_issues
412
+
413
+ # Conflicts:
414
+
415
+ # package-lock.json
416
+
417
+ # package.json
418
+
419
+ # packages/nextjs-mf/src/plugins/NextFederationPlugin/index.ts
420
+
421
+ # packages/nextjs-mf/src/plugins/container/InvertedContainerPlugin.ts
422
+
423
+ # packages/nextjs-mf/src/plugins/container/InvertedContainerRuntimeModule.ts
424
+
425
+ - feat: enable eager sharing
426
+
427
+ - refactor: improve module hooks for eager loading and search
428
+
429
+ - refactor: cleanup custom jsonp and make es5
430
+
431
+ - refactor: cleanup inverted container code
432
+
433
+ - refactor: cleanup inverted container code
434
+
435
+ - ci: fix install step with npm and NX
436
+
437
+ - test: remove tests for now
438
+
439
+ - chore(utils): release version 1.7.3-beta.0
440
+
441
+ - chore(utils): release version 1.7.3
442
+
443
+ - chore(node): release version 0.14.4-beta.0
444
+
445
+ - chore(node): release version 0.14.4
446
+
447
+ - chore(nextjs-mf): release version 6.4.1-beta.4
448
+
449
+ - fix: remove debugging runtime variable
450
+
451
+ - chore(nextjs-mf): release version 6.4.1-beta.5
452
+
453
+ # Changelog
454
+
455
+ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
456
+
457
+ ## [0.2.1](https://github.com/module-federation/nextjs-mf/compare/native-federation-tests-0.2.0...native-federation-tests-0.2.1) (2023-06-28)
458
+
459
+ ### Bug Fixes
460
+
461
+ - .at(-1) ([8dd0520](https://github.com/module-federation/nextjs-mf/commit/8dd0520b5464c49e89c63307c5388450e4bebbf8))
462
+
463
+ # [0.2.0](https://github.com/module-federation/nextjs-mf/compare/native-federation-tests-0.1.2...native-federation-tests-0.2.0) (2023-04-29)
464
+
465
+ ### Bug Fixes
466
+
467
+ - removed any from error logger type ([fb9fcc3](https://github.com/module-federation/nextjs-mf/commit/fb9fcc3a54a13be36335830f076a86557b75bb4a))
468
+ - subpath ([1548501](https://github.com/module-federation/nextjs-mf/commit/1548501bb4679c0c534c02609cb6bc5459f224a4))
469
+
470
+ ### Features
471
+
472
+ - release to npm with next tag to not ruine latest one ([#763](https://github.com/module-federation/nextjs-mf/issues/763)) ([f2d199b](https://github.com/module-federation/nextjs-mf/commit/f2d199b3b3fbbd428514b1ce1f139efc82f7fff0))
473
+
474
+ ## [0.1.2](https://github.com/module-federation/nextjs-mf/compare/native-federation-tests-0.1.1...native-federation-tests-0.1.2) (2023-04-14)
475
+
476
+ ### Bug Fixes
477
+
478
+ - tests regex, external deps should be removed using the startsWith strategy ([5d1c0f5](https://github.com/module-federation/nextjs-mf/commit/5d1c0f5b947ec7690fbe69ec8cc23701f975bae9))
479
+
480
+ ## [0.1.1](https://github.com/module-federation/nextjs-mf/compare/native-federation-tests-0.1.0...native-federation-tests-0.1.1) (2023-04-12)
481
+
482
+ # 0.1.0 (2023-04-11)
483
+
484
+ ### Bug Fixes
485
+
486
+ - build ([d0b2f72](https://github.com/module-federation/nextjs-mf/commit/d0b2f72f4fc3647825412be1574311c3152cf167))
487
+ - build step ([a217170](https://github.com/module-federation/nextjs-mf/commit/a21717096cbc09bff20d3aeebfea2f3533afb0d7))
488
+ - deps ([a378441](https://github.com/module-federation/nextjs-mf/commit/a37844194a3f189cc5863bbdd4776259bce69fa4))
489
+ - native build chunks ([d6c9f8a](https://github.com/module-federation/nextjs-mf/commit/d6c9f8a957ed00a8d92332ccc38ed9780f01d54e))
490
+ - package name ([dcb8480](https://github.com/module-federation/nextjs-mf/commit/dcb848025bbe56a7fc5bd3643462a64d22699cc7))
491
+ - readme ([eaca0b3](https://github.com/module-federation/nextjs-mf/commit/eaca0b311d3b8d9e73309cb92d9a9488f9fc23c0))
492
+ - readme ([74fc6fa](https://github.com/module-federation/nextjs-mf/commit/74fc6fa21ac10ce3cd9dd942a5b392ef50c51f56))
493
+ - README.md ([9159171](https://github.com/module-federation/nextjs-mf/commit/91591712e9a103fff351f0a168c149470c0d69ad))
494
+
495
+ ### Features
496
+
497
+ - federated tests plugin ([063ab33](https://github.com/module-federation/nextjs-mf/commit/063ab336c4830aff4f5bd3b9894df60b4651a9be))
package/dist/README.md ADDED
@@ -0,0 +1,183 @@
1
+ # native-federation-tests
2
+
3
+ Bundler agnostic plugins to share federated components for testing purposes.
4
+
5
+ It aims to work for both [`vitest`](https://vitest.dev/) and [`jest`](https://jestjs.io/).
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm i -D @module-federation/native-federation-tests
11
+ ```
12
+
13
+ This module provides two plugins:
14
+
15
+ ### NativeFederationTestsRemote
16
+
17
+ This plugin is used to concat the components that will be used in tests.
18
+
19
+ #### Configuration
20
+
21
+ ```typescript
22
+ {
23
+ moduleFederationConfig: any; // the same configuration provided to the module federation plugin, it is MANDATORY
24
+ additionalBundlerConfig?: TsupOptions; // additional `tsup` build options that will be merged with the one generated by the plugin, default is {}
25
+ distFolder?: string; // folder used to store the dist, default is './dist'
26
+ testsFolder?: string; // folder where all the files will be stored, default is '@mf-tests'
27
+ deleteTestsFolder?: boolean; // indicate if the concatenated components folder will be deleted when the job completes, default is 'true'
28
+ }
29
+ ```
30
+
31
+ #### Additional configuration
32
+
33
+ Note that, for Webpack, the plugin automatically inject the `devServer.static.directory` configuration.
34
+ For the other bundlers, you should configure it by yourself.
35
+
36
+ ### NativeFederationTestsHost
37
+
38
+ This plugin is used to download the concatenated components mock that will be used for tests.
39
+
40
+ ### Configuration
41
+
42
+ ```typescript
43
+ {
44
+ moduleFederationConfig: any; // the configuration same configuration provided to the module federation plugin, it is MANDATORY
45
+ testsFolder?: string; // folder where all the files have been stored, default is '@mf-tests',
46
+ mocksFolder?: string; // folder where the concatenated files will be stored, default is './__mocks__',
47
+ deleteTestsFolder?: boolean; // indicate if the tests mock folder will be deleted before the job starts, default is 'true'
48
+ maxRetries?: number; // The number of times the plugin will try to download the mocks before failing, default is 3
49
+ }
50
+ ```
51
+
52
+ ## Bundler configuration
53
+
54
+ <details>
55
+ <summary>Vite</summary><br>
56
+
57
+ ```ts
58
+ // vite.config.ts
59
+ import { NativeFederationTestsHost, NativeFederationTestsRemote } from '@module-federation/native-federation-tests/vite';
60
+
61
+ export default defineConfig({
62
+ plugins: [
63
+ NativeFederationTestsRemote({
64
+ /* options */
65
+ }),
66
+ NativeFederationTestsHost({
67
+ /* options */
68
+ }),
69
+ ],
70
+ /* ... */
71
+ server: {
72
+ // This is needed to emulate the devServer.static.directory of WebPack and correctly serve the zip file
73
+ /* ... */
74
+ proxy: {
75
+ '/@mf-types.zip': {
76
+ target: 'http://localhost:3000',
77
+ changeOrigin: true,
78
+ rewrite: () => `/@fs/${process.cwd()}/dist/@mf-types.zip`,
79
+ },
80
+ },
81
+ fs: {
82
+ /* ... */
83
+ allow: ['./dist'],
84
+ /* ... */
85
+ },
86
+ },
87
+ });
88
+ ```
89
+
90
+ <br>
91
+ </details>
92
+ <details>
93
+ <summary>Rollup</summary><br>
94
+
95
+ ```ts
96
+ // rollup.config.js
97
+ import { NativeFederationTestsHost, NativeFederationTestsRemote } from '@module-federation/native-federation-tests/rollup';
98
+
99
+ export default {
100
+ plugins: [
101
+ NativeFederationTestsRemote({
102
+ /* options */
103
+ }),
104
+ NativeFederationTestsHost({
105
+ /* options */
106
+ }),
107
+ ],
108
+ };
109
+ ```
110
+
111
+ <br>
112
+ </details>
113
+ <details>
114
+ <summary>Webpack</summary><br>
115
+
116
+ ```ts
117
+ // webpack.config.js
118
+ const { NativeFederationTestsHost, NativeFederationTestsRemote } = require('@module-federation/native-federation-tests/webpack');
119
+ module.exports = {
120
+ /* ... */
121
+ plugins: [
122
+ NativeFederationTestsRemote({
123
+ /* options */
124
+ }),
125
+ NativeFederationTestsHost({
126
+ /* options */
127
+ }),
128
+ ],
129
+ };
130
+ ```
131
+
132
+ <br>
133
+ </details>
134
+ <details>
135
+ <summary>esbuild</summary><br>
136
+
137
+ ```ts
138
+ // esbuild.config.js
139
+ import { build } from 'esbuild';
140
+ import { NativeFederationTestsHost, NativeFederationTestsRemote } from '@module-federation/native-federation-tests/esbuild';
141
+
142
+ build({
143
+ plugins: [
144
+ NativeFederationTestsRemote({
145
+ /* options */
146
+ }),
147
+ NativeFederationTestsHost({
148
+ /* options */
149
+ }),
150
+ ],
151
+ });
152
+ ```
153
+
154
+ <br>
155
+ </details>
156
+
157
+ <details>
158
+ <summary>Rspack</summary><br>
159
+
160
+ ```ts
161
+ // rspack.config.js
162
+ const { NativeFederationTestsHost, NativeFederationTestsRemote } = require('@module-federation/native-federation-tests/rspack');
163
+
164
+ module.exports = {
165
+ /* ... */
166
+ plugins: [
167
+ NativeFederationTestsRemote({
168
+ /* options */
169
+ }),
170
+ NativeFederationTestsHost({
171
+ /* options */
172
+ }),
173
+ ],
174
+ };
175
+ ```
176
+
177
+ <br>
178
+ </details>
179
+
180
+ ## Examples
181
+
182
+ To use it in a `host` module, refer to [this example](https://github.com/module-federation/module-federation-examples/tree/master/native-federation-tests-typescript-plugins/host).
183
+ To use it in a `remote` module, refer to [this example](https://github.com/module-federation/module-federation-examples/tree/master/native-federation-tests-typescript-plugins/remote).
@@ -5,6 +5,7 @@ interface HostOptions {
5
5
  testsFolder?: string;
6
6
  mocksFolder?: string;
7
7
  deleteTestsFolder?: boolean;
8
+ maxRetries?: number;
8
9
  }
9
10
 
10
11
  interface RemoteOptions {
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _ansicolors = require('ansi-colors'); var _ansicolors2 = _interopRequireDefault(_ansicolors);var _promises = require('fs/promises');var _path = require('path');var _rambda = require('rambda');var _tsup = require('tsup');var _unplugin = require('unplugin');var w={testsFolder:"@mf-tests",mocksFolder:"./__mocks__",deleteTestsFolder:!0,maxRetries:3},O=t=>{let e=t.split("@");return e[e.length-1]},x=(t,e)=>{let o=O(e),r=new URL(o),s=r.pathname.split("/").slice(0,-1).join("/");return r.pathname=`${s}/${t.testsFolder}.zip`,r.href},h=t=>Object.entries(t.moduleFederationConfig.remotes).reduce((e,[o,r])=>(e[o]=x(t,r),e),{}),a=t=>{if(!t.moduleFederationConfig)throw new Error("moduleFederationConfig is required");let e={...w,...t},o=h(e);return{hostOptions:e,mapRemotesToDownload:o}};var _fs = require('fs');var y={testsFolder:"@mf-tests",distFolder:"./dist",deleteTestsFolder:!0,additionalBundlerConfig:{}},C=["ts","tsx","js","jsx","mjs"],c=t=>{let e=process.cwd();for(let o of C){let r=_path.join.call(void 0, e,`${t}.${o}`);if(_fs.existsSync.call(void 0, r))return r}},T=t=>Object.entries(t.moduleFederationConfig.exposes).reduce((e,[o,r])=>(e[o]=c(r)||c(_path.join.call(void 0, r,"index"))||r,e),{}),l=t=>{if(!t.moduleFederationConfig)throw new Error("moduleFederationConfig is required");let e={...y,...t},o=T(e),r=Object.keys(t.moduleFederationConfig.shared||{}).concat(Object.keys(t.moduleFederationConfig.remotes||{})),s=_path.join.call(void 0, e.distFolder,e.testsFolder);return{remoteOptions:e,externalDeps:r,compiledFilesFolder:s,mapComponentsToExpose:o}};var _admzip = require('adm-zip'); var _admzip2 = _interopRequireDefault(_admzip);var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);var H=t=>_path.join.call(void 0, t.distFolder,`${t.testsFolder}.zip`),u=async(t,e)=>{let o=new _admzip2.default;return o.addLocalFolder(e),o.writeZipPromise(H(t))},E=(t,e)=>o=>{throw{...o,message:`Network error: Unable to download federated mocks for '${t}' from '${e}' because '${o.message}'`}},g=t=>{let e=0;return async([o,r])=>{let s=_path.join.call(void 0, t.mocksFolder,o);for(;e++<t.maxRetries;)try{let i=await _axios2.default.get(r,{responseType:"arraybuffer"}).catch(E(o,r));new (0, _admzip2.default)(Buffer.from(i.data)).extractAllTo(s,!0);break}catch(i){if(console.error(_ansicolors2.default.red(`Error during types archive download: ${(i==null?void 0:i.message)||"unknown error"}`)),e>=t.maxRetries)throw i}}};var R=async(t,e)=>{let o=e.map(r=>{let s=_path.join.call(void 0, t.mocksFolder,r);return _promises.rm.call(void 0, s,{recursive:!0,force:!0})});return Promise.allSettled(o)};var ie=_unplugin.createUnplugin.call(void 0, t=>{let{remoteOptions:e,compiledFilesFolder:o,externalDeps:r,mapComponentsToExpose:s}=l(t);return{name:"native-federation-tests/remote",async writeBundle(){let i=_rambda.mergeRight.call(void 0, e.additionalBundlerConfig,{external:r.map(n=>new RegExp(`^${n}`)),entry:s,outDir:o,silent:!0});try{await _tsup.build.call(void 0, i),await u(e,o),e.deleteTestsFolder&&await _promises.rm.call(void 0, o,{recursive:!0,force:!0}),console.log(_ansicolors2.default.green("Federated mocks created correctly"))}catch(n){console.error(_ansicolors2.default.red(`Unable to build federated mocks: ${n}`))}},webpack:i=>{i.options.devServer=_rambda.mergeDeepRight.call(void 0, i.options.devServer||{},{static:{directory:_path.resolve.call(void 0, e.distFolder)}})}}}),ne= exports.b =_unplugin.createUnplugin.call(void 0, t=>{let{hostOptions:e,mapRemotesToDownload:o}=a(t);return{name:"native-federation-tests/host",async writeBundle(){e.deleteTestsFolder&&await R(e,Object.keys(o));let r=g(e),s=Object.entries(o).map(r);await Promise.allSettled(s),console.log(_ansicolors2.default.green("Federated mocks extraction completed"))}}});exports.a = ie; exports.b = ne;
@@ -0,0 +1 @@
1
+ import m from"ansi-colors";import{rm as q}from"fs/promises";import{resolve as S}from"path";import{mergeDeepRight as P,mergeRight as U}from"rambda";import{build as D}from"tsup";import{createUnplugin as F}from"unplugin";var w={testsFolder:"@mf-tests",mocksFolder:"./__mocks__",deleteTestsFolder:!0,maxRetries:3},O=t=>{let e=t.split("@");return e[e.length-1]},x=(t,e)=>{let o=O(e),r=new URL(o),s=r.pathname.split("/").slice(0,-1).join("/");return r.pathname=`${s}/${t.testsFolder}.zip`,r.href},h=t=>Object.entries(t.moduleFederationConfig.remotes).reduce((e,[o,r])=>(e[o]=x(t,r),e),{}),a=t=>{if(!t.moduleFederationConfig)throw new Error("moduleFederationConfig is required");let e={...w,...t},o=h(e);return{hostOptions:e,mapRemotesToDownload:o}};import{existsSync as v}from"fs";import{join as d}from"path";var y={testsFolder:"@mf-tests",distFolder:"./dist",deleteTestsFolder:!0,additionalBundlerConfig:{}},C=["ts","tsx","js","jsx","mjs"],c=t=>{let e=process.cwd();for(let o of C){let r=d(e,`${t}.${o}`);if(v(r))return r}},T=t=>Object.entries(t.moduleFederationConfig.exposes).reduce((e,[o,r])=>(e[o]=c(r)||c(d(r,"index"))||r,e),{}),l=t=>{if(!t.moduleFederationConfig)throw new Error("moduleFederationConfig is required");let e={...y,...t},o=T(e),r=Object.keys(t.moduleFederationConfig.shared||{}).concat(Object.keys(t.moduleFederationConfig.remotes||{})),s=d(e.distFolder,e.testsFolder);return{remoteOptions:e,externalDeps:r,compiledFilesFolder:s,mapComponentsToExpose:o}};import p from"adm-zip";import k from"ansi-colors";import b from"axios";import{join as f}from"path";var H=t=>f(t.distFolder,`${t.testsFolder}.zip`),u=async(t,e)=>{let o=new p;return o.addLocalFolder(e),o.writeZipPromise(H(t))},E=(t,e)=>o=>{throw{...o,message:`Network error: Unable to download federated mocks for '${t}' from '${e}' because '${o.message}'`}},g=t=>{let e=0;return async([o,r])=>{let s=f(t.mocksFolder,o);for(;e++<t.maxRetries;)try{let i=await b.get(r,{responseType:"arraybuffer"}).catch(E(o,r));new p(Buffer.from(i.data)).extractAllTo(s,!0);break}catch(i){if(console.error(k.red(`Error during types archive download: ${(i==null?void 0:i.message)||"unknown error"}`)),e>=t.maxRetries)throw i}}};import{rm as j}from"fs/promises";import{join as $}from"path";var R=async(t,e)=>{let o=e.map(r=>{let s=$(t.mocksFolder,r);return j(s,{recursive:!0,force:!0})});return Promise.allSettled(o)};var ie=F(t=>{let{remoteOptions:e,compiledFilesFolder:o,externalDeps:r,mapComponentsToExpose:s}=l(t);return{name:"native-federation-tests/remote",async writeBundle(){let i=U(e.additionalBundlerConfig,{external:r.map(n=>new RegExp(`^${n}`)),entry:s,outDir:o,silent:!0});try{await D(i),await u(e,o),e.deleteTestsFolder&&await q(o,{recursive:!0,force:!0}),console.log(m.green("Federated mocks created correctly"))}catch(n){console.error(m.red(`Unable to build federated mocks: ${n}`))}},webpack:i=>{i.options.devServer=P(i.options.devServer||{},{static:{directory:S(e.distFolder)}})}}}),ne=F(t=>{let{hostOptions:e,mapRemotesToDownload:o}=a(t);return{name:"native-federation-tests/host",async writeBundle(){e.deleteTestsFolder&&await R(e,Object.keys(o));let r=g(e),s=Object.entries(o).map(r);await Promise.allSettled(s),console.log(m.green("Federated mocks extraction completed"))}}});export{ie as a,ne as b};
@@ -0,0 +1,7 @@
1
+ import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-817643e7.js';
2
+ import 'tsup';
3
+
4
+ declare const NativeFederationTestsRemote: (options: RemoteOptions) => undefined;
5
+ declare const NativeFederationTestsHost: (options: HostOptions) => undefined;
6
+
7
+ export { NativeFederationTestsHost, NativeFederationTestsRemote };
package/dist/esbuild.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-ae724cfa.js';
1
+ import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-817643e7.js';
2
2
  import 'tsup';
3
3
 
4
4
  declare const NativeFederationTestsRemote: (options: RemoteOptions) => undefined;
package/dist/esbuild.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk24MJVW7Ijs = require('./chunk-24MJVW7I.js');var o=_chunk24MJVW7Ijs.a.esbuild,a= exports.NativeFederationTestsHost =_chunk24MJVW7Ijs.b.esbuild;exports.NativeFederationTestsHost = a; exports.NativeFederationTestsRemote = o;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBQSZF2O6js = require('./chunk-BQSZF2O6.js');var o=_chunkBQSZF2O6js.a.esbuild,a= exports.NativeFederationTestsHost =_chunkBQSZF2O6js.b.esbuild;exports.NativeFederationTestsHost = a; exports.NativeFederationTestsRemote = o;
package/dist/esbuild.mjs CHANGED
@@ -1 +1 @@
1
- import{a as e,b as t}from"./chunk-S3SK3ESO.mjs";var o=e.esbuild,a=t.esbuild;export{a as NativeFederationTestsHost,o as NativeFederationTestsRemote};
1
+ import{a as e,b as t}from"./chunk-UX3M4KPA.mjs";var o=e.esbuild,a=t.esbuild;export{a as NativeFederationTestsHost,o as NativeFederationTestsRemote};
@@ -0,0 +1,8 @@
1
+ import * as unplugin from 'unplugin';
2
+ import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-817643e7.js';
3
+ import 'tsup';
4
+
5
+ declare const NativeFederationTestsRemote: unplugin.UnpluginInstance<RemoteOptions, boolean>;
6
+ declare const NativeFederationTestsHost: unplugin.UnpluginInstance<HostOptions, boolean>;
7
+
8
+ export { NativeFederationTestsHost, NativeFederationTestsRemote };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as unplugin from 'unplugin';
2
- import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-ae724cfa.js';
2
+ import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-817643e7.js';
3
3
  import 'tsup';
4
4
 
5
5
  declare const NativeFederationTestsRemote: unplugin.UnpluginInstance<RemoteOptions, boolean>;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk24MJVW7Ijs = require('./chunk-24MJVW7I.js');exports.NativeFederationTestsHost = _chunk24MJVW7Ijs.b; exports.NativeFederationTestsRemote = _chunk24MJVW7Ijs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBQSZF2O6js = require('./chunk-BQSZF2O6.js');exports.NativeFederationTestsHost = _chunkBQSZF2O6js.b; exports.NativeFederationTestsRemote = _chunkBQSZF2O6js.a;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{a,b}from"./chunk-S3SK3ESO.mjs";export{b as NativeFederationTestsHost,a as NativeFederationTestsRemote};
1
+ import{a,b}from"./chunk-UX3M4KPA.mjs";export{b as NativeFederationTestsHost,a as NativeFederationTestsRemote};
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@module-federation/native-federation-tests",
3
+ "version": "0.3.0",
4
+ "description": "Bundler agnostic unplugin to share federated tests",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "files": [
9
+ "dist/",
10
+ "README.md"
11
+ ],
12
+ "exports": {
13
+ ".": {
14
+ "import": "./dist/index.mjs",
15
+ "require": "./dist/index.js",
16
+ "types": "./dist/index.d.ts"
17
+ },
18
+ "./rollup": {
19
+ "types": "./dist/rollup.d.ts",
20
+ "require": "./dist/rollup.js",
21
+ "import": "./dist/rollup.mjs"
22
+ },
23
+ "./vite": {
24
+ "types": "./dist/vite.d.ts",
25
+ "require": "./dist/vite.js",
26
+ "import": "./dist/vite.mjs"
27
+ },
28
+ "./webpack": {
29
+ "types": "./dist/webpack.d.ts",
30
+ "require": "./dist/webpack.js",
31
+ "import": "./dist/webpack.mjs"
32
+ },
33
+ "./esbuild": {
34
+ "types": "./dist/esbuild.d.ts",
35
+ "require": "./dist/esbuild.js",
36
+ "import": "./dist/esbuild.mjs"
37
+ },
38
+ "./rspack": {
39
+ "types": "./dist/rspack.d.ts",
40
+ "require": "./dist/rspack.js",
41
+ "import": "./dist/rspack.mjs"
42
+ }
43
+ },
44
+ "main": "./dist/index.js",
45
+ "types": "./dist/index.d.ts",
46
+ "keywords": [
47
+ "module federation",
48
+ "tests",
49
+ "remote tests",
50
+ "federated tests"
51
+ ],
52
+ "author": "Matteo Pietro Dazzi <matteopietro.dazzi@gmail.com> (https://github.com/ilteoood)",
53
+ "license": "MIT",
54
+ "dependencies": {
55
+ "adm-zip": "^0.5.10",
56
+ "ansi-colors": "^4.1.3",
57
+ "axios": "^1.3.4",
58
+ "rambda": "^7.5.0",
59
+ "tsup": "^7.0.0",
60
+ "unplugin": "^1.3.1"
61
+ }
62
+ }
@@ -0,0 +1,8 @@
1
+ import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-817643e7.js';
2
+ import * as unplugin from 'unplugin';
3
+ import 'tsup';
4
+
5
+ declare const NativeFederationTestsRemote: (options: RemoteOptions) => unplugin.RollupPlugin | unplugin.RollupPlugin[];
6
+ declare const NativeFederationTestsHost: (options: HostOptions) => unplugin.RollupPlugin | unplugin.RollupPlugin[];
7
+
8
+ export { NativeFederationTestsHost, NativeFederationTestsRemote };
package/dist/rollup.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-ae724cfa.js';
1
+ import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-817643e7.js';
2
+ import * as unplugin from 'unplugin';
2
3
  import 'tsup';
3
4
 
4
- declare const NativeFederationTestsRemote: (options: RemoteOptions) => undefined | undefined[];
5
- declare const NativeFederationTestsHost: (options: HostOptions) => undefined | undefined[];
5
+ declare const NativeFederationTestsRemote: (options: RemoteOptions) => unplugin.RollupPlugin | unplugin.RollupPlugin[];
6
+ declare const NativeFederationTestsHost: (options: HostOptions) => unplugin.RollupPlugin | unplugin.RollupPlugin[];
6
7
 
7
8
  export { NativeFederationTestsHost, NativeFederationTestsRemote };
package/dist/rollup.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk24MJVW7Ijs = require('./chunk-24MJVW7I.js');var s=_chunk24MJVW7Ijs.a.rollup,a= exports.NativeFederationTestsHost =_chunk24MJVW7Ijs.b.rollup;exports.NativeFederationTestsHost = a; exports.NativeFederationTestsRemote = s;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBQSZF2O6js = require('./chunk-BQSZF2O6.js');var s=_chunkBQSZF2O6js.a.rollup,a= exports.NativeFederationTestsHost =_chunkBQSZF2O6js.b.rollup;exports.NativeFederationTestsHost = a; exports.NativeFederationTestsRemote = s;
package/dist/rollup.mjs CHANGED
@@ -1 +1 @@
1
- import{a as e,b as t}from"./chunk-S3SK3ESO.mjs";var s=e.rollup,a=t.rollup;export{a as NativeFederationTestsHost,s as NativeFederationTestsRemote};
1
+ import{a as e,b as t}from"./chunk-UX3M4KPA.mjs";var s=e.rollup,a=t.rollup;export{a as NativeFederationTestsHost,s as NativeFederationTestsRemote};
@@ -0,0 +1,7 @@
1
+ import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-817643e7.js';
2
+ import 'tsup';
3
+
4
+ declare const NativeFederationTestsRemote: (options: RemoteOptions) => RspackPluginInstance;
5
+ declare const NativeFederationTestsHost: (options: HostOptions) => RspackPluginInstance;
6
+
7
+ export { NativeFederationTestsHost, NativeFederationTestsRemote };
package/dist/rspack.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-ae724cfa.js';
1
+ import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-817643e7.js';
2
2
  import 'tsup';
3
3
 
4
4
  declare const NativeFederationTestsRemote: (options: RemoteOptions) => RspackPluginInstance;
package/dist/rspack.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk24MJVW7Ijs = require('./chunk-24MJVW7I.js');var o=_chunk24MJVW7Ijs.a.rspack,a= exports.NativeFederationTestsHost =_chunk24MJVW7Ijs.b.rspack;exports.NativeFederationTestsHost = a; exports.NativeFederationTestsRemote = o;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBQSZF2O6js = require('./chunk-BQSZF2O6.js');var o=_chunkBQSZF2O6js.a.rspack,a= exports.NativeFederationTestsHost =_chunkBQSZF2O6js.b.rspack;exports.NativeFederationTestsHost = a; exports.NativeFederationTestsRemote = o;
package/dist/rspack.mjs CHANGED
@@ -1 +1 @@
1
- import{a as e,b as t}from"./chunk-S3SK3ESO.mjs";var o=e.rspack,a=t.rspack;export{a as NativeFederationTestsHost,o as NativeFederationTestsRemote};
1
+ import{a as e,b as t}from"./chunk-UX3M4KPA.mjs";var o=e.rspack,a=t.rspack;export{a as NativeFederationTestsHost,o as NativeFederationTestsRemote};
@@ -0,0 +1,7 @@
1
+ import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-817643e7.js';
2
+ import 'tsup';
3
+
4
+ declare const NativeFederationTestsRemote: (options: RemoteOptions) => any;
5
+ declare const NativeFederationTestsHost: (options: HostOptions) => any;
6
+
7
+ export { NativeFederationTestsHost, NativeFederationTestsRemote };
package/dist/vite.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-ae724cfa.js';
1
+ import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-817643e7.js';
2
2
  import 'tsup';
3
3
 
4
4
  declare const NativeFederationTestsRemote: (options: RemoteOptions) => any;
package/dist/vite.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk24MJVW7Ijs = require('./chunk-24MJVW7I.js');var s=_chunk24MJVW7Ijs.a.vite,i= exports.NativeFederationTestsHost =_chunk24MJVW7Ijs.b.vite;exports.NativeFederationTestsHost = i; exports.NativeFederationTestsRemote = s;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBQSZF2O6js = require('./chunk-BQSZF2O6.js');var s=_chunkBQSZF2O6js.a.vite,i= exports.NativeFederationTestsHost =_chunkBQSZF2O6js.b.vite;exports.NativeFederationTestsHost = i; exports.NativeFederationTestsRemote = s;
package/dist/vite.mjs CHANGED
@@ -1 +1 @@
1
- import{a as t,b as e}from"./chunk-S3SK3ESO.mjs";var s=t.vite,i=e.vite;export{i as NativeFederationTestsHost,s as NativeFederationTestsRemote};
1
+ import{a as t,b as e}from"./chunk-UX3M4KPA.mjs";var s=t.vite,i=e.vite;export{i as NativeFederationTestsHost,s as NativeFederationTestsRemote};
@@ -0,0 +1,7 @@
1
+ import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-817643e7.js';
2
+ import 'tsup';
3
+
4
+ declare const NativeFederationTestsRemote: (options: RemoteOptions) => undefined;
5
+ declare const NativeFederationTestsHost: (options: HostOptions) => undefined;
6
+
7
+ export { NativeFederationTestsHost, NativeFederationTestsRemote };
package/dist/webpack.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-ae724cfa.js';
1
+ import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-817643e7.js';
2
2
  import 'tsup';
3
3
 
4
4
  declare const NativeFederationTestsRemote: (options: RemoteOptions) => undefined;
package/dist/webpack.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk24MJVW7Ijs = require('./chunk-24MJVW7I.js');var s=_chunk24MJVW7Ijs.a.webpack,a= exports.NativeFederationTestsHost =_chunk24MJVW7Ijs.b.webpack;exports.NativeFederationTestsHost = a; exports.NativeFederationTestsRemote = s;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBQSZF2O6js = require('./chunk-BQSZF2O6.js');var s=_chunkBQSZF2O6js.a.webpack,a= exports.NativeFederationTestsHost =_chunkBQSZF2O6js.b.webpack;exports.NativeFederationTestsHost = a; exports.NativeFederationTestsRemote = s;
package/dist/webpack.mjs CHANGED
@@ -1 +1 @@
1
- import{a as e,b as t}from"./chunk-S3SK3ESO.mjs";var s=e.webpack,a=t.webpack;export{a as NativeFederationTestsHost,s as NativeFederationTestsRemote};
1
+ import{a as e,b as t}from"./chunk-UX3M4KPA.mjs";var s=e.webpack,a=t.webpack;export{a as NativeFederationTestsHost,s as NativeFederationTestsRemote};
package/package.json CHANGED
@@ -1,10 +1,14 @@
1
1
  {
2
2
  "name": "@module-federation/native-federation-tests",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Bundler agnostic unplugin to share federated tests",
5
5
  "publishConfig": {
6
- "registry": "https://registry.npmjs.org/"
6
+ "access": "public"
7
7
  },
8
+ "files": [
9
+ "dist/",
10
+ "README.md"
11
+ ],
8
12
  "exports": {
9
13
  ".": {
10
14
  "import": "./dist/index.mjs",
@@ -52,7 +56,7 @@
52
56
  "ansi-colors": "^4.1.3",
53
57
  "axios": "^1.3.4",
54
58
  "rambda": "^7.5.0",
55
- "tsup": "^6.7.0",
59
+ "tsup": "^7.0.0",
56
60
  "unplugin": "^1.3.1"
57
61
  }
58
- }
62
+ }
package/CHANGELOG.md DELETED
@@ -1,50 +0,0 @@
1
- # Changelog
2
-
3
- This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
-
5
- # [0.2.0](https://github.com/module-federation/nextjs-mf/compare/native-federation-tests-0.1.2...native-federation-tests-0.2.0) (2023-04-29)
6
-
7
-
8
- ### Bug Fixes
9
-
10
- * removed any from error logger type ([fb9fcc3](https://github.com/module-federation/nextjs-mf/commit/fb9fcc3a54a13be36335830f076a86557b75bb4a))
11
- * subpath ([1548501](https://github.com/module-federation/nextjs-mf/commit/1548501bb4679c0c534c02609cb6bc5459f224a4))
12
-
13
-
14
- ### Features
15
-
16
- * release to npm with next tag to not ruine latest one ([#763](https://github.com/module-federation/nextjs-mf/issues/763)) ([f2d199b](https://github.com/module-federation/nextjs-mf/commit/f2d199b3b3fbbd428514b1ce1f139efc82f7fff0))
17
-
18
-
19
-
20
- ## [0.1.2](https://github.com/module-federation/nextjs-mf/compare/native-federation-tests-0.1.1...native-federation-tests-0.1.2) (2023-04-14)
21
-
22
-
23
- ### Bug Fixes
24
-
25
- * tests regex, external deps should be removed using the startsWith strategy ([5d1c0f5](https://github.com/module-federation/nextjs-mf/commit/5d1c0f5b947ec7690fbe69ec8cc23701f975bae9))
26
-
27
-
28
-
29
- ## [0.1.1](https://github.com/module-federation/nextjs-mf/compare/native-federation-tests-0.1.0...native-federation-tests-0.1.1) (2023-04-12)
30
-
31
-
32
-
33
- # 0.1.0 (2023-04-11)
34
-
35
-
36
- ### Bug Fixes
37
-
38
- * build ([d0b2f72](https://github.com/module-federation/nextjs-mf/commit/d0b2f72f4fc3647825412be1574311c3152cf167))
39
- * build step ([a217170](https://github.com/module-federation/nextjs-mf/commit/a21717096cbc09bff20d3aeebfea2f3533afb0d7))
40
- * deps ([a378441](https://github.com/module-federation/nextjs-mf/commit/a37844194a3f189cc5863bbdd4776259bce69fa4))
41
- * native build chunks ([d6c9f8a](https://github.com/module-federation/nextjs-mf/commit/d6c9f8a957ed00a8d92332ccc38ed9780f01d54e))
42
- * package name ([dcb8480](https://github.com/module-federation/nextjs-mf/commit/dcb848025bbe56a7fc5bd3643462a64d22699cc7))
43
- * readme ([eaca0b3](https://github.com/module-federation/nextjs-mf/commit/eaca0b311d3b8d9e73309cb92d9a9488f9fc23c0))
44
- * readme ([74fc6fa](https://github.com/module-federation/nextjs-mf/commit/74fc6fa21ac10ce3cd9dd942a5b392ef50c51f56))
45
- * README.md ([9159171](https://github.com/module-federation/nextjs-mf/commit/91591712e9a103fff351f0a168c149470c0d69ad))
46
-
47
-
48
- ### Features
49
-
50
- * federated tests plugin ([063ab33](https://github.com/module-federation/nextjs-mf/commit/063ab336c4830aff4f5bd3b9894df60b4651a9be))
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _ansicolors = require('ansi-colors'); var _ansicolors2 = _interopRequireDefault(_ansicolors);var _promises = require('fs/promises');var _path = require('path');var _rambda = require('rambda');var _tsup = require('tsup');var _unplugin = require('unplugin');var R={testsFolder:"@mf-tests",mocksFolder:"./__mocks__",deleteTestsFolder:!0},w=(o,e)=>{let t=e.split("@").at(-1),r=new URL(t),s=r.pathname.split("/").slice(0,-1).join("/");return r.pathname=`${s}/${o.testsFolder}.zip`,r.href},x=o=>Object.entries(o.moduleFederationConfig.remotes).reduce((e,[t,r])=>(e[t]=w(o,r),e),{}),c=o=>{if(!o.moduleFederationConfig)throw new Error("moduleFederationConfig is required");let e={...R,...o},t=x(e);return{hostOptions:e,mapRemotesToDownload:t}};var _fs = require('fs');var h={testsFolder:"@mf-tests",distFolder:"./dist",deleteTestsFolder:!0,additionalBundlerConfig:{}},y=["ts","tsx","js","jsx","mjs"],p=o=>{let e=process.cwd();for(let t of y){let r=_path.join.call(void 0, e,`${o}.${t}`);if(_fs.existsSync.call(void 0, r))return r}},C=o=>Object.entries(o.moduleFederationConfig.exposes).reduce((e,[t,r])=>(e[t]=p(r)||p(_path.join.call(void 0, r,"index"))||r,e),{}),a=o=>{if(!o.moduleFederationConfig)throw new Error("moduleFederationConfig is required");let e={...h,...o},t=C(e),r=Object.keys(o.moduleFederationConfig.shared||{}).concat(Object.keys(o.moduleFederationConfig.remotes||{})),s=_path.join.call(void 0, e.distFolder,e.testsFolder);return{remoteOptions:e,externalDeps:r,compiledFilesFolder:s,mapComponentsToExpose:t}};var _admzip = require('adm-zip'); var _admzip2 = _interopRequireDefault(_admzip);var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);var k=o=>_path.join.call(void 0, o.distFolder,`${o.testsFolder}.zip`),u=async(o,e)=>{let t=new _admzip2.default;return t.addLocalFolder(e),t.writeZipPromise(k(o))},H=(o,e)=>t=>{throw console.error(_ansicolors2.default.red(`Unable to download federated mocks for '${o}' from '${e}' because '${t.message}', skipping...`)),t},g=o=>async([e,t])=>{let r=await _axios2.default.get(t,{responseType:"arraybuffer"}).catch(H(e,t)),s=_path.join.call(void 0, o.mocksFolder,e);new (0, _admzip2.default)(Buffer.from(r.data)).extractAllTo(s,!0)};var F=async(o,e)=>{let t=e.map(r=>{let s=_path.join.call(void 0, o.mocksFolder,r);return _promises.rm.call(void 0, s,{recursive:!0,force:!0})});return Promise.allSettled(t)};var se=_unplugin.createUnplugin.call(void 0, o=>{let{remoteOptions:e,compiledFilesFolder:t,externalDeps:r,mapComponentsToExpose:s}=a(o);return{name:"native-federation-tests/remote",async writeBundle(){let n=_rambda.mergeRight.call(void 0, e.additionalBundlerConfig,{external:r.map(i=>new RegExp(`^${i}`)),entry:s,outDir:t,silent:!0});try{await _tsup.build.call(void 0, n),await u(e,t),e.deleteTestsFolder&&await _promises.rm.call(void 0, t,{recursive:!0,force:!0}),console.log(_ansicolors2.default.green("Federated mocks created correctly"))}catch(i){console.error(_ansicolors2.default.red(`Unable to build federated mocks: ${i}`))}},webpack:n=>{n.options.devServer=_rambda.mergeDeepRight.call(void 0, n.options.devServer||{},{static:{directory:_path.resolve.call(void 0, e.distFolder)}})}}}),ne= exports.b =_unplugin.createUnplugin.call(void 0, o=>{let{hostOptions:e,mapRemotesToDownload:t}=c(o);return{name:"native-federation-tests/host",async writeBundle(){e.deleteTestsFolder&&await F(e,Object.keys(t));let r=g(e),s=Object.entries(t).map(r);await Promise.allSettled(s),console.log(_ansicolors2.default.green("Federated mocks extraction completed"))}}});exports.a = se; exports.b = ne;
@@ -1 +0,0 @@
1
- import m from"ansi-colors";import{rm as q}from"fs/promises";import{resolve as $}from"path";import{mergeDeepRight as S,mergeRight as D}from"rambda";import{build as U}from"tsup";import{createUnplugin as O}from"unplugin";var R={testsFolder:"@mf-tests",mocksFolder:"./__mocks__",deleteTestsFolder:!0},w=(o,e)=>{let t=e.split("@").at(-1),r=new URL(t),s=r.pathname.split("/").slice(0,-1).join("/");return r.pathname=`${s}/${o.testsFolder}.zip`,r.href},x=o=>Object.entries(o.moduleFederationConfig.remotes).reduce((e,[t,r])=>(e[t]=w(o,r),e),{}),c=o=>{if(!o.moduleFederationConfig)throw new Error("moduleFederationConfig is required");let e={...R,...o},t=x(e);return{hostOptions:e,mapRemotesToDownload:t}};import{existsSync as v}from"fs";import{join as d}from"path";var h={testsFolder:"@mf-tests",distFolder:"./dist",deleteTestsFolder:!0,additionalBundlerConfig:{}},y=["ts","tsx","js","jsx","mjs"],p=o=>{let e=process.cwd();for(let t of y){let r=d(e,`${o}.${t}`);if(v(r))return r}},C=o=>Object.entries(o.moduleFederationConfig.exposes).reduce((e,[t,r])=>(e[t]=p(r)||p(d(r,"index"))||r,e),{}),a=o=>{if(!o.moduleFederationConfig)throw new Error("moduleFederationConfig is required");let e={...h,...o},t=C(e),r=Object.keys(o.moduleFederationConfig.shared||{}).concat(Object.keys(o.moduleFederationConfig.remotes||{})),s=d(e.distFolder,e.testsFolder);return{remoteOptions:e,externalDeps:r,compiledFilesFolder:s,mapComponentsToExpose:t}};import l from"adm-zip";import T from"ansi-colors";import b from"axios";import{join as f}from"path";var k=o=>f(o.distFolder,`${o.testsFolder}.zip`),u=async(o,e)=>{let t=new l;return t.addLocalFolder(e),t.writeZipPromise(k(o))},H=(o,e)=>t=>{throw console.error(T.red(`Unable to download federated mocks for '${o}' from '${e}' because '${t.message}', skipping...`)),t},g=o=>async([e,t])=>{let r=await b.get(t,{responseType:"arraybuffer"}).catch(H(e,t)),s=f(o.mocksFolder,e);new l(Buffer.from(r.data)).extractAllTo(s,!0)};import{rm as j}from"fs/promises";import{join as E}from"path";var F=async(o,e)=>{let t=e.map(r=>{let s=E(o.mocksFolder,r);return j(s,{recursive:!0,force:!0})});return Promise.allSettled(t)};var se=O(o=>{let{remoteOptions:e,compiledFilesFolder:t,externalDeps:r,mapComponentsToExpose:s}=a(o);return{name:"native-federation-tests/remote",async writeBundle(){let n=D(e.additionalBundlerConfig,{external:r.map(i=>new RegExp(`^${i}`)),entry:s,outDir:t,silent:!0});try{await U(n),await u(e,t),e.deleteTestsFolder&&await q(t,{recursive:!0,force:!0}),console.log(m.green("Federated mocks created correctly"))}catch(i){console.error(m.red(`Unable to build federated mocks: ${i}`))}},webpack:n=>{n.options.devServer=S(n.options.devServer||{},{static:{directory:$(e.distFolder)}})}}}),ne=O(o=>{let{hostOptions:e,mapRemotesToDownload:t}=c(o);return{name:"native-federation-tests/host",async writeBundle(){e.deleteTestsFolder&&await F(e,Object.keys(t));let r=g(e),s=Object.entries(t).map(r);await Promise.allSettled(s),console.log(m.green("Federated mocks extraction completed"))}}});export{se as a,ne as b};