@module-federation/native-federation-typescript 0.2.6 → 0.3.1

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
@@ -11,9 +11,11 @@ npm i -D @module-federation/native-federation-typescript
11
11
  This module provides two plugins:
12
12
 
13
13
  ### NativeFederationTypeScriptRemote
14
+
14
15
  This plugin is used to build the federated types.
15
16
 
16
17
  #### Configuration
18
+
17
19
  ```typescript
18
20
  {
19
21
  moduleFederationConfig: any; // the configuration same configuration provided to the module federation plugin, it is MANDATORY
@@ -27,10 +29,12 @@ This plugin is used to build the federated types.
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
  ### NativeFederationTypeScriptHost
37
+
34
38
  This plugin is used to download the federated types.
35
39
 
36
40
  ### Configuration
@@ -40,6 +44,7 @@ This plugin is used to download the federated types.
40
44
  moduleFederationConfig: any; // the configuration same configuration provided to the module federation plugin, it is MANDATORY
41
45
  typesFolder?: string; // folder where all the files will be stored, default is '@mf-types',
42
46
  deleteTypesFolder?: boolean; // indicate if the types folder will be deleted before the job starts, default is 'true'
47
+ maxRetries?: number; // The number of times the plugin will try to download the types before failing, default is 3
43
48
  }
44
49
  ```
45
50
 
@@ -50,30 +55,35 @@ This plugin is used to download the federated types.
50
55
 
51
56
  ```ts
52
57
  // vite.config.ts
53
- import {NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote} from '@module-federation/native-federation-typescript/vite'
58
+ import { NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote } from '@module-federation/native-federation-typescript/vite';
54
59
 
55
60
  export default defineConfig({
56
61
  plugins: [
57
- NativeFederationTypeScriptRemote({ /* options */ }),
58
- NativeFederationTypeScriptHost({ /* options */ }),
62
+ NativeFederationTypeScriptRemote({
63
+ /* options */
64
+ }),
65
+ NativeFederationTypeScriptHost({
66
+ /* options */
67
+ }),
59
68
  ],
60
69
  /* ... */
61
- server: { // This is needed to emulate the devServer.static.directory of WebPack and correctly serve the zip file
70
+ server: {
71
+ // This is needed to emulate the devServer.static.directory of WebPack and correctly serve the zip file
62
72
  /* ... */
63
73
  proxy: {
64
74
  '/@mf-types.zip': {
65
- target: 'http://localhost:3000',
66
- changeOrigin: true,
67
- rewrite: () => `/@fs/${process.cwd()}/dist/@mf-types.zip`
68
- }
75
+ target: 'http://localhost:3000',
76
+ changeOrigin: true,
77
+ rewrite: () => `/@fs/${process.cwd()}/dist/@mf-types.zip`,
78
+ },
69
79
  },
70
80
  fs: {
71
81
  /* ... */
72
- allow: ['./dist']
82
+ allow: ['./dist'],
73
83
  /* ... */
74
- }
75
- }
76
- })
84
+ },
85
+ },
86
+ });
77
87
  ```
78
88
 
79
89
  <br>
