@module-federation/native-federation-typescript 0.2.5 → 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
@@ -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,314 @@
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.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.14 ([#1309](https://github.com/module-federation/universe/issues/1309)) ([d0a2314](https://github.com/module-federation/universe/commit/d0a231470e37dbad85a11df1f12695657ba3b984))
12
+ - **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))
13
+ - **deps:** update dependency axios to v1.5.1 ([ae9a06a](https://github.com/module-federation/universe/commit/ae9a06a0cc35fad27a0b493a25370b92617c39fb))
14
+ - **deps:** update dependency core-js to v3.32.2 ([18d2746](https://github.com/module-federation/universe/commit/18d2746763f38fe295a14df3f1bcd4218fade5b8))
15
+ - **deps:** update dependency core-js to v3.33.0 ([30894ca](https://github.com/module-federation/universe/commit/30894cafbe5dea4350dc7c633548038d7ec5f8a8))
16
+ - **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))
17
+ - **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))
18
+ - **deps:** update dependency react-router-dom to v6.16.0 ([0618339](https://github.com/module-federation/universe/commit/061833912f7e5748011cd60ed679a68c1b659f77))
19
+ - **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))
20
+ - **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))
21
+ - **deps:** update dependency typedoc to v0.25.2 ([46c6524](https://github.com/module-federation/universe/commit/46c65247e187cee9e15625402c1570ac351bb1fe))
22
+ - **deps:** update dependency undici to v5.24.0 ([573e644](https://github.com/module-federation/universe/commit/573e644333da6d24cb4286ce08221a1aa82415e4))
23
+ - **deps:** update dependency undici to v5.25.2 ([da3e539](https://github.com/module-federation/universe/commit/da3e539a41ed23ccb5086b1dd428fbee0f8d652c))
24
+ - **deps:** update dependency undici to v5.25.4 ([1d4f91e](https://github.com/module-federation/universe/commit/1d4f91ec93da4326c8a42eef28f150d5d09738bb))
25
+ - **deps:** update dependency undici to v5.26.2 [security] ([410a8b8](https://github.com/module-federation/universe/commit/410a8b8bd1558dfb5119ae10941d2b3816a0d0e0))
26
+ - **deps:** update dependency unplugin to v1.5.0 ([936b3f8](https://github.com/module-federation/universe/commit/936b3f8d8061fd9d481d1788fb35b88588928d14))
27
+ - 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)
28
+ - override semantic-release-plugin-decorators ([18675de](https://github.com/module-federation/universe/commit/18675defef65570d2b3bb6a9caa3fd039badee29))
29
+ - switch to @goestav/nx-semantic-release ([63a3350](https://github.com/module-federation/universe/commit/63a3350a6a1a12235e3c9f1e7c724d54f0476356))
30
+
31
+ ### Features
32
+
33
+ - 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)
34
+ - Dynamic Filesystem ([#1274](https://github.com/module-federation/universe/issues/1274)) ([2bec98a](https://github.com/module-federation/universe/commit/2bec98a2472b44898a7f14ec6868a2368cfb6d82))
35
+ - fork module federation ([0ad7430](https://github.com/module-federation/universe/commit/0ad7430f6170458a47144be392133b7b2fa1ade0))
36
+ - improved async init ([ae3a450](https://github.com/module-federation/universe/commit/ae3a4503ff9de86492b13029d6334b281ddd9493))
37
+ - native self forming node federation ([#1291](https://github.com/module-federation/universe/issues/1291)) ([1dd5ed1](https://github.com/module-federation/universe/commit/1dd5ed17c981e036336925e807203e94b58c36d6))
38
+ - new actions, remove gpt integration ([370229e](https://github.com/module-federation/universe/commit/370229e02cc352fcfaeaa0f3cf1f9f2d4966d1bb))
39
+ - **node:** node federation demo/testing apps added ([27d545d](https://github.com/module-federation/universe/commit/27d545d99095da7134c392dbcd9fb135a170f6ef))
40
+ - **typedoc-parsetr:** merged main ([cf6e65a](https://github.com/module-federation/universe/commit/cf6e65a4aa895d7c2dba8fdbd8ec22ec7bd8f514))
41
+ - **typedoc-parsetr:** merged main ([2ff0d5a](https://github.com/module-federation/universe/commit/2ff0d5a075df3f241742cc7e516cd0378e8e1b3e))
42
+ - **typedoc-parsetr:** python script implementation ([0a533cb](https://github.com/module-federation/universe/commit/0a533cb60e0c3ca269ab45df740c1367be175e80))
43
+
44
+ ### BREAKING CHANGES
45
+
46
+ - automaticAsyncBoundary option has been removed
47
+
48
+ - fix: exclude specific pages from page map automatically
49
+
50
+ - refactor: conslidate codebase
51
+
52
+ - fix: improve hot reload share recovery
53
+
54
+ - refactor: remove server jsonp template
55
+
56
+ - chore: remove dead code from runtime modules
57
+
58
+ - fix: clean up jsonp getCustomJsonpCode
59
+
60
+ getting chunk loading global from compiler output options
61
+
62
+ - feat: adding cleanInitArrays runtime helper
63
+
64
+ - chore: remove share scope hoist and module hoisting system
65
+
66
+ - chore: cleanup code
67
+
68
+ - chore: remove dead code from add module runtime plugin
69
+
70
+ likely can remove whole plugin in future
71
+
72
+ - chore: remove logs from delegate modules
73
+
74
+ - chore: remove old utils
75
+
76
+ - fix: add warning on auto page stitch
77
+
78
+ - fix: remove commented out code from InvertedContainerPlugin.ts
79
+
80
+ - chore: improve logging to see if its local load or remote load
81
+
82
+ - chore: clean up old custom promises factories
83
+
84
+ - fix: remove container proxy code
85
+
86
+ - fix: remove container proxy code
87
+ - automaticAsyncBoundary option has been removed
88
+
89
+ - fix: exclude specific pages from page map automatically
90
+
91
+ - refactor: conslidate codebase
92
+
93
+ - fix: improve hot reload share recovery
94
+
95
+ - refactor: remove server jsonp template
96
+
97
+ - chore: remove dead code from runtime modules
98
+
99
+ - fix: clean up jsonp getCustomJsonpCode
100
+
101
+ getting chunk loading global from compiler output options
102
+
103
+ - feat: adding cleanInitArrays runtime helper
104
+
105
+ - chore: remove share scope hoist and module hoisting system
106
+
107
+ - chore: cleanup code
108
+
109
+ - chore: remove dead code from add module runtime plugin
110
+
111
+ likely can remove whole plugin in future
112
+
113
+ - chore: remove logs from delegate modules
114
+
115
+ - chore: remove old utils
116
+
117
+ - fix: add warning on auto page stitch
118
+
119
+ - fix: remove commented out code from InvertedContainerPlugin.ts
120
+
121
+ - chore: improve logging to see if its local load or remote load
122
+
123
+ - chore: clean up old custom promises factories
124
+
125
+ - fix: remove container proxy code
126
+
127
+ - fix: remove container proxy code
128
+
129
+ - chore: fix project.json
130
+
131
+ - debugging
132
+
133
+ - fix: resolve backmerge issues with build
134
+
135
+ - Merge branch 'kill_child_compilers' into fix_backmerge_issues
136
+
137
+ # Conflicts:
138
+
139
+ # package-lock.json
140
+
141
+ # package.json
142
+
143
+ # packages/nextjs-mf/src/plugins/NextFederationPlugin/index.ts
144
+
145
+ # packages/nextjs-mf/src/plugins/container/InvertedContainerPlugin.ts
146
+
147
+ # packages/nextjs-mf/src/plugins/container/InvertedContainerRuntimeModule.ts
148
+
149
+ - feat: enable eager sharing
150
+
151
+ - refactor: improve module hooks for eager loading and search
152
+
153
+ - refactor: cleanup custom jsonp and make es5
154
+
155
+ - refactor: cleanup inverted container code
156
+
157
+ - refactor: cleanup inverted container code
158
+ - automaticAsyncBoundary option has been removed
159
+
160
+ - fix: exclude specific pages from page map automatically
161
+
162
+ - refactor: conslidate codebase
163
+
164
+ - fix: improve hot reload share recovery
165
+
166
+ - refactor: remove server jsonp template
167
+
168
+ - chore: remove dead code from runtime modules
169
+
170
+ - fix: clean up jsonp getCustomJsonpCode
171
+
172
+ getting chunk loading global from compiler output options
173
+
174
+ - feat: adding cleanInitArrays runtime helper
175
+
176
+ - chore: remove share scope hoist and module hoisting system
177
+
178
+ - chore: cleanup code
179
+
180
+ - chore: remove dead code from add module runtime plugin
181
+
182
+ likely can remove whole plugin in future
183
+
184
+ - chore: remove logs from delegate modules
185
+
186
+ - chore: remove old utils
187
+
188
+ - fix: add warning on auto page stitch
189
+
190
+ - fix: remove commented out code from InvertedContainerPlugin.ts
191
+
192
+ - chore: improve logging to see if its local load or remote load
193
+
194
+ - chore: clean up old custom promises factories
195
+
196
+ - fix: remove container proxy code
197
+
198
+ - fix: remove container proxy code
199
+
200
+ - fix: resolve backmerge issues with build
201
+
202
+ - Merge branch 'kill_child_compilers' into fix_backmerge_issues
203
+
204
+ # Conflicts:
205
+
206
+ # package-lock.json
207
+
208
+ # package.json
209
+
210
+ # packages/nextjs-mf/src/plugins/NextFederationPlugin/index.ts
211
+
212
+ # packages/nextjs-mf/src/plugins/container/InvertedContainerPlugin.ts
213
+
214
+ # packages/nextjs-mf/src/plugins/container/InvertedContainerRuntimeModule.ts
215
+
216
+ - feat: enable eager sharing
217
+
218
+ - refactor: improve module hooks for eager loading and search
219
+
220
+ - refactor: cleanup custom jsonp and make es5
221
+
222
+ - refactor: cleanup inverted container code
223
+
224
+ - refactor: cleanup inverted container code
225
+
226
+ - ci: fix install step with npm and NX
227
+
228
+ - test: remove tests for now
229
+
230
+ - chore(utils): release version 1.7.3-beta.0
231
+
232
+ - chore(utils): release version 1.7.3
233
+
234
+ - chore(node): release version 0.14.4-beta.0
235
+
236
+ - chore(node): release version 0.14.4
237
+
238
+ - chore(nextjs-mf): release version 6.4.1-beta.4
239
+
240
+ - fix: remove debugging runtime variable
241
+
242
+ - chore(nextjs-mf): release version 6.4.1-beta.5
243
+
244
+ # Changelog
245
+
246
+ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
247
+
248
+ ## [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)
249
+
250
+ ## [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)
251
+
252
+ ## [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)
253
+
254
+ ## [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)
255
+
256
+ ## [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)
257
+
258
+ ### Bug Fixes
259
+
260
+ - .at(-1) ([8dd0520](https://github.com/module-federation/nextjs-mf/commit/8dd0520b5464c49e89c63307c5388450e4bebbf8))
261
+
262
+ ## [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)
263
+
264
+ ### Bug Fixes
265
+
266
+ - [#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))
267
+ - downgrade next to v13.3.1 ([0032452](https://github.com/module-federation/nextjs-mf/commit/0032452980c70b211b6c04332326b7973f7c8446))
268
+ - removed lock ([82f578e](https://github.com/module-federation/nextjs-mf/commit/82f578e713734f7f6b06e09b794fab4f66af248a))
269
+
270
+ # [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)
271
+
272
+ ### Bug Fixes
273
+
274
+ - removed any from error logger type ([fb9fcc3](https://github.com/module-federation/nextjs-mf/commit/fb9fcc3a54a13be36335830f076a86557b75bb4a))
275
+ - subpath ([1548501](https://github.com/module-federation/nextjs-mf/commit/1548501bb4679c0c534c02609cb6bc5459f224a4))
276
+ - subpath ([aaad665](https://github.com/module-federation/nextjs-mf/commit/aaad665307d80b49ee19496a5b8b400df243558e))
277
+
278
+ ### Features
279
+
280
+ - 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))
281
+
282
+ ## [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)
283
+
284
+ ### Bug Fixes
285
+
286
+ - native build chunks ([d6c9f8a](https://github.com/module-federation/nextjs-mf/commit/d6c9f8a957ed00a8d92332ccc38ed9780f01d54e))
287
+
288
+ ### Reverts
289
+
290
+ - Revert "chore(native-federation-typescript): release version 0.1.1" ([91786df](https://github.com/module-federation/nextjs-mf/commit/91786df726e5c078ed78e745b6b105e11bd2e39b))
291
+ - Revert "chore(native-federation-typescript): release version 0.1.1" ([097f188](https://github.com/module-federation/nextjs-mf/commit/097f188458835457a2713d98bf3eaf291d5ad102))
292
+
293
+ # 0.1.0 (2023-04-05)
294
+
295
+ ### Bug Fixes
296
+
297
+ - build ([d0b2f72](https://github.com/module-federation/nextjs-mf/commit/d0b2f72f4fc3647825412be1574311c3152cf167))
298
+ - build step ([a217170](https://github.com/module-federation/nextjs-mf/commit/a21717096cbc09bff20d3aeebfea2f3533afb0d7))
299
+ - compiler instance ([e5c249d](https://github.com/module-federation/nextjs-mf/commit/e5c249d41d68339886268337654ff47b31b06a3a))
300
+ - deps ([a378441](https://github.com/module-federation/nextjs-mf/commit/a37844194a3f189cc5863bbdd4776259bce69fa4))
301
+ - dirtree tests ([5cb49fd](https://github.com/module-federation/nextjs-mf/commit/5cb49fd1c6520311a7d2e7d2b37a93389a500715))
302
+ - eslintrc ([0f69dee](https://github.com/module-federation/nextjs-mf/commit/0f69dee253c2c608b2367d545c7d4a57ad0c2ca5))
303
+ - format ([25fb765](https://github.com/module-federation/nextjs-mf/commit/25fb7659481287a791e9de4fe839e980dbf06968))
304
+ - readme ([eaca0b3](https://github.com/module-federation/nextjs-mf/commit/eaca0b311d3b8d9e73309cb92d9a9488f9fc23c0))
305
+ - readme ([fc0e5dc](https://github.com/module-federation/nextjs-mf/commit/fc0e5dc26e617664224e1c10548b151a44f8dff9))
306
+ - README.md ([9159171](https://github.com/module-federation/nextjs-mf/commit/91591712e9a103fff351f0a168c149470c0d69ad))
307
+ - remove changelog ([724918e](https://github.com/module-federation/nextjs-mf/commit/724918ebf888297689b6ed700bd14ec01fd1ef35))
308
+ - ts build ([9ed3a52](https://github.com/module-federation/nextjs-mf/commit/9ed3a527d0ba903b6cfa6023a7ad5da63781970c))
309
+
310
+ ### Features
311
+
312
+ - federated tests plugin ([063ab33](https://github.com/module-federation/nextjs-mf/commit/063ab336c4830aff4f5bd3b9894df60b4651a9be))
313
+ - native-federation-typescript plugin ([#692](https://github.com/module-federation/nextjs-mf/issues/692)) ([b41c5aa](https://github.com/module-federation/nextjs-mf/commit/b41c5aacfeda0fada5b426086658235edfd86cdd))
314
+ - 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
+ 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,maxRetries:3},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),{}),O=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 k,join as d,resolve as Z}from"path";import a from"typescript";var M={tsConfigPath:"./tsconfig.json",typesFolder:"@mf-types",compiledTypesFolder:"compiled-types",deleteTypesFolder:!0,additionalFilesToCompile:[],compilerInstance:"tsc"},B=({tsConfigPath:t,typesFolder:e,compiledTypesFolder:o})=>{let r=Z(t),s=a.readConfigFile(r,a.sys.readFile),i=a.parseJsonConfigFileContent(s.config,a.sys,k(r)),n=d(i.options.outDir||"dist",e,o);return{...i.options,emitDeclarationOnly:!0,noEmit:!1,declaration:!0,outDir:n}},X=["ts","tsx","vue","svelte"],T=t=>{let e=process.cwd();for(let o of X){let r=d(e,`${t}.${o}`);if(_(r))return r}},J=t=>Object.entries(t.moduleFederationConfig.exposes).reduce((e,[o,r])=>(e[o]=T(r)||T(d(r,"index"))||r,e),{}),v=t=>{if(!t.moduleFederationConfig)throw new Error("moduleFederationConfig is required");let e={...M,...t},o=J(e);return{tsConfig:B(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 w,relative as K}from"path";import m from"typescript";var Q=/^\//,h=".d.ts",Y=t=>{let{line:e}=t.file.getLineAndCharacterOfPosition(t.start);console.error(C.red(`TS Error ${t.code}':' ${m.flattenDiagnosticMessageText(t.messageText,m.sys.newLine)}`)),console.error(C.red(` at ${t.file.fileName}:${e+1} typescript.sys.newLine`))},c=(t,e)=>w(t.outDir.replace(e.compiledTypesFolder,"")),F=(t,e)=>w(t.outDir.replace(e.compiledTypesFolder,"").replace(e.typesFolder,"")),ee=(t,e,o)=>{let r=m.createCompilerHost(e),s=r.writeFile,i=Object.fromEntries(Object.entries(t).map(p=>p.reverse())),n=c(e,o);return r.writeFile=(p,D,f,b,u,N)=>{s(p,D,f,b,u,N);for(let j of u||[]){let y=i[j.fileName];if(y){let g=G(n,`${y}${h}`),A=V(g),R=K(A,p).replace(h,"").replace(Q,"");s(g,`export * from './${R}';
2
+ export { default } from './${R}';`,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 m.createProgram(e)}},x=(t,e,o)=>{let r=ee(t,e,o),i={rootNames:[...Object.values(t),...o.additionalFilesToCompile],host:r,options:e},n=oe(o,i),{diagnostics:p=[]}=n.emit();p.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{...o,message:`Network error: Unable to download federated mocks for '${t}' from '${e}' because '${o.message}'`}},H=t=>{let e=0;return async([o,r])=>{let s=P(t.typesFolder,o);for(;e++<t.maxRetries;)try{let i=await se.get(r,{responseType:"arraybuffer"}).catch(ne(o,r));new E(Buffer.from(i.data)).extractAllTo(s,!0);break}catch(i){if(console.error(re.red(`Error during types archive download: ${(i==null?void 0:i.message)||"unknown error"}`)),e>=t.maxRetries)throw i}}};var Ne=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(F(o,e))}})}}}),je=q(t=>{let{hostOptions:e,mapRemotesToDownload:o}=O(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{Ne as a,je as b};
@@ -0,0 +1,2 @@
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,maxRetries:3},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),{}),O=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 M={tsConfigPath:"./tsconfig.json",typesFolder:"@mf-types",compiledTypesFolder:"compiled-types",deleteTypesFolder:!0,additionalFilesToCompile:[],compilerInstance:"tsc"},B=({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)),n=_path.join.call(void 0, i.options.outDir||"dist",e,o);return{...i.options,emitDeclarationOnly:!0,noEmit:!1,declaration:!0,outDir:n}},X=["ts","tsx","vue","svelte"],T=t=>{let e=process.cwd();for(let o of X){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]=T(r)||T(_path.join.call(void 0, r,"index"))||r,e),{}),v=t=>{if(!t.moduleFederationConfig)throw new Error("moduleFederationConfig is required");let e={...M,...t},o=J(e);return{tsConfig:B(e),mapComponentsToExpose:o,remoteOptions:e}};var _admzip = require('adm-zip'); var _admzip2 = _interopRequireDefault(_admzip);var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);var Q=/^\//,h=".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,"")),F=(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(p=>p.reverse())),n=c(e,o);return r.writeFile=(p,D,f,b,u,N)=>{s(p,D,f,b,u,N);for(let j of u||[]){let y=i[j.fileName];if(y){let g=_path.join.call(void 0, n,`${y}${h}`),A=_path.dirname.call(void 0, g),R=_path.relative.call(void 0, A,p).replace(h,"").replace(Q,"");s(g,`export * from './${R}';
2
+ export { default } from './${R}';`,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},n=oe(o,i),{diagnostics:p=[]}=n.emit();p.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{...o,message:`Network error: Unable to download federated mocks for '${t}' from '${e}' because '${o.message}'`}},H=t=>{let e=0;return async([o,r])=>{let s=_path.join.call(void 0, t.typesFolder,o);for(;e++<t.maxRetries;)try{let i=await _axios2.default.get(r,{responseType:"arraybuffer"}).catch(ne(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 Ne=_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, F(o,e))}})}}}),je= exports.b =_unplugin.createUnplugin.call(void 0, t=>{let{hostOptions:e,mapRemotesToDownload:o}=O(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 = Ne; exports.b = je;
@@ -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 _chunkOISK62WXjs = require('./chunk-OISK62WX.js');var i=_chunkOISK62WXjs.a.esbuild,r= exports.NativeFederationTypeScriptHost =_chunkOISK62WXjs.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-BOTSDODZ.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 _chunkOISK62WXjs = require('./chunk-OISK62WX.js');exports.NativeFederationTypeScriptHost = _chunkOISK62WXjs.b; exports.NativeFederationTypeScriptRemote = _chunkOISK62WXjs.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-BOTSDODZ.mjs";export{b as NativeFederationTypeScriptHost,a as NativeFederationTypeScriptRemote};
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@module-federation/native-federation-typescript",
3
+ "version": "0.3.0",
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.0.1",
59
+ "unplugin": "^1.6.0"
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 _chunkOISK62WXjs = require('./chunk-OISK62WX.js');var r=_chunkOISK62WXjs.a.rollup,i= exports.NativeFederationTypeScriptHost =_chunkOISK62WXjs.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-BOTSDODZ.mjs";var r=e.rollup,i=t.rollup;export{i as NativeFederationTypeScriptHost,r as NativeFederationTypeScriptRemote};
package/dist/rspack.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) => RspackPluginInstance;
4
4
  declare const NativeFederationTypeScriptHost: (options: HostOptions) => RspackPluginInstance;
package/dist/rspack.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) => RspackPluginInstance;
4
4
  declare const NativeFederationTypeScriptHost: (options: HostOptions) => RspackPluginInstance;
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 _chunkOISK62WXjs = require('./chunk-OISK62WX.js');var r=_chunkOISK62WXjs.a.rspack,a= exports.NativeFederationTypeScriptHost =_chunkOISK62WXjs.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-BOTSDODZ.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 _chunkOISK62WXjs = require('./chunk-OISK62WX.js');var i=_chunkOISK62WXjs.a.vite,p= exports.NativeFederationTypeScriptHost =_chunkOISK62WXjs.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-BOTSDODZ.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 _chunkOISK62WXjs = require('./chunk-OISK62WX.js');var a=_chunkOISK62WXjs.a.webpack,r= exports.NativeFederationTypeScriptHost =_chunkOISK62WXjs.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-BOTSDODZ.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.5",
3
+ "version": "0.3.0",
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.0.1",
59
+ "unplugin": "^1.6.0"
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,91 +0,0 @@
1
- # Changelog
2
-
3
- This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
-
5
- ## [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)
6
-
7
-
8
-
9
- ## [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)
10
-
11
-
12
-
13
- ## [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)
14
-
15
-
16
-
17
- ## [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)
18
-
19
-
20
- ### Bug Fixes
21
-
22
- * .at(-1) ([8dd0520](https://github.com/module-federation/nextjs-mf/commit/8dd0520b5464c49e89c63307c5388450e4bebbf8))
23
-
24
-
25
-
26
- ## [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)
27
-
28
-
29
- ### Bug Fixes
30
-
31
- * [#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))
32
- * downgrade next to v13.3.1 ([0032452](https://github.com/module-federation/nextjs-mf/commit/0032452980c70b211b6c04332326b7973f7c8446))
33
- * removed lock ([82f578e](https://github.com/module-federation/nextjs-mf/commit/82f578e713734f7f6b06e09b794fab4f66af248a))
34
-
35
-
36
-
37
- # [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)
38
-
39
-
40
- ### Bug Fixes
41
-
42
- * removed any from error logger type ([fb9fcc3](https://github.com/module-federation/nextjs-mf/commit/fb9fcc3a54a13be36335830f076a86557b75bb4a))
43
- * subpath ([1548501](https://github.com/module-federation/nextjs-mf/commit/1548501bb4679c0c534c02609cb6bc5459f224a4))
44
- * subpath ([aaad665](https://github.com/module-federation/nextjs-mf/commit/aaad665307d80b49ee19496a5b8b400df243558e))
45
-
46
-
47
- ### Features
48
-
49
- * 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))
50
-
51
-
52
-
53
- ## [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)
54
-
55
-
56
- ### Bug Fixes
57
-
58
- * native build chunks ([d6c9f8a](https://github.com/module-federation/nextjs-mf/commit/d6c9f8a957ed00a8d92332ccc38ed9780f01d54e))
59
-
60
-
61
- ### Reverts
62
-
63
- * Revert "chore(native-federation-typescript): release version 0.1.1" ([91786df](https://github.com/module-federation/nextjs-mf/commit/91786df726e5c078ed78e745b6b105e11bd2e39b))
64
- * Revert "chore(native-federation-typescript): release version 0.1.1" ([097f188](https://github.com/module-federation/nextjs-mf/commit/097f188458835457a2713d98bf3eaf291d5ad102))
65
-
66
-
67
-
68
- # 0.1.0 (2023-04-05)
69
-
70
-
71
- ### Bug Fixes
72
-
73
- * build ([d0b2f72](https://github.com/module-federation/nextjs-mf/commit/d0b2f72f4fc3647825412be1574311c3152cf167))
74
- * build step ([a217170](https://github.com/module-federation/nextjs-mf/commit/a21717096cbc09bff20d3aeebfea2f3533afb0d7))
75
- * compiler instance ([e5c249d](https://github.com/module-federation/nextjs-mf/commit/e5c249d41d68339886268337654ff47b31b06a3a))
76
- * deps ([a378441](https://github.com/module-federation/nextjs-mf/commit/a37844194a3f189cc5863bbdd4776259bce69fa4))
77
- * dirtree tests ([5cb49fd](https://github.com/module-federation/nextjs-mf/commit/5cb49fd1c6520311a7d2e7d2b37a93389a500715))
78
- * eslintrc ([0f69dee](https://github.com/module-federation/nextjs-mf/commit/0f69dee253c2c608b2367d545c7d4a57ad0c2ca5))
79
- * format ([25fb765](https://github.com/module-federation/nextjs-mf/commit/25fb7659481287a791e9de4fe839e980dbf06968))
80
- * readme ([eaca0b3](https://github.com/module-federation/nextjs-mf/commit/eaca0b311d3b8d9e73309cb92d9a9488f9fc23c0))
81
- * readme ([fc0e5dc](https://github.com/module-federation/nextjs-mf/commit/fc0e5dc26e617664224e1c10548b151a44f8dff9))
82
- * README.md ([9159171](https://github.com/module-federation/nextjs-mf/commit/91591712e9a103fff351f0a168c149470c0d69ad))
83
- * remove changelog ([724918e](https://github.com/module-federation/nextjs-mf/commit/724918ebf888297689b6ed700bd14ec01fd1ef35))
84
- * ts build ([9ed3a52](https://github.com/module-federation/nextjs-mf/commit/9ed3a527d0ba903b6cfa6023a7ad5da63781970c))
85
-
86
-
87
- ### Features
88
-
89
- * federated tests plugin ([063ab33](https://github.com/module-federation/nextjs-mf/commit/063ab336c4830aff4f5bd3b9894df60b4651a9be))
90
- * native-federation-typescript plugin ([#692](https://github.com/module-federation/nextjs-mf/issues/692)) ([b41c5aa](https://github.com/module-federation/nextjs-mf/commit/b41c5aacfeda0fada5b426086658235edfd86cdd))
91
- * 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;