@@ -83,14 +93,18 @@ export default defineConfig({
83
93
 
84
94
  ```ts
85
95
  // rollup.config.js
86
- import {NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote} from '@module-federation/native-federation-typescript/rollup'
96
+ import { NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote } from '@module-federation/native-federation-typescript/rollup';
87
97
 
88
98
  export default {
89
99
  plugins: [
90
- NativeFederationTypeScriptRemote({ /* options */ }),
91
- NativeFederationTypeScriptHost({ /* options */ }),
100
+ NativeFederationTypeScriptRemote({
101
+ /* options */
102
+ }),
103
+ NativeFederationTypeScriptHost({
104
+ /* options */
105
+ }),
92
106
  ],
93
- }
107
+ };
94
108
  ```
95
109
 
96
110
  <br>
@@ -100,14 +114,18 @@ export default {
100
114
 
101
115
  ```ts
102
116
  // webpack.config.js
103
- const {NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote} = require('@module-federation/native-federation-typescript/webpack')
117
+ const { NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote } = require('@module-federation/native-federation-typescript/webpack');
104
118
  module.exports = {
105
119
  /* ... */
106
120
  plugins: [
107
- NativeFederationTypeScriptRemote({ /* options */ }),
108
- NativeFederationTypeScriptHost({ /* options */ })
109
- ]
110
- }
121
+ NativeFederationTypeScriptRemote({
122
+ /* options */
123
+ }),
124
+ NativeFederationTypeScriptHost({
125
+ /* options */
126
+ }),
127
+ ],
128
+ };
111
129
  ```
112
130
 
113
131
  <br>
@@ -117,15 +135,19 @@ module.exports = {
117
135
 
118
136
  ```ts
119
137
  // esbuild.config.js
120
- import { build } from 'esbuild'
121
- import {NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote} from '@module-federation/native-federation-typescript/esbuild'
138
+ import { build } from 'esbuild';
139
+ import { NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote } from '@module-federation/native-federation-typescript/esbuild';
122
140
 
123
141
  build({
124
142
  plugins: [
125
- NativeFederationTypeScriptRemote({ /* options */ }),
126
- NativeFederationTypeScriptHost({ /* options */ })
143
+ NativeFederationTypeScriptRemote({
144
+ /* options */
145
+ }),
146
+ NativeFederationTypeScriptHost({
147
+ /* options */
148
+ }),
127
149
  ],
128
- })
150
+ });
129
151
  ```
130
152
 
131
153
  <br>
@@ -135,14 +157,18 @@ build({
135
157
 
136
158
  ```ts
137
159
  // rspack.config.js
138
- const {NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote} = require('@module-federation/native-federation-typescript/rspack')
160
+ const { NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote } = require('@module-federation/native-federation-typescript/rspack');
139
161
  module.exports = {
140
162
  /* ... */
141
163
  plugins: [
142
- NativeFederationTypeScriptRemote({ /* options */ }),
143
- NativeFederationTypeScriptHost({ /* options */ })
144
- ]
145
- }
164
+ NativeFederationTypeScriptRemote({
165
+ /* options */
166
+ }),
167
+ NativeFederationTypeScriptHost({
168
+ /* options */
169
+ }),
170
+ ],
171
+ };
146
172
  ```
147
173
 
148
174
  <br>
@@ -153,7 +179,7 @@ module.exports = {
153
179
  To have the type definitions automatically found for imports, add paths to the `compilerOptions` in the `tsconfig.json`:
154
180
 
155
181
  ```json
156
- {
182
+ {
157
183
  "paths": {
158
184
  "*": ["./@mf-types/*"]
159
185
  }
@@ -0,0 +1,320 @@
1
+ # [1.0.0-canary.1](https://github.com/module-federation/universe/compare/native-federation-typescript-0.2.6...native-federation-typescript-1.0.0-canary.1) (2023-11-06)
2
+
3
+ ## 0.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - bc053b8: fix: behaviour during vite dev mode
8
+
9
+ ## 0.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - bb0302b: feat: configurable maxRetries package unzip
14
+
15
+ ### Bug Fixes
16
+
17
+ - **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))
18
+ - **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))
19
+ - **deps:** update dependency axios to v1.5.1 ([ae9a06a](https://github.com/module-federation/universe/commit/ae9a06a0cc35fad27a0b493a25370b92617c39fb))
20
+ - **deps:** update dependency core-js to v3.32.2 ([18d2746](https://github.com/module-federation/universe/commit/18d2746763f38fe295a14df3f1bcd4218fade5b8))
21
+ - **deps:** update dependency core-js to v3.33.0 ([30894ca](https://github.com/module-federation/universe/commit/30894cafbe5dea4350dc7c633548038d7ec5f8a8))
22
+ - **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))
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 typedoc to ^0.25.0 ([#1277](https://github.com/module-federation/universe/issues/1277)) ([8d6a72e](https://github.com/module-federation/universe/commit/8d6a72e18a57b69b2f63802621e8b4b479554fed))
26
+ - **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))
27
+ - **deps:** update dependency typedoc to v0.25.2 ([46c6524](https://github.com/module-federation/universe/commit/46c65247e187cee9e15625402c1570ac351bb1fe))
28
+ - **deps:** update dependency undici to v5.24.0 ([573e644](https://github.com/module-federation/universe/commit/573e644333da6d24cb4286ce08221a1aa82415e4))
29
+ - **deps:** update dependency undici to v5.25.2 ([da3e539](https://github.com/module-federation/universe/commit/da3e539a41ed23ccb5086b1dd428fbee0f8d652c))
30
+ - **deps:** update dependency undici to v5.25.4 ([1d4f91e](https://github.com/module-federation/universe/commit/1d4f91ec93da4326c8a42eef28f150d5d09738bb))
31
+ - **deps:** update dependency undici to v5.26.2 [security] ([410a8b8](https://github.com/module-federation/universe/commit/410a8b8bd1558dfb5119ae10941d2b3816a0d0e0))
32
+ - **deps:** update dependency unplugin to v1.5.0 ([936b3f8](https://github.com/module-federation/universe/commit/936b3f8d8061fd9d481d1788fb35b88588928d14))
33
+ - 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)
34
+ - override semantic-release-plugin-decorators ([18675de](https://github.com/module-federation/universe/commit/18675defef65570d2b3bb6a9caa3fd039badee29))
35
+ - switch to @goestav/nx-semantic-release ([63a3350](https://github.com/module-federation/universe/commit/63a3350a6a1a12235e3c9f1e7c724d54f0476356))
36
+
37
+ ### Features
38
+
39
+ - 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)
40
+ - Dynamic Filesystem ([#1274](https://github.com/module-federation/universe/issues/1274)) ([2bec98a](https://github.com/module-federation/universe/commit/2bec98a2472b44898a7f14ec6868a2368cfb6d82))
41
+ - fork module federation ([0ad7430](https://github.com/module-federation/universe/commit/0ad7430f6170458a47144be392133b7b2fa1ade0))
42
+ - improved async init ([ae3a450](https://github.com/module-federation/universe/commit/ae3a4503ff9de86492b13029d6334b281ddd9493))
43
+ - native self forming node federation ([#1291](https://github.com/module-federation/universe/issues/1291)) ([1dd5ed1](https://github.com/module-federation/universe/commit/1dd5ed17c981e036336925e807203e94b58c36d6))
44
+ - new actions, remove gpt integration ([370229e](https://github.com/module-federation/universe/commit/370229e02cc352fcfaeaa0f3cf1f9f2d4966d1bb))
45
+ - **node:** node federation demo/testing apps added ([27d545d](https://github.com/module-federation/universe/commit/27d545d99095da7134c392dbcd9fb135a170f6ef))
46
+ - **typedoc-parsetr:** merged main ([cf6e65a](https://github.com/module-federation/universe/commit/cf6e65a4aa895d7c2dba8fdbd8ec22ec7bd8f514))
47
+ - **typedoc-parsetr:** merged main ([2ff0d5a](https://github.com/module-federation/universe/commit/2ff0d5a075df3f241742cc7e516cd0378e8e1b3e))
48
+ - **typedoc-parsetr:** python script implementation ([0a533cb](https://github.com/module-federation/universe/commit/0a533cb60e0c3ca269ab45df740c1367be175e80))
49
+
50
+ ### BREAKING CHANGES
51
+
52
+ - automaticAsyncBoundary option has been removed
53
+
54
+ - fix: exclude specific pages from page map automatically
55
+
56
+ - refactor: conslidate codebase
57
+
58
+ - fix: improve hot reload share recovery
59
+
60
+ - refactor: remove server jsonp template
61
+
62
+ - chore: remove dead code from runtime modules
63
+
64
+ - fix: clean up jsonp getCustomJsonpCode
65
+
66
+ getting chunk loading global from compiler output options
67
+
68
+ - feat: adding cleanInitArrays runtime helper
69
+
70
+ - chore: remove share scope hoist and module hoisting system
71
+
72
+ - chore: cleanup code
73
+
74
+ - chore: remove dead code from add module runtime plugin
75
+
76
+ likely can remove whole plugin in future
77
+
78
+ - chore: remove logs from delegate modules
79
+
80
+ - chore: remove old utils
81
+
82
+ - fix: add warning on auto page stitch
83
+
84
+ - fix: remove commented out code from InvertedContainerPlugin.ts
85
+
86
+ - chore: improve logging to see if its local load or remote load
87
+
88
+ - chore: clean up old custom promises factories
89
+
90
+ - fix: remove container proxy code
91
+
92
+ - fix: remove container proxy code
93
+ - automaticAsyncBoundary option has been removed
94
+
95
+ - fix: exclude specific pages from page map automatically
96
+
97
+ - refactor: conslidate codebase
98
+
99
+ - fix: improve hot reload share recovery
100
+
101
+ - refactor: remove server jsonp template
102
+
103
+ - chore: remove dead code from runtime modules
104
+
105
+ - fix: clean up jsonp getCustomJsonpCode
106
+
107
+ getting chunk loading global from compiler output options
108
+
109
+ - feat: adding cleanInitArrays runtime helper
110
+
111
+ - chore: remove share scope hoist and module hoisting system
112
+
113
+ - chore: cleanup code
114
+
115
+ - chore: remove dead code from add module runtime plugin
116
+
117
+ likely can remove whole plugin in future
118
+
119
+ - chore: remove logs from delegate modules
120
+
121
+ - chore: remove old utils
122
+
123
+ - fix: add warning on auto page stitch
124
+
125
+ - fix: remove commented out code from InvertedContainerPlugin.ts
126
+
127
+ - chore: improve logging to see if its local load or remote load
128
+
129
+ - chore: clean up old custom promises factories
130
+
131
+ - fix: remove container proxy code
132
+
133
+ - fix: remove container proxy code
134
+
135
+ - chore: fix project.json
136
+
137
+ - debugging
138
+
139
+ - fix: resolve backmerge issues with build
140
+
141
+ - Merge branch 'kill_child_compilers' into fix_backmerge_issues
142
+
143
+ # Conflicts:
144
+
145
+ # package-lock.json
146
+
147
+ # package.json
148
+
149
+ # packages/nextjs-mf/src/plugins/NextFederationPlugin/index.ts
150
+
151
+ # packages/nextjs-mf/src/plugins/container/InvertedContainerPlugin.ts
152
+
153
+ # packages/nextjs-mf/src/plugins/container/InvertedContainerRuntimeModule.ts
154
+
155
+ - feat: enable eager sharing
156
+
157
+ - refactor: improve module hooks for eager loading and search
158
+
159
+ - refactor: cleanup custom jsonp and make es5
160
+
161
+ - refactor: cleanup inverted container code
162
+
163
+ - refactor: cleanup inverted container code
164
+ - automaticAsyncBoundary option has been removed
165
+
166
+ - fix: exclude specific pages from page map automatically
167
+
168
+ - refactor: conslidate codebase
169
+
170
+ - fix: improve hot reload share recovery
171
+
172
+ - refactor: remove server jsonp template
173
+
174
+ - chore: remove dead code from runtime modules
175
+
176
+ - fix: clean up jsonp getCustomJsonpCode
177
+
178
+ getting chunk loading global from compiler output options
179
+
180
+ - feat: adding cleanInitArrays runtime helper
181
+
182
+ - chore: remove share scope hoist and module hoisting system
183
+
184
+ - chore: cleanup code
185
+
186
+ - chore: remove dead code from add module runtime plugin
187
+
188
+ likely can remove whole plugin in future
189
+
190
+ - chore: remove logs from delegate modules
191
+
192
+ - chore: remove old utils
193
+
194
+ - fix: add warning on auto page stitch
195
+
196
+ - fix: remove commented out code from InvertedContainerPlugin.ts
197
+
198
+ - chore: improve logging to see if its local load or remote load
199
+
200
+ - chore: clean up old custom promises factories
201
+
202
+ - fix: remove container proxy code
203
+
204
+ - fix: remove container proxy code
205
+
206
+ - fix: resolve backmerge issues with build
207
+
208
+ - Merge branch 'kill_child_compilers' into fix_backmerge_issues
209
+
210
+ # Conflicts:
211
+
212
+ # package-lock.json
213
+
214
+ # package.json
215
+
216
+ # packages/nextjs-mf/src/plugins/NextFederationPlugin/index.ts
217
+
218
+ # packages/nextjs-mf/src/plugins/container/InvertedContainerPlugin.ts
219
+
220
+ # packages/nextjs-mf/src/plugins/container/InvertedContainerRuntimeModule.ts
221
+
222
+ - feat: enable eager sharing
223
+
224
+ - refactor: improve module hooks for eager loading and search
225
+
226
+ - refactor: cleanup custom jsonp and make es5
227
+
228
+ - refactor: cleanup inverted container code
229
+
230
+ - refactor: cleanup inverted container code
231
+
232
+ - ci: fix install step with npm and NX
233
+
234
+ - test: remove tests for now
235
+
236
+ - chore(utils): release version 1.7.3-beta.0
237
+
238
+ - chore(utils): release version 1.7.3
239
+
240
+ - chore(node): release version 0.14.4-beta.0
241
+
242
+ - chore(node): release version 0.14.4
243
+
244
+ - chore(nextjs-mf): release version 6.4.1-beta.4
245
+
246
+ - fix: remove debugging runtime variable
247
+
248
+ - chore(nextjs-mf): release version 6.4.1-beta.5
249
+
250
+ # Changelog
251
+
252
+ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
253
+
254
+ ## [0.2.6](https://github.com/module-federation/nextjs-mf/compare/native-federation-typescript-0.2.5...native-federation-typescript-0.2.6) (2023-07-01)
255
+
256
+ ## [0.2.5](https://github.com/module-federation/nextjs-mf/compare/native-federation-typescript-0.2.4...native-federation-typescript-0.2.5) (2023-07-01)
257
+
258
+ ## [0.2.4](https://github.com/module-federation/nextjs-mf/compare/native-federation-typescript-0.2.3...native-federation-typescript-0.2.4) (2023-07-01)
259
+
260
+ ## [0.2.3](https://github.com/module-federation/nextjs-mf/compare/native-federation-typescript-0.2.2...native-federation-typescript-0.2.3) (2023-07-01)
261
+
262
+ ## [0.2.2](https://github.com/module-federation/nextjs-mf/compare/native-federation-typescript-0.2.1...native-federation-typescript-0.2.2) (2023-06-28)
263
+
264
+ ### Bug Fixes
265
+
266
+ - .at(-1) ([8dd0520](https://github.com/module-federation/nextjs-mf/commit/8dd0520b5464c49e89c63307c5388450e4bebbf8))
267
+
268
+ ## [0.2.1](https://github.com/module-federation/nextjs-mf/compare/native-federation-typescript-0.2.0...native-federation-typescript-0.2.1) (2023-05-13)
269
+
270
+ ### Bug Fixes
271
+
272
+ - [#857](https://github.com/module-federation/nextjs-mf/issues/857) ([#859](https://github.com/module-federation/nextjs-mf/issues/859)) ([2fb609e](https://github.com/module-federation/nextjs-mf/commit/2fb609efb9a3c8f3e6740e0159510d649c1d229d))
273
+ - downgrade next to v13.3.1 ([0032452](https://github.com/module-federation/nextjs-mf/commit/0032452980c70b211b6c04332326b7973f7c8446))
274
+ - removed lock ([82f578e](https://github.com/module-federation/nextjs-mf/commit/82f578e713734f7f6b06e09b794fab4f66af248a))
275
+
276
+ # [0.2.0](https://github.com/module-federation/nextjs-mf/compare/native-federation-typescript-0.1.1...native-federation-typescript-0.2.0) (2023-04-29)
277
+
278
+ ### Bug Fixes
279
+
280
+ - removed any from error logger type ([fb9fcc3](https://github.com/module-federation/nextjs-mf/commit/fb9fcc3a54a13be36335830f076a86557b75bb4a))
281
+ - subpath ([1548501](https://github.com/module-federation/nextjs-mf/commit/1548501bb4679c0c534c02609cb6bc5459f224a4))
282
+ - subpath ([aaad665](https://github.com/module-federation/nextjs-mf/commit/aaad665307d80b49ee19496a5b8b400df243558e))
283
+
284
+ ### Features
285
+
286
+ - 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))
287
+
288
+ ## [0.1.1](https://github.com/module-federation/nextjs-mf/compare/native-federation-typescript-0.1.0...native-federation-typescript-0.1.1) (2023-04-12)
289
+
290
+ ### Bug Fixes
291
+
292
+ - native build chunks ([d6c9f8a](https://github.com/module-federation/nextjs-mf/commit/d6c9f8a957ed00a8d92332ccc38ed9780f01d54e))
293
+
294
+ ### Reverts
295
+
296
+ - Revert "chore(native-federation-typescript): release version 0.1.1" ([91786df](https://github.com/module-federation/nextjs-mf/commit/91786df726e5c078ed78e745b6b105e11bd2e39b))
297
+ - Revert "chore(native-federation-typescript): release version 0.1.1" ([097f188](https://github.com/module-federation/nextjs-mf/commit/097f188458835457a2713d98bf3eaf291d5ad102))
298
+
299
+ # 0.1.0 (2023-04-05)
300
+
301
+ ### Bug Fixes
302
+
303
+ - build ([d0b2f72](https://github.com/module-federation/nextjs-mf/commit/d0b2f72f4fc3647825412be1574311c3152cf167))
304
+ - build step ([a217170](https://github.com/module-federation/nextjs-mf/commit/a21717096cbc09bff20d3aeebfea2f3533afb0d7))
305
+ - compiler instance ([e5c249d](https://github.com/module-federation/nextjs-mf/commit/e5c249d41d68339886268337654ff47b31b06a3a))
306
+ - deps ([a378441](https://github.com/module-federation/nextjs-mf/commit/a37844194a3f189cc5863bbdd4776259bce69fa4))
307
+ - dirtree tests ([5cb49fd](https://github.com/module-federation/nextjs-mf/commit/5cb49fd1c6520311a7d2e7d2b37a93389a500715))
308
+ - eslintrc ([0f69dee](https://github.com/module-federation/nextjs-mf/commit/0f69dee253c2c608b2367d545c7d4a57ad0c2ca5))
309
+ - format ([25fb765](https://github.com/module-federation/nextjs-mf/commit/25fb7659481287a791e9de4fe839e980dbf06968))
310
+ - readme ([eaca0b3](https://github.com/module-federation/nextjs-mf/commit/eaca0b311d3b8d9e73309cb92d9a9488f9fc23c0))
311
+ - readme ([fc0e5dc](https://github.com/module-federation/nextjs-mf/commit/fc0e5dc26e617664224e1c10548b151a44f8dff9))
312
+ - README.md ([9159171](https://github.com/module-federation/nextjs-mf/commit/91591712e9a103fff351f0a168c149470c0d69ad))
313
+ - remove changelog ([724918e](https://github.com/module-federation/nextjs-mf/commit/724918ebf888297689b6ed700bd14ec01fd1ef35))
314
+ - ts build ([9ed3a52](https://github.com/module-federation/nextjs-mf/commit/9ed3a527d0ba903b6cfa6023a7ad5da63781970c))
315
+
316
+ ### Features
317
+
318
+ - federated tests plugin ([063ab33](https://github.com/module-federation/nextjs-mf/commit/063ab336c4830aff4f5bd3b9894df60b4651a9be))
319
+ - native-federation-typescript plugin ([#692](https://github.com/module-federation/nextjs-mf/issues/692)) ([b41c5aa](https://github.com/module-federation/nextjs-mf/commit/b41c5aacfeda0fada5b426086658235edfd86cdd))
320
+ - test command ([3ade629](https://github.com/module-federation/nextjs-mf/commit/3ade629488f4ea1549314b82b41caef9a046da9f))
package/dist/README.md ADDED
@@ -0,0 +1,192 @@
1
+ # native-federation-typescript
2
+
3
+ Bundler agnostic plugins to share federated types.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm i -D @module-federation/native-federation-typescript
9
+ ```
10
+
11
+ This module provides two plugins:
12
+
13
+ ### NativeFederationTypeScriptRemote
14
+
15
+ This plugin is used to build the federated types.
16
+
17
+ #### Configuration
18
+
19
+ ```typescript
20
+ {
21
+ moduleFederationConfig: any; // the configuration same configuration provided to the module federation plugin, it is MANDATORY
22
+ tsConfigPath?: string; // path where the tsconfig file is located, default is ''./tsconfig.json'
23
+ typesFolder?: string; // folder where all the files will be stored, default is '@mf-types',
24
+ compiledTypesFolder?: string; // folder where the federated modules types will be stored, default is 'compiled-types'
25
+ deleteTypesFolder?: boolean; // indicate if the types folder will be deleted when the job completes, default is 'true'
26
+ additionalFilesToCompile?: string[] // The path of each additional file which should be emitted
27
+ compilerInstance?: 'tsc' | 'vue-tsc' // The compiler to use to emit files, default is 'tsc'
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
+ ### NativeFederationTypeScriptHost
37
+
38
+ This plugin is used to download the federated types.
39
+
40
+ ### Configuration
41
+
42
+ ```typescript
43
+ {
44
+ moduleFederationConfig: any; // the configuration same configuration provided to the module federation plugin, it is MANDATORY
45
+ typesFolder?: string; // folder where all the files will be stored, default is '@mf-types',
46
+ deleteTypesFolder?: boolean; // indicate if the types folder will be deleted before the job starts, default is 'true'
47
+ maxRetries?: number; // The number of times the plugin will try to download the types before failing, default is 3
48
+ }
49
+ ```
50
+
51
+ ## Bundler configuration
52
+
53
+ <details>
54
+ <summary>Vite</summary><br>
55
+
56
+ ```ts
57
+ // vite.config.ts
58
+ import { NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote } from '@module-federation/native-federation-typescript/vite';
59
+
60
+ export default defineConfig({
61
+ plugins: [
62
+ NativeFederationTypeScriptRemote({
63
+ /* options */
64
+ }),
65
+ NativeFederationTypeScriptHost({
66
+ /* options */
67
+ }),
68
+ ],
69
+ /* ... */
70
+ server: {
71
+ // This is needed to emulate the devServer.static.directory of WebPack and correctly serve the zip file
72
+ /* ... */
73
+ proxy: {
74
+ '/@mf-types.zip': {
75
+ target: 'http://localhost:3000',
76
+ changeOrigin: true,
77
+ rewrite: () => `/@fs/${process.cwd()}/dist/@mf-types.zip`,
78
+ },
79
+ },
80
+ fs: {
81
+ /* ... */
82
+ allow: ['./dist'],
83
+ /* ... */
84
+ },
85
+ },
86
+ });
87
+ ```
88
+
89
+ <br>
90
+ </details>
91
+ <details>
92
+ <summary>Rollup</summary><br>
93
+
94
+ ```ts
95
+ // rollup.config.js
96
+ import { NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote } from '@module-federation/native-federation-typescript/rollup';
97
+
98
+ export default {
99
+ plugins: [
100
+ NativeFederationTypeScriptRemote({
101
+ /* options */
102
+ }),
103
+ NativeFederationTypeScriptHost({
104
+ /* options */
105
+ }),
106
+ ],
107
+ };
108
+ ```
109
+
110
+ <br>
111
+ </details>
112
+ <details>
113
+ <summary>Webpack</summary><br>
114
+
115
+ ```ts
116
+ // webpack.config.js
117
+ const { NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote } = require('@module-federation/native-federation-typescript/webpack');
118
+ module.exports = {
119
+ /* ... */
120
+ plugins: [
121
+ NativeFederationTypeScriptRemote({
122
+ /* options */
123
+ }),
124
+ NativeFederationTypeScriptHost({
125
+ /* options */
126
+ }),
127
+ ],
128
+ };
129
+ ```
130
+
131
+ <br>
132
+ </details>
133
+ <details>
134
+ <summary>esbuild</summary><br>
135
+
136
+ ```ts
137
+ // esbuild.config.js
138
+ import { build } from 'esbuild';
139
+ import { NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote } from '@module-federation/native-federation-typescript/esbuild';
140
+
141
+ build({
142
+ plugins: [
143
+ NativeFederationTypeScriptRemote({
144
+ /* options */
145
+ }),
146
+ NativeFederationTypeScriptHost({
147
+ /* options */
148
+ }),
149
+ ],
150
+ });
151
+ ```
152
+
153
+ <br>
154
+ </details>
155
+ <details>
156
+ <summary>Rspack</summary><br>
157
+
158
+ ```ts
159
+ // rspack.config.js
160
+ const { NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote } = require('@module-federation/native-federation-typescript/rspack');
161
+ module.exports = {
162
+ /* ... */
163
+ plugins: [
164
+ NativeFederationTypeScriptRemote({
165
+ /* options */
166
+ }),
167
+ NativeFederationTypeScriptHost({
168
+ /* options */
169
+ }),
170
+ ],
171
+ };
172
+ ```
173
+
174
+ <br>
175
+ </details>
176
+
177
+ ## TypeScript configuration
178
+
179
+ To have the type definitions automatically found for imports, add paths to the `compilerOptions` in the `tsconfig.json`:
180
+
181
+ ```json
182
+ {
183
+ "paths": {
184
+ "*": ["./@mf-types/*"]
185
+ }
186
+ }
187
+ ```
188
+
189
+ ## Examples
190
+
191
+ 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).
192
+ 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).
@@ -2,6 +2,7 @@ interface HostOptions {
2
2
  moduleFederationConfig: any;
3
3
  typesFolder?: string;
4
4
  deleteTypesFolder?: boolean;
5
+ maxRetries?: number;
5
6
  }
6
7
 
7
8
  interface RemoteOptions {
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var L=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var _ansicolors = require('ansi-colors'); var _ansicolors2 = _interopRequireDefault(_ansicolors);var _promises = require('fs/promises');var _path = require('path');var _rambda = require('rambda');var _unplugin = require('unplugin');var _={typesFolder:"@mf-types",deleteTypesFolder:!0,maxRetries:3},z=t=>{let e=t.split("@");return e[e.length-1]},B=(t,e)=>{let r=z(e),o=new URL(r),s=o.pathname.split("/").slice(0,-1).join("/");return o.pathname=`${s}/${t.typesFolder}.zip`,o.href},k=t=>Object.entries(t.moduleFederationConfig.remotes).reduce((e,[r,o])=>(e[r]=B(t,o),e),{}),R=t=>{if(!t.moduleFederationConfig)throw new Error("moduleFederationConfig is required");let e={..._,...t},r=k(e);return{hostOptions:e,mapRemotesToDownload:r}};var _fs = require('fs');var _typescript = require('typescript'); var _typescript2 = _interopRequireDefault(_typescript);var V={tsConfigPath:"./tsconfig.json",typesFolder:"@mf-types",compiledTypesFolder:"compiled-types",deleteTypesFolder:!0,additionalFilesToCompile:[],compilerInstance:"tsc"},X=({tsConfigPath:t,typesFolder:e,compiledTypesFolder:r})=>{let o=_path.resolve.call(void 0, t),s=_typescript2.default.readConfigFile(o,_typescript2.default.sys.readFile),i=_typescript2.default.parseJsonConfigFileContent(s.config,_typescript2.default.sys,_path.dirname.call(void 0, o)),n=_path.join.call(void 0, i.options.outDir||"dist",e,r);return{...i.options,emitDeclarationOnly:!0,noEmit:!1,declaration:!0,outDir:n}},J=["ts","tsx","vue","svelte"],T=t=>{let e=process.cwd();for(let r of J){let o=_path.join.call(void 0, e,`${t}.${r}`);if(_fs.existsSync.call(void 0, o))return o}},G=t=>Object.entries(t.moduleFederationConfig.exposes).reduce((e,[r,o])=>(e[r]=T(o)||T(_path.join.call(void 0, o,"index"))||o,e),{}),h=t=>{if(!t.moduleFederationConfig)throw new Error("moduleFederationConfig is required");let e={...V,...t},r=G(e);return{tsConfig:X(e),mapComponentsToExpose:r,remoteOptions:e}};var _admzip = require('adm-zip'); var _admzip2 = _interopRequireDefault(_admzip);var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);var ee=/^\//,C=".d.ts",te=t=>{let{line:e}=t.file.getLineAndCharacterOfPosition(t.start);console.error(_ansicolors2.default.red(`TS Error ${t.code}':' ${_typescript2.default.flattenDiagnosticMessageText(t.messageText,_typescript2.default.sys.newLine)}`)),console.error(_ansicolors2.default.red(` at ${t.file.fileName}:${e+1} typescript.sys.newLine`))},c=(t,e)=>_path.normalize.call(void 0, t.outDir.replace(e.compiledTypesFolder,"")),f=(t,e)=>_path.normalize.call(void 0, t.outDir.replace(e.compiledTypesFolder,"").replace(e.typesFolder,"")),re=(t,e,r)=>{let o=_typescript2.default.createCompilerHost(e),s=o.writeFile,i=Object.fromEntries(Object.entries(t).map(p=>p.reverse())),n=c(e,r);return o.writeFile=(p,N,u,U,y,j)=>{s(p,N,u,U,y,j);for(let A of y||[]){let g=i[A.fileName];if(g){let O=_path.join.call(void 0, n,`${g}${C}`),I=_path.dirname.call(void 0, O),v=_path.relative.call(void 0, I,p).replace(C,"").replace(ee,"");s(O,`export * from './${v}';
2
+ export { default } from './${v}';`,u)}}},o},oe=t=>L("vue-tsc").createProgram(t),se=(t,e)=>{switch(t.compilerInstance){case"vue-tsc":return oe(e);case"tsc":default:return _typescript2.default.createProgram(e)}},E=(t,e,r)=>{let o=re(t,e,r),i={rootNames:[...Object.values(t),...r.additionalFilesToCompile],host:o,options:e},n=se(r,i),{diagnostics:p=[]}=n.emit();p.forEach(te)};var pe=(t,e)=>_path.join.call(void 0, t.replace(e.typesFolder,""),`${e.typesFolder}.zip`),S=async(t,e)=>{let r=c(t,e),o=new _admzip2.default;return o.addLocalFolder(r),o.writeZipPromise(pe(r,e))},ce=(t,e)=>r=>{throw{...r,message:`Network error: Unable to download federated mocks for '${t}' from '${e}' because '${r.message}'`}},$=t=>{let e=0;return async([r,o])=>{let s=_path.join.call(void 0, t.typesFolder,r);for(;e++<t.maxRetries;)try{let i=await _axios2.default.get(o,{responseType:"arraybuffer"}).catch(ce(r,o));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 Ue=_unplugin.createUnplugin.call(void 0, t=>{let{remoteOptions:e,tsConfig:r,mapComponentsToExpose:o}=h(t);return{name:"native-federation-typescript/remote",async writeBundle(){try{E(o,r,e),await S(r,e),e.deleteTypesFolder&&await _promises.rm.call(void 0, c(r,e),{recursive:!0,force:!0}),console.log(_ansicolors2.default.green("Federated types created correctly"))}catch(s){console.error(_ansicolors2.default.red(`Unable to compile federated types, ${s}`))}},get vite(){return process.env.NODE_ENV==="production"?void 0:{buildStart:this.writeBundle,watchChange:this.writeBundle}},webpack:s=>{s.options.devServer=_rambda.mergeDeepRight.call(void 0, s.options.devServer||{},{static:{directory:_path.resolve.call(void 0, f(r,e))}})},rspack:s=>{s.options.devServer=_rambda.mergeDeepRight.call(void 0, s.options.devServer||{},{static:{directory:_path.resolve.call(void 0, f(r,e))}})}}}),je= exports.b =_unplugin.createUnplugin.call(void 0, t=>{let{hostOptions:e,mapRemotesToDownload:r}=R(t);return{name:"native-federation-typescript/host",async writeBundle(){e.deleteTypesFolder&&await _promises.rm.call(void 0, e.typesFolder,{recursive:!0,force:!0}).catch(i=>console.error(_ansicolors2.default.red(`Unable to remove types folder, ${i}`)));let o=$(e),s=Object.entries(r).map(o);await Promise.allSettled(s),console.log(_ansicolors2.default.green("Federated types extraction completed"))},get vite(){return process.env.NODE_ENV==="production"?void 0:{buildStart:this.writeBundle,watchChange:this.writeBundle}}}});exports.a = Ue; exports.b = je;
@@ -0,0 +1,2 @@
1
+ var L=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});import l from"ansi-colors";import{rm as b}from"fs/promises";import{resolve as H}from"path";import{mergeDeepRight as D}from"rambda";import{createUnplugin as q}from"unplugin";var _={typesFolder:"@mf-types",deleteTypesFolder:!0,maxRetries:3},z=t=>{let e=t.split("@");return e[e.length-1]},B=(t,e)=>{let r=z(e),o=new URL(r),s=o.pathname.split("/").slice(0,-1).join("/");return o.pathname=`${s}/${t.typesFolder}.zip`,o.href},k=t=>Object.entries(t.moduleFederationConfig.remotes).reduce((e,[r,o])=>(e[r]=B(t,o),e),{}),R=t=>{if(!t.moduleFederationConfig)throw new Error("moduleFederationConfig is required");let e={..._,...t},r=k(e);return{hostOptions:e,mapRemotesToDownload:r}};import{existsSync as W}from"fs";import{dirname as Z,join as d,resolve as M}from"path";import a from"typescript";var V={tsConfigPath:"./tsconfig.json",typesFolder:"@mf-types",compiledTypesFolder:"compiled-types",deleteTypesFolder:!0,additionalFilesToCompile:[],compilerInstance:"tsc"},X=({tsConfigPath:t,typesFolder:e,compiledTypesFolder:r})=>{let o=M(t),s=a.readConfigFile(o,a.sys.readFile),i=a.parseJsonConfigFileContent(s.config,a.sys,Z(o)),n=d(i.options.outDir||"dist",e,r);return{...i.options,emitDeclarationOnly:!0,noEmit:!1,declaration:!0,outDir:n}},J=["ts","tsx","vue","svelte"],T=t=>{let e=process.cwd();for(let r of J){let o=d(e,`${t}.${r}`);if(W(o))return o}},G=t=>Object.entries(t.moduleFederationConfig.exposes).reduce((e,[r,o])=>(e[r]=T(o)||T(d(o,"index"))||o,e),{}),h=t=>{if(!t.moduleFederationConfig)throw new Error("moduleFederationConfig is required");let e={...V,...t},r=G(e);return{tsConfig:X(e),mapComponentsToExpose:r,remoteOptions:e}};import x from"adm-zip";import ie from"ansi-colors";import ne from"axios";import{join as P}from"path";import w from"ansi-colors";import{dirname as K,join as Q,normalize as F,relative as Y}from"path";import m from"typescript";var ee=/^\//,C=".d.ts",te=t=>{let{line:e}=t.file.getLineAndCharacterOfPosition(t.start);console.error(w.red(`TS Error ${t.code}':' ${m.flattenDiagnosticMessageText(t.messageText,m.sys.newLine)}`)),console.error(w.red(` at ${t.file.fileName}:${e+1} typescript.sys.newLine`))},c=(t,e)=>F(t.outDir.replace(e.compiledTypesFolder,"")),f=(t,e)=>F(t.outDir.replace(e.compiledTypesFolder,"").replace(e.typesFolder,"")),re=(t,e,r)=>{let o=m.createCompilerHost(e),s=o.writeFile,i=Object.fromEntries(Object.entries(t).map(p=>p.reverse())),n=c(e,r);return o.writeFile=(p,N,u,U,y,j)=>{s(p,N,u,U,y,j);for(let A of y||[]){let g=i[A.fileName];if(g){let O=Q(n,`${g}${C}`),I=K(O),v=Y(I,p).replace(C,"").replace(ee,"");s(O,`export * from './${v}';
2
+ export { default } from './${v}';`,u)}}},o},oe=t=>L("vue-tsc").createProgram(t),se=(t,e)=>{switch(t.compilerInstance){case"vue-tsc":return oe(e);case"tsc":default:return m.createProgram(e)}},E=(t,e,r)=>{let o=re(t,e,r),i={rootNames:[...Object.values(t),...r.additionalFilesToCompile],host:o,options:e},n=se(r,i),{diagnostics:p=[]}=n.emit();p.forEach(te)};var pe=(t,e)=>P(t.replace(e.typesFolder,""),`${e.typesFolder}.zip`),S=async(t,e)=>{let r=c(t,e),o=new x;return o.addLocalFolder(r),o.writeZipPromise(pe(r,e))},ce=(t,e)=>r=>{throw{...r,message:`Network error: Unable to download federated mocks for '${t}' from '${e}' because '${r.message}'`}},$=t=>{let e=0;return async([r,o])=>{let s=P(t.typesFolder,r);for(;e++<t.maxRetries;)try{let i=await ne.get(o,{responseType:"arraybuffer"}).catch(ce(r,o));new x(Buffer.from(i.data)).extractAllTo(s,!0);break}catch(i){if(console.error(ie.red(`Error during types archive download: ${(i==null?void 0:i.message)||"unknown error"}`)),e>=t.maxRetries)throw i}}};var Ue=q(t=>{let{remoteOptions:e,tsConfig:r,mapComponentsToExpose:o}=h(t);return{name:"native-federation-typescript/remote",async writeBundle(){try{E(o,r,e),await S(r,e),e.deleteTypesFolder&&await b(c(r,e),{recursive:!0,force:!0}),console.log(l.green("Federated types created correctly"))}catch(s){console.error(l.red(`Unable to compile federated types, ${s}`))}},get vite(){return process.env.NODE_ENV==="production"?void 0:{buildStart:this.writeBundle,watchChange:this.writeBundle}},webpack:s=>{s.options.devServer=D(s.options.devServer||{},{static:{directory:H(f(r,e))}})},rspack:s=>{s.options.devServer=D(s.options.devServer||{},{static:{directory:H(f(r,e))}})}}}),je=q(t=>{let{hostOptions:e,mapRemotesToDownload:r}=R(t);return{name:"native-federation-typescript/host",async writeBundle(){e.deleteTypesFolder&&await b(e.typesFolder,{recursive:!0,force:!0}).catch(i=>console.error(l.red(`Unable to remove types folder, ${i}`)));let o=$(e),s=Object.entries(r).map(o);await Promise.allSettled(s),console.log(l.green("Federated types extraction completed"))},get vite(){return process.env.NODE_ENV==="production"?void 0:{buildStart:this.writeBundle,watchChange:this.writeBundle}}}});export{Ue as a,je as b};
@@ -1,4 +1,4 @@
1
- import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-ce85caac.js';
1
+ import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-8173ef89.js';
2
2
 
3
3
  declare const NativeFederationTypeScriptRemote: (options: RemoteOptions) => undefined;
4
4
  declare const NativeFederationTypeScriptHost: (options: HostOptions) => undefined;
package/dist/esbuild.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-ce85caac.js';
1
+ import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-8173ef89.js';
2
2
 
3
3
  declare const NativeFederationTypeScriptRemote: (options: RemoteOptions) => undefined;
4
4
  declare const NativeFederationTypeScriptHost: (options: HostOptions) => undefined;
package/dist/esbuild.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5DG6MWZHjs = require('./chunk-5DG6MWZH.js');var i=_chunk5DG6MWZHjs.a.esbuild,r= exports.NativeFederationTypeScriptHost =_chunk5DG6MWZHjs.b.esbuild;exports.NativeFederationTypeScriptHost = r; exports.NativeFederationTypeScriptRemote = i;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIDWEZ3WPjs = require('./chunk-IDWEZ3WP.js');var i=_chunkIDWEZ3WPjs.a.esbuild,r= exports.NativeFederationTypeScriptHost =_chunkIDWEZ3WPjs.b.esbuild;exports.NativeFederationTypeScriptHost = r; exports.NativeFederationTypeScriptRemote = i;
package/dist/esbuild.mjs CHANGED
@@ -1 +1 @@
1
- import{a as e,b as t}from"./chunk-2JPDJNBW.mjs";var i=e.esbuild,r=t.esbuild;export{r as NativeFederationTypeScriptHost,i as NativeFederationTypeScriptRemote};
1
+ import{a as e,b as t}from"./chunk-MSWS7NCK.mjs";var i=e.esbuild,r=t.esbuild;export{r as NativeFederationTypeScriptHost,i as NativeFederationTypeScriptRemote};
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as unplugin from 'unplugin';
2
- import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-ce85caac.js';
2
+ import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-8173ef89.js';
3
3
 
4
4
  declare const NativeFederationTypeScriptRemote: unplugin.UnpluginInstance<RemoteOptions, boolean>;
5
5
  declare const NativeFederationTypeScriptHost: unplugin.UnpluginInstance<HostOptions, boolean>;
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-ce85caac.js';
2
+ import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-8173ef89.js';
3
3
 
4
4
  declare const NativeFederationTypeScriptRemote: unplugin.UnpluginInstance<RemoteOptions, boolean>;
5
5
  declare const NativeFederationTypeScriptHost: unplugin.UnpluginInstance<HostOptions, boolean>;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5DG6MWZHjs = require('./chunk-5DG6MWZH.js');exports.NativeFederationTypeScriptHost = _chunk5DG6MWZHjs.b; exports.NativeFederationTypeScriptRemote = _chunk5DG6MWZHjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIDWEZ3WPjs = require('./chunk-IDWEZ3WP.js');exports.NativeFederationTypeScriptHost = _chunkIDWEZ3WPjs.b; exports.NativeFederationTypeScriptRemote = _chunkIDWEZ3WPjs.a;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{a,b}from"./chunk-2JPDJNBW.mjs";export{b as NativeFederationTypeScriptHost,a as NativeFederationTypeScriptRemote};
1
+ import{a,b}from"./chunk-MSWS7NCK.mjs";export{b as NativeFederationTypeScriptHost,a as NativeFederationTypeScriptRemote};
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@module-federation/native-federation-typescript",
3
+ "version": "0.3.1",
4
+ "description": "Bundler agnostic unplugin to share federated types",
5
+ "keywords": [
6
+ "module federation",
7
+ "typescript",
8
+ "remote types",
9
+ "federated types"
10
+ ],
11
+ "files": [
12
+ "dist/",
13
+ "README.md"
14
+ ],
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "exports": {
19
+ ".": {
20
+ "import": "./dist/index.mjs",
21
+ "require": "./dist/index.js",
22
+ "types": "./dist/index.d.ts"
23
+ },
24
+ "./rollup": {
25
+ "types": "./dist/rollup.d.ts",
26
+ "require": "./dist/rollup.js",
27
+ "import": "./dist/rollup.mjs"
28
+ },
29
+ "./vite": {
30
+ "types": "./dist/vite.d.ts",
31
+ "require": "./dist/vite.js",
32
+ "import": "./dist/vite.mjs"
33
+ },
34
+ "./webpack": {
35
+ "types": "./dist/webpack.d.ts",
36
+ "require": "./dist/webpack.js",
37
+ "import": "./dist/webpack.mjs"
38
+ },
39
+ "./esbuild": {
40
+ "types": "./dist/esbuild.d.ts",
41
+ "require": "./dist/esbuild.js",
42
+ "import": "./dist/esbuild.mjs"
43
+ },
44
+ "./rspack": {
45
+ "types": "./dist/rspack.d.ts",
46
+ "require": "./dist/rspack.js",
47
+ "import": "./dist/rspack.mjs"
48
+ }
49
+ },
50
+ "main": "./dist/index.js",
51
+ "types": "./dist/index.d.ts",
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.6.7",
58
+ "rambda": "^9.1.0",
59
+ "unplugin": "^1.7.1"
60
+ },
61
+ "peerDependencies": {
62
+ "typescript": "^4.9.0 || ^5.0.0",
63
+ "vue-tsc": "^1.0.24"
64
+ }
65
+ }
package/dist/rollup.d.mts CHANGED
@@ -1,6 +1,7 @@
1
- import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-ce85caac.js';
1
+ import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-8173ef89.js';
2
+ import * as unplugin from 'unplugin';
2
3
 
3
- declare const NativeFederationTypeScriptRemote: (options: RemoteOptions) => undefined | undefined[];
4
- declare const NativeFederationTypeScriptHost: (options: HostOptions) => undefined | undefined[];
4
+ declare const NativeFederationTypeScriptRemote: (options: RemoteOptions) => unplugin.RollupPlugin | unplugin.RollupPlugin[];
5
+ declare const NativeFederationTypeScriptHost: (options: HostOptions) => unplugin.RollupPlugin | unplugin.RollupPlugin[];
5
6
 
6
7
  export { NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote };
package/dist/rollup.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-ce85caac.js';
1
+ import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-8173ef89.js';
2
+ import * as unplugin from 'unplugin';
2
3
 
3
- declare const NativeFederationTypeScriptRemote: (options: RemoteOptions) => undefined | undefined[];
4
- declare const NativeFederationTypeScriptHost: (options: HostOptions) => undefined | undefined[];
4
+ declare const NativeFederationTypeScriptRemote: (options: RemoteOptions) => unplugin.RollupPlugin | unplugin.RollupPlugin[];
5
+ declare const NativeFederationTypeScriptHost: (options: HostOptions) => unplugin.RollupPlugin | unplugin.RollupPlugin[];
5
6
 
6
7
  export { NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote };
package/dist/rollup.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5DG6MWZHjs = require('./chunk-5DG6MWZH.js');var r=_chunk5DG6MWZHjs.a.rollup,i= exports.NativeFederationTypeScriptHost =_chunk5DG6MWZHjs.b.rollup;exports.NativeFederationTypeScriptHost = i; exports.NativeFederationTypeScriptRemote = r;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIDWEZ3WPjs = require('./chunk-IDWEZ3WP.js');var r=_chunkIDWEZ3WPjs.a.rollup,i= exports.NativeFederationTypeScriptHost =_chunkIDWEZ3WPjs.b.rollup;exports.NativeFederationTypeScriptHost = i; exports.NativeFederationTypeScriptRemote = r;
package/dist/rollup.mjs CHANGED
@@ -1 +1 @@
1
- import{a as e,b as t}from"./chunk-2JPDJNBW.mjs";var r=e.rollup,i=t.rollup;export{i as NativeFederationTypeScriptHost,r as NativeFederationTypeScriptRemote};
1
+ import{a as e,b as t}from"./chunk-MSWS7NCK.mjs";var r=e.rollup,i=t.rollup;export{i as NativeFederationTypeScriptHost,r as NativeFederationTypeScriptRemote};
package/dist/rspack.d.mts CHANGED
@@ -1,6 +1,7 @@
1
- import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-ce85caac.js';
1
+ import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-8173ef89.js';
2
+ import * as unplugin from 'unplugin';
2
3
 
3
- declare const NativeFederationTypeScriptRemote: (options: RemoteOptions) => RspackPluginInstance;
4
- declare const NativeFederationTypeScriptHost: (options: HostOptions) => RspackPluginInstance;
4
+ declare const NativeFederationTypeScriptRemote: (options: RemoteOptions) => unplugin.RspackPluginInstance;
5
+ declare const NativeFederationTypeScriptHost: (options: HostOptions) => unplugin.RspackPluginInstance;
5
6
 
6
7
  export { NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote };
package/dist/rspack.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-ce85caac.js';
1
+ import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-8173ef89.js';
2
+ import * as unplugin from 'unplugin';
2
3
 
3
- declare const NativeFederationTypeScriptRemote: (options: RemoteOptions) => RspackPluginInstance;
4
- declare const NativeFederationTypeScriptHost: (options: HostOptions) => RspackPluginInstance;
4
+ declare const NativeFederationTypeScriptRemote: (options: RemoteOptions) => unplugin.RspackPluginInstance;
5
+ declare const NativeFederationTypeScriptHost: (options: HostOptions) => unplugin.RspackPluginInstance;
5
6
 
6
7
  export { NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote };
package/dist/rspack.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5DG6MWZHjs = require('./chunk-5DG6MWZH.js');var r=_chunk5DG6MWZHjs.a.rspack,a= exports.NativeFederationTypeScriptHost =_chunk5DG6MWZHjs.b.rspack;exports.NativeFederationTypeScriptHost = a; exports.NativeFederationTypeScriptRemote = r;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIDWEZ3WPjs = require('./chunk-IDWEZ3WP.js');var r=_chunkIDWEZ3WPjs.a.rspack,a= exports.NativeFederationTypeScriptHost =_chunkIDWEZ3WPjs.b.rspack;exports.NativeFederationTypeScriptHost = a; exports.NativeFederationTypeScriptRemote = r;
package/dist/rspack.mjs CHANGED
@@ -1 +1 @@
1
- import{a as e,b as t}from"./chunk-2JPDJNBW.mjs";var r=e.rspack,a=t.rspack;export{a as NativeFederationTypeScriptHost,r as NativeFederationTypeScriptRemote};
1
+ import{a as e,b as t}from"./chunk-MSWS7NCK.mjs";var r=e.rspack,a=t.rspack;export{a as NativeFederationTypeScriptHost,r as NativeFederationTypeScriptRemote};
package/dist/vite.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-ce85caac.js';
1
+ import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-8173ef89.js';
2
2
 
3
3
  declare const NativeFederationTypeScriptRemote: (options: RemoteOptions) => any;
4
4
  declare const NativeFederationTypeScriptHost: (options: HostOptions) => any;
package/dist/vite.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-ce85caac.js';
1
+ import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-8173ef89.js';
2
2
 
3
3
  declare const NativeFederationTypeScriptRemote: (options: RemoteOptions) => any;
4
4
  declare const NativeFederationTypeScriptHost: (options: HostOptions) => any;
package/dist/vite.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5DG6MWZHjs = require('./chunk-5DG6MWZH.js');var i=_chunk5DG6MWZHjs.a.vite,p= exports.NativeFederationTypeScriptHost =_chunk5DG6MWZHjs.b.vite;exports.NativeFederationTypeScriptHost = p; exports.NativeFederationTypeScriptRemote = i;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIDWEZ3WPjs = require('./chunk-IDWEZ3WP.js');var i=_chunkIDWEZ3WPjs.a.vite,p= exports.NativeFederationTypeScriptHost =_chunkIDWEZ3WPjs.b.vite;exports.NativeFederationTypeScriptHost = p; exports.NativeFederationTypeScriptRemote = i;
package/dist/vite.mjs CHANGED
@@ -1 +1 @@
1
- import{a as t,b as e}from"./chunk-2JPDJNBW.mjs";var i=t.vite,p=e.vite;export{p as NativeFederationTypeScriptHost,i as NativeFederationTypeScriptRemote};
1
+ import{a as t,b as e}from"./chunk-MSWS7NCK.mjs";var i=t.vite,p=e.vite;export{p as NativeFederationTypeScriptHost,i as NativeFederationTypeScriptRemote};
@@ -1,4 +1,4 @@
1
- import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-ce85caac.js';
1
+ import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-8173ef89.js';
2
2
 
3
3
  declare const NativeFederationTypeScriptRemote: (options: RemoteOptions) => undefined;
4
4
  declare const NativeFederationTypeScriptHost: (options: HostOptions) => undefined;
package/dist/webpack.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-ce85caac.js';
1
+ import { R as RemoteOptions, H as HostOptions } from './RemoteOptions-8173ef89.js';
2
2
 
3
3
  declare const NativeFederationTypeScriptRemote: (options: RemoteOptions) => undefined;
4
4
  declare const NativeFederationTypeScriptHost: (options: HostOptions) => undefined;
package/dist/webpack.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5DG6MWZHjs = require('./chunk-5DG6MWZH.js');var a=_chunk5DG6MWZHjs.a.webpack,r= exports.NativeFederationTypeScriptHost =_chunk5DG6MWZHjs.b.webpack;exports.NativeFederationTypeScriptHost = r; exports.NativeFederationTypeScriptRemote = a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIDWEZ3WPjs = require('./chunk-IDWEZ3WP.js');var a=_chunkIDWEZ3WPjs.a.webpack,r= exports.NativeFederationTypeScriptHost =_chunkIDWEZ3WPjs.b.webpack;exports.NativeFederationTypeScriptHost = r; exports.NativeFederationTypeScriptRemote = a;
package/dist/webpack.mjs CHANGED
@@ -1 +1 @@
1
- import{a as e,b as t}from"./chunk-2JPDJNBW.mjs";var a=e.webpack,r=t.webpack;export{r as NativeFederationTypeScriptHost,a as NativeFederationTypeScriptRemote};
1
+ import{a as e,b as t}from"./chunk-MSWS7NCK.mjs";var a=e.webpack,r=t.webpack;export{r as NativeFederationTypeScriptHost,a as NativeFederationTypeScriptRemote};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/native-federation-typescript",
3
- "version": "0.2.6",
3
+ "version": "0.3.1",
4
4
  "description": "Bundler agnostic unplugin to share federated types",
5
5
  "keywords": [
6
6
  "module federation",
@@ -8,8 +8,12 @@
8
8
  "remote types",
9
9
  "federated types"
10
10
  ],
11
+ "files": [
12
+ "dist/",
13
+ "README.md"
14
+ ],
11
15
  "publishConfig": {
12
- "registry": "https://registry.npmjs.org/"
16
+ "access": "public"
13
17
  },
14
18
  "exports": {
15
19
  ".": {
@@ -50,12 +54,12 @@
50
54
  "dependencies": {
51
55
  "adm-zip": "^0.5.10",
52
56
  "ansi-colors": "^4.1.3",
53
- "axios": "^1.3.4",
54
- "rambda": "^7.5.0",
55
- "unplugin": "^1.3.1"
57
+ "axios": "^1.6.7",
58
+ "rambda": "^9.1.0",
59
+ "unplugin": "^1.7.1"
56
60
  },
57
61
  "peerDependencies": {
58
62
  "typescript": "^4.9.0 || ^5.0.0",
59
63
  "vue-tsc": "^1.0.24"
60
64
  }
61
- }
65
+ }
package/CHANGELOG.md DELETED
@@ -1,95 +0,0 @@
1
- # Changelog
2
-
3
- This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
-
5
- ## [0.2.6](https://github.com/module-federation/nextjs-mf/compare/native-federation-typescript-0.2.5...native-federation-typescript-0.2.6) (2023-07-01)
6
-
7
-
8
-
9
- ## [0.2.5](https://github.com/module-federation/nextjs-mf/compare/native-federation-typescript-0.2.4...native-federation-typescript-0.2.5) (2023-07-01)
10
-
11
-
12
-
13
- ## [0.2.4](https://github.com/module-federation/nextjs-mf/compare/native-federation-typescript-0.2.3...native-federation-typescript-0.2.4) (2023-07-01)
14
-
15
-
16
-
17
- ## [0.2.3](https://github.com/module-federation/nextjs-mf/compare/native-federation-typescript-0.2.2...native-federation-typescript-0.2.3) (2023-07-01)
18
-
19
-
20
-
21
- ## [0.2.2](https://github.com/module-federation/nextjs-mf/compare/native-federation-typescript-0.2.1...native-federation-typescript-0.2.2) (2023-06-28)
22
-
23
-
24
- ### Bug Fixes
25
-
26
- * .at(-1) ([8dd0520](https://github.com/module-federation/nextjs-mf/commit/8dd0520b5464c49e89c63307c5388450e4bebbf8))
27
-
28
-
29
-
30
- ## [0.2.1](https://github.com/module-federation/nextjs-mf/compare/native-federation-typescript-0.2.0...native-federation-typescript-0.2.1) (2023-05-13)
31
-
32
-
33
- ### Bug Fixes
34
-
35
- * [#857](https://github.com/module-federation/nextjs-mf/issues/857) ([#859](https://github.com/module-federation/nextjs-mf/issues/859)) ([2fb609e](https://github.com/module-federation/nextjs-mf/commit/2fb609efb9a3c8f3e6740e0159510d649c1d229d))
36
- * downgrade next to v13.3.1 ([0032452](https://github.com/module-federation/nextjs-mf/commit/0032452980c70b211b6c04332326b7973f7c8446))
37
- * removed lock ([82f578e](https://github.com/module-federation/nextjs-mf/commit/82f578e713734f7f6b06e09b794fab4f66af248a))
38
-
39
-
40
-
41
- # [0.2.0](https://github.com/module-federation/nextjs-mf/compare/native-federation-typescript-0.1.1...native-federation-typescript-0.2.0) (2023-04-29)
42
-
43
-
44
- ### Bug Fixes
45
-
46
- * removed any from error logger type ([fb9fcc3](https://github.com/module-federation/nextjs-mf/commit/fb9fcc3a54a13be36335830f076a86557b75bb4a))
47
- * subpath ([1548501](https://github.com/module-federation/nextjs-mf/commit/1548501bb4679c0c534c02609cb6bc5459f224a4))
48
- * subpath ([aaad665](https://github.com/module-federation/nextjs-mf/commit/aaad665307d80b49ee19496a5b8b400df243558e))
49
-
50
-
51
- ### Features
52
-
53
- * 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))
54
-
55
-
56
-
57
- ## [0.1.1](https://github.com/module-federation/nextjs-mf/compare/native-federation-typescript-0.1.0...native-federation-typescript-0.1.1) (2023-04-12)
58
-
59
-
60
- ### Bug Fixes
61
-
62
- * native build chunks ([d6c9f8a](https://github.com/module-federation/nextjs-mf/commit/d6c9f8a957ed00a8d92332ccc38ed9780f01d54e))
63
-
64
-
65
- ### Reverts
66
-
67
- * Revert "chore(native-federation-typescript): release version 0.1.1" ([91786df](https://github.com/module-federation/nextjs-mf/commit/91786df726e5c078ed78e745b6b105e11bd2e39b))
68
- * Revert "chore(native-federation-typescript): release version 0.1.1" ([097f188](https://github.com/module-federation/nextjs-mf/commit/097f188458835457a2713d98bf3eaf291d5ad102))
69
-
70
-
71
-
72
- # 0.1.0 (2023-04-05)
73
-
74
-
75
- ### Bug Fixes
76
-
77
- * build ([d0b2f72](https://github.com/module-federation/nextjs-mf/commit/d0b2f72f4fc3647825412be1574311c3152cf167))
78
- * build step ([a217170](https://github.com/module-federation/nextjs-mf/commit/a21717096cbc09bff20d3aeebfea2f3533afb0d7))
79
- * compiler instance ([e5c249d](https://github.com/module-federation/nextjs-mf/commit/e5c249d41d68339886268337654ff47b31b06a3a))
80
- * deps ([a378441](https://github.com/module-federation/nextjs-mf/commit/a37844194a3f189cc5863bbdd4776259bce69fa4))
81
- * dirtree tests ([5cb49fd](https://github.com/module-federation/nextjs-mf/commit/5cb49fd1c6520311a7d2e7d2b37a93389a500715))
82
- * eslintrc ([0f69dee](https://github.com/module-federation/nextjs-mf/commit/0f69dee253c2c608b2367d545c7d4a57ad0c2ca5))
83
- * format ([25fb765](https://github.com/module-federation/nextjs-mf/commit/25fb7659481287a791e9de4fe839e980dbf06968))
84
- * readme ([eaca0b3](https://github.com/module-federation/nextjs-mf/commit/eaca0b311d3b8d9e73309cb92d9a9488f9fc23c0))
85
- * readme ([fc0e5dc](https://github.com/module-federation/nextjs-mf/commit/fc0e5dc26e617664224e1c10548b151a44f8dff9))
86
- * README.md ([9159171](https://github.com/module-federation/nextjs-mf/commit/91591712e9a103fff351f0a168c149470c0d69ad))
87
- * remove changelog ([724918e](https://github.com/module-federation/nextjs-mf/commit/724918ebf888297689b6ed700bd14ec01fd1ef35))
88
- * ts build ([9ed3a52](https://github.com/module-federation/nextjs-mf/commit/9ed3a527d0ba903b6cfa6023a7ad5da63781970c))
89
-
90
-
91
- ### Features
92
-
93
- * federated tests plugin ([063ab33](https://github.com/module-federation/nextjs-mf/commit/063ab336c4830aff4f5bd3b9894df60b4651a9be))
94
- * native-federation-typescript plugin ([#692](https://github.com/module-federation/nextjs-mf/issues/692)) ([b41c5aa](https://github.com/module-federation/nextjs-mf/commit/b41c5aacfeda0fada5b426086658235edfd86cdd))
95
- * test command ([3ade629](https://github.com/module-federation/nextjs-mf/commit/3ade629488f4ea1549314b82b41caef9a046da9f))
@@ -1,2 +0,0 @@
1
- var I=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});import l from"ansi-colors";import{rm as S}from"fs/promises";import{resolve as pe}from"path";import{mergeDeepRight as ce}from"rambda";import{createUnplugin as q}from"unplugin";var U={typesFolder:"@mf-types",deleteTypesFolder:!0},L=t=>{let e=t.split("@");return e[e.length-1]},z=(t,e)=>{let o=L(e),r=new URL(o),s=r.pathname.split("/").slice(0,-1).join("/");return r.pathname=`${s}/${t.typesFolder}.zip`,r.href},W=t=>Object.entries(t.moduleFederationConfig.remotes).reduce((e,[o,r])=>(e[o]=z(t,r),e),{}),T=t=>{if(!t.moduleFederationConfig)throw new Error("moduleFederationConfig is required");let e={...U,...t},o=W(e);return{hostOptions:e,mapRemotesToDownload:o}};import{existsSync as _}from"fs";import{dirname as Z,join as d,resolve as M}from"path";import m from"typescript";var B={tsConfigPath:"./tsconfig.json",typesFolder:"@mf-types",compiledTypesFolder:"compiled-types",deleteTypesFolder:!0,additionalFilesToCompile:[],compilerInstance:"tsc"},X=({tsConfigPath:t,typesFolder:e,compiledTypesFolder:o})=>{let r=M(t),s=m.readConfigFile(r,m.sys.readFile),i=m.parseJsonConfigFileContent(s.config,m.sys,Z(r)),p=d(i.options.outDir||"dist",e,o);return{...i.options,emitDeclarationOnly:!0,noEmit:!1,declaration:!0,outDir:p}},k=["ts","tsx","vue","svelte"],R=t=>{let e=process.cwd();for(let o of k){let r=d(e,`${t}.${o}`);if(_(r))return r}},J=t=>Object.entries(t.moduleFederationConfig.exposes).reduce((e,[o,r])=>(e[o]=R(r)||R(d(r,"index"))||r,e),{}),v=t=>{if(!t.moduleFederationConfig)throw new Error("moduleFederationConfig is required");let e={...B,...t},o=J(e);return{tsConfig:X(e),mapComponentsToExpose:o,remoteOptions:e}};import E from"adm-zip";import re from"ansi-colors";import se from"axios";import{join as P}from"path";import C from"ansi-colors";import{dirname as V,join as G,normalize as h,relative as K}from"path";import a from"typescript";var Q=/^\//,F=".d.ts",Y=t=>{let{line:e}=t.file.getLineAndCharacterOfPosition(t.start);console.error(C.red(`TS Error ${t.code}':' ${a.flattenDiagnosticMessageText(t.messageText,a.sys.newLine)}`)),console.error(C.red(` at ${t.file.fileName}:${e+1} typescript.sys.newLine`))},c=(t,e)=>h(t.outDir.replace(e.compiledTypesFolder,"")),w=(t,e)=>h(t.outDir.replace(e.compiledTypesFolder,"").replace(e.typesFolder,"")),ee=(t,e,o)=>{let r=a.createCompilerHost(e),s=r.writeFile,i=Object.fromEntries(Object.entries(t).map(n=>n.reverse())),p=c(e,o);return r.writeFile=(n,D,f,b,u,j)=>{s(n,D,f,b,u,j);for(let N of u||[]){let y=i[N.fileName];if(y){let g=G(p,`${y}${F}`),A=V(g),O=K(A,n).replace(F,"").replace(Q,"");s(g,`export * from './${O}';
2
- export { default } from './${O}';`,f)}}},r},te=t=>I("vue-tsc").createProgram(t),oe=(t,e)=>{switch(t.compilerInstance){case"vue-tsc":return te(e);case"tsc":default:return a.createProgram(e)}},x=(t,e,o)=>{let r=ee(t,e,o),i={rootNames:[...Object.values(t),...o.additionalFilesToCompile],host:r,options:e},p=oe(o,i),{diagnostics:n=[]}=p.emit();n.forEach(Y)};var ie=(t,e)=>P(t.replace(e.typesFolder,""),`${e.typesFolder}.zip`),$=async(t,e)=>{let o=c(t,e),r=new E;return r.addLocalFolder(o),r.writeZipPromise(ie(o,e))},ne=(t,e)=>o=>{throw console.error(re.red(`Unable to download federated types for '${t}' from '${e}' because '${o.message}', skipping...`)),o},H=t=>async([e,o])=>{let r=await se.get(o,{responseType:"arraybuffer"}).catch(ne(e,o)),s=P(t.typesFolder,e);new E(Buffer.from(r.data)).extractAllTo(s,!0)};var je=q(t=>{let{remoteOptions:e,tsConfig:o,mapComponentsToExpose:r}=v(t);return{name:"native-federation-typescript/remote",async writeBundle(){try{x(r,o,e),await $(o,e),e.deleteTypesFolder&&await S(c(o,e),{recursive:!0,force:!0}),console.log(l.green("Federated types created correctly"))}catch(s){console.error(l.red(`Unable to compile federated types, ${s}`))}},webpack:s=>{s.options.devServer=ce(s.options.devServer||{},{static:{directory:pe(w(o,e))}})}}}),Ne=q(t=>{let{hostOptions:e,mapRemotesToDownload:o}=T(t);return{name:"native-federation-typescript/host",async writeBundle(){e.deleteTypesFolder&&await S(e.typesFolder,{recursive:!0,force:!0}).catch(i=>console.error(l.red(`Unable to remove types folder, ${i}`)));let r=H(e),s=Object.entries(o).map(r);await Promise.allSettled(s),console.log(l.green("Federated types extraction completed"))}}});export{je as a,Ne as b};
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var I=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var _ansicolors = require('ansi-colors'); var _ansicolors2 = _interopRequireDefault(_ansicolors);var _promises = require('fs/promises');var _path = require('path');var _rambda = require('rambda');var _unplugin = require('unplugin');var U={typesFolder:"@mf-types",deleteTypesFolder:!0},L=t=>{let e=t.split("@");return e[e.length-1]},z=(t,e)=>{let o=L(e),r=new URL(o),s=r.pathname.split("/").slice(0,-1).join("/");return r.pathname=`${s}/${t.typesFolder}.zip`,r.href},W=t=>Object.entries(t.moduleFederationConfig.remotes).reduce((e,[o,r])=>(e[o]=z(t,r),e),{}),T=t=>{if(!t.moduleFederationConfig)throw new Error("moduleFederationConfig is required");let e={...U,...t},o=W(e);return{hostOptions:e,mapRemotesToDownload:o}};var _fs = require('fs');var _typescript = require('typescript'); var _typescript2 = _interopRequireDefault(_typescript);var B={tsConfigPath:"./tsconfig.json",typesFolder:"@mf-types",compiledTypesFolder:"compiled-types",deleteTypesFolder:!0,additionalFilesToCompile:[],compilerInstance:"tsc"},X=({tsConfigPath:t,typesFolder:e,compiledTypesFolder:o})=>{let r=_path.resolve.call(void 0, t),s=_typescript2.default.readConfigFile(r,_typescript2.default.sys.readFile),i=_typescript2.default.parseJsonConfigFileContent(s.config,_typescript2.default.sys,_path.dirname.call(void 0, r)),p=_path.join.call(void 0, i.options.outDir||"dist",e,o);return{...i.options,emitDeclarationOnly:!0,noEmit:!1,declaration:!0,outDir:p}},k=["ts","tsx","vue","svelte"],R=t=>{let e=process.cwd();for(let o of k){let r=_path.join.call(void 0, e,`${t}.${o}`);if(_fs.existsSync.call(void 0, r))return r}},J=t=>Object.entries(t.moduleFederationConfig.exposes).reduce((e,[o,r])=>(e[o]=R(r)||R(_path.join.call(void 0, r,"index"))||r,e),{}),v=t=>{if(!t.moduleFederationConfig)throw new Error("moduleFederationConfig is required");let e={...B,...t},o=J(e);return{tsConfig:X(e),mapComponentsToExpose:o,remoteOptions:e}};var _admzip = require('adm-zip'); var _admzip2 = _interopRequireDefault(_admzip);var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);var Q=/^\//,F=".d.ts",Y=t=>{let{line:e}=t.file.getLineAndCharacterOfPosition(t.start);console.error(_ansicolors2.default.red(`TS Error ${t.code}':' ${_typescript2.default.flattenDiagnosticMessageText(t.messageText,_typescript2.default.sys.newLine)}`)),console.error(_ansicolors2.default.red(` at ${t.file.fileName}:${e+1} typescript.sys.newLine`))},c=(t,e)=>_path.normalize.call(void 0, t.outDir.replace(e.compiledTypesFolder,"")),w=(t,e)=>_path.normalize.call(void 0, t.outDir.replace(e.compiledTypesFolder,"").replace(e.typesFolder,"")),ee=(t,e,o)=>{let r=_typescript2.default.createCompilerHost(e),s=r.writeFile,i=Object.fromEntries(Object.entries(t).map(n=>n.reverse())),p=c(e,o);return r.writeFile=(n,D,f,b,u,j)=>{s(n,D,f,b,u,j);for(let N of u||[]){let y=i[N.fileName];if(y){let g=_path.join.call(void 0, p,`${y}${F}`),A=_path.dirname.call(void 0, g),O=_path.relative.call(void 0, A,n).replace(F,"").replace(Q,"");s(g,`export * from './${O}';
2
- export { default } from './${O}';`,f)}}},r},te=t=>I("vue-tsc").createProgram(t),oe=(t,e)=>{switch(t.compilerInstance){case"vue-tsc":return te(e);case"tsc":default:return _typescript2.default.createProgram(e)}},x=(t,e,o)=>{let r=ee(t,e,o),i={rootNames:[...Object.values(t),...o.additionalFilesToCompile],host:r,options:e},p=oe(o,i),{diagnostics:n=[]}=p.emit();n.forEach(Y)};var ie=(t,e)=>_path.join.call(void 0, t.replace(e.typesFolder,""),`${e.typesFolder}.zip`),$=async(t,e)=>{let o=c(t,e),r=new _admzip2.default;return r.addLocalFolder(o),r.writeZipPromise(ie(o,e))},ne=(t,e)=>o=>{throw console.error(_ansicolors2.default.red(`Unable to download federated types for '${t}' from '${e}' because '${o.message}', skipping...`)),o},H=t=>async([e,o])=>{let r=await _axios2.default.get(o,{responseType:"arraybuffer"}).catch(ne(e,o)),s=_path.join.call(void 0, t.typesFolder,e);new (0, _admzip2.default)(Buffer.from(r.data)).extractAllTo(s,!0)};var je=_unplugin.createUnplugin.call(void 0, t=>{let{remoteOptions:e,tsConfig:o,mapComponentsToExpose:r}=v(t);return{name:"native-federation-typescript/remote",async writeBundle(){try{x(r,o,e),await $(o,e),e.deleteTypesFolder&&await _promises.rm.call(void 0, c(o,e),{recursive:!0,force:!0}),console.log(_ansicolors2.default.green("Federated types created correctly"))}catch(s){console.error(_ansicolors2.default.red(`Unable to compile federated types, ${s}`))}},webpack:s=>{s.options.devServer=_rambda.mergeDeepRight.call(void 0, s.options.devServer||{},{static:{directory:_path.resolve.call(void 0, w(o,e))}})}}}),Ne= exports.b =_unplugin.createUnplugin.call(void 0, t=>{let{hostOptions:e,mapRemotesToDownload:o}=T(t);return{name:"native-federation-typescript/host",async writeBundle(){e.deleteTypesFolder&&await _promises.rm.call(void 0, e.typesFolder,{recursive:!0,force:!0}).catch(i=>console.error(_ansicolors2.default.red(`Unable to remove types folder, ${i}`)));let r=H(e),s=Object.entries(o).map(r);await Promise.allSettled(s),console.log(_ansicolors2.default.green("Federated types extraction completed"))}}});exports.a = je; exports.b = Ne;