@vercel/microfrontends 0.14.0 → 0.15.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.
Files changed (121) hide show
  1. package/dist/bin/cli.cjs +377 -1626
  2. package/dist/config.cjs +460 -1004
  3. package/dist/config.cjs.map +1 -1
  4. package/dist/config.d.ts +4 -25
  5. package/dist/config.js +456 -983
  6. package/dist/config.js.map +1 -1
  7. package/dist/{v2/microfrontends → microfrontends}/server.cjs +63 -143
  8. package/dist/microfrontends/server.cjs.map +1 -0
  9. package/dist/{v2/microfrontends → microfrontends}/server.d.ts +4 -4
  10. package/dist/{v2/microfrontends → microfrontends}/server.js +63 -143
  11. package/dist/microfrontends/server.js.map +1 -0
  12. package/dist/{v2/microfrontends.cjs → microfrontends.cjs} +21 -21
  13. package/dist/microfrontends.cjs.map +1 -0
  14. package/dist/{v2/microfrontends.d.ts → microfrontends.d.ts} +4 -4
  15. package/dist/{v2/microfrontends.js → microfrontends.js} +20 -20
  16. package/dist/microfrontends.js.map +1 -0
  17. package/dist/next/client.cjs +1 -1
  18. package/dist/next/client.cjs.map +1 -1
  19. package/dist/next/client.js +1 -1
  20. package/dist/next/client.js.map +1 -1
  21. package/dist/next/config.cjs +1323 -1024
  22. package/dist/next/config.cjs.map +1 -1
  23. package/dist/next/config.d.ts +1 -1
  24. package/dist/next/config.js +1327 -1028
  25. package/dist/next/config.js.map +1 -1
  26. package/dist/next/endpoints.cjs +77 -18
  27. package/dist/next/endpoints.cjs.map +1 -1
  28. package/dist/next/endpoints.d.ts +13 -2
  29. package/dist/next/endpoints.js +77 -18
  30. package/dist/next/endpoints.js.map +1 -1
  31. package/dist/next/middleware.cjs +745 -396
  32. package/dist/next/middleware.cjs.map +1 -1
  33. package/dist/next/middleware.d.ts +10 -5
  34. package/dist/next/middleware.js +745 -396
  35. package/dist/next/middleware.js.map +1 -1
  36. package/dist/next/testing.cjs +595 -1032
  37. package/dist/next/testing.cjs.map +1 -1
  38. package/dist/next/testing.d.ts +14 -12
  39. package/dist/next/testing.js +589 -1016
  40. package/dist/next/testing.js.map +1 -1
  41. package/dist/overrides.cjs +40 -108
  42. package/dist/overrides.cjs.map +1 -1
  43. package/dist/overrides.d.ts +24 -2
  44. package/dist/overrides.js +36 -106
  45. package/dist/overrides.js.map +1 -1
  46. package/dist/{v2/routing.cjs → routing.cjs} +3 -3
  47. package/dist/routing.cjs.map +1 -0
  48. package/dist/{v2/schema.cjs → schema.cjs} +1 -1
  49. package/dist/schema.cjs.map +1 -0
  50. package/dist/schema.d.ts +1 -0
  51. package/dist/utils/mfe-port.cjs +211 -1333
  52. package/dist/utils/mfe-port.cjs.map +1 -1
  53. package/dist/utils/mfe-port.js +204 -1326
  54. package/dist/utils/mfe-port.js.map +1 -1
  55. package/dist/validation.cjs +31 -361
  56. package/dist/validation.cjs.map +1 -1
  57. package/dist/validation.d.ts +3 -146
  58. package/dist/validation.js +30 -359
  59. package/dist/validation.js.map +1 -1
  60. package/package.json +29 -92
  61. package/schema/schema.json +174 -244
  62. package/dist/config/client.cjs +0 -54
  63. package/dist/config/client.cjs.map +0 -1
  64. package/dist/config/client.d.ts +0 -23
  65. package/dist/config/client.js +0 -28
  66. package/dist/config/client.js.map +0 -1
  67. package/dist/config/edge.cjs +0 -508
  68. package/dist/config/edge.cjs.map +0 -1
  69. package/dist/config/edge.d.ts +0 -20
  70. package/dist/config/edge.js +0 -481
  71. package/dist/config/edge.js.map +0 -1
  72. package/dist/microfrontend-config-983a5139.d.ts +0 -154
  73. package/dist/schema-2922d49e.d.ts +0 -182
  74. package/dist/v2/config.cjs +0 -709
  75. package/dist/v2/config.cjs.map +0 -1
  76. package/dist/v2/config.d.ts +0 -4
  77. package/dist/v2/config.js +0 -684
  78. package/dist/v2/config.js.map +0 -1
  79. package/dist/v2/microfrontends/server.cjs.map +0 -1
  80. package/dist/v2/microfrontends/server.js.map +0 -1
  81. package/dist/v2/microfrontends.cjs.map +0 -1
  82. package/dist/v2/microfrontends.js.map +0 -1
  83. package/dist/v2/next/client.cjs +0 -3
  84. package/dist/v2/next/client.cjs.map +0 -1
  85. package/dist/v2/next/client.d.ts +0 -45
  86. package/dist/v2/next/client.js +0 -3
  87. package/dist/v2/next/client.js.map +0 -1
  88. package/dist/v2/next/config.cjs +0 -2178
  89. package/dist/v2/next/config.cjs.map +0 -1
  90. package/dist/v2/next/config.d.ts +0 -22
  91. package/dist/v2/next/config.js +0 -2143
  92. package/dist/v2/next/config.js.map +0 -1
  93. package/dist/v2/next/endpoints.cjs +0 -141
  94. package/dist/v2/next/endpoints.cjs.map +0 -1
  95. package/dist/v2/next/endpoints.d.ts +0 -26
  96. package/dist/v2/next/endpoints.js +0 -116
  97. package/dist/v2/next/endpoints.js.map +0 -1
  98. package/dist/v2/next/middleware.cjs +0 -1099
  99. package/dist/v2/next/middleware.cjs.map +0 -1
  100. package/dist/v2/next/middleware.d.ts +0 -34
  101. package/dist/v2/next/middleware.js +0 -1071
  102. package/dist/v2/next/middleware.js.map +0 -1
  103. package/dist/v2/next/testing.cjs +0 -992
  104. package/dist/v2/next/testing.cjs.map +0 -1
  105. package/dist/v2/next/testing.d.ts +0 -55
  106. package/dist/v2/next/testing.js +0 -961
  107. package/dist/v2/next/testing.js.map +0 -1
  108. package/dist/v2/overrides.cjs +0 -75
  109. package/dist/v2/overrides.cjs.map +0 -1
  110. package/dist/v2/overrides.d.ts +0 -24
  111. package/dist/v2/overrides.js +0 -45
  112. package/dist/v2/overrides.js.map +0 -1
  113. package/dist/v2/routing.cjs.map +0 -1
  114. package/dist/v2/schema.cjs.map +0 -1
  115. package/dist/v2/schema.d.ts +0 -1
  116. package/schema/schema-v2.json +0 -266
  117. /package/dist/{v2/routing.d.ts → routing.d.ts} +0 -0
  118. /package/dist/{v2/routing.js → routing.js} +0 -0
  119. /package/dist/{v2/routing.js.map → routing.js.map} +0 -0
  120. /package/dist/{v2/schema.js → schema.js} +0 -0
  121. /package/dist/{v2/schema.js.map → schema.js.map} +0 -0
@@ -3,346 +3,276 @@
3
3
  "$ref": "#/definitions/Config",
4
4
  "definitions": {
5
5
  "Config": {
6
+ "anyOf": [
7
+ {
8
+ "$ref": "#/definitions/MainConfig"
9
+ },
10
+ {
11
+ "$ref": "#/definitions/ChildConfig"
12
+ }
13
+ ]
14
+ },
15
+ "MainConfig": {
6
16
  "type": "object",
7
17
  "properties": {
8
- "version": {
9
- "type": "string"
10
- },
11
18
  "$schema": {
12
19
  "type": "string"
13
20
  },
14
- "name": {
21
+ "version": {
15
22
  "type": "string",
16
- "description": "Name for the micro-frontend site (eg. \"vercel.com\", \"vercel-site\" etc.)."
17
- },
18
- "applications": {
19
- "$ref": "#/definitions/ApplicationConfigsById"
23
+ "const": "2"
20
24
  },
21
25
  "options": {
22
- "$ref": "#/definitions/Options",
23
- "description": "Optional configuration for the entire micro-frontends setup."
26
+ "$ref": "#/definitions/Options"
27
+ },
28
+ "remotes": {
29
+ "type": "object",
30
+ "additionalProperties": {
31
+ "$ref": "#/definitions/Application"
32
+ },
33
+ "description": "Applications that only serve a subset of the microfrontend routes only need to reference the name of the primary application that owns the full microfrontends configuration."
34
+ },
35
+ "applications": {
36
+ "$ref": "#/definitions/ApplicationRouting",
37
+ "description": "Mapping of application names to the routes that they host. Only needs to be defined in the application that owns the primary microfrontend domain"
24
38
  }
25
39
  },
26
40
  "required": [
27
- "version",
28
- "applications"
41
+ "applications",
42
+ "version"
29
43
  ],
30
- "description": "Configuration for micro-frontend applications\n\nTODO: Add proxy configuration"
44
+ "additionalProperties": false
31
45
  },
32
- "ApplicationConfigsById": {
46
+ "Options": {
33
47
  "type": "object",
34
- "additionalProperties": {
35
- "$ref": "#/definitions/ApplicationConfig"
36
- }
48
+ "properties": {
49
+ "vercel": {
50
+ "$ref": "#/definitions/VercelOptions",
51
+ "description": "Micro-Frontends wide options for Vercel."
52
+ },
53
+ "localProxy": {
54
+ "$ref": "#/definitions/LocalProxyOptions",
55
+ "description": "Options for local proxy."
56
+ }
57
+ },
58
+ "additionalProperties": false
59
+ },
60
+ "VercelOptions": {
61
+ "type": "object",
62
+ "properties": {
63
+ "teamSlug": {
64
+ "type": "string",
65
+ "description": "Team slug for the Vercel team"
66
+ },
67
+ "disableOverrides": {
68
+ "type": "boolean",
69
+ "description": "If you want to disable the overrides for the site. For example, if you are managing rewrites between applications externally, you may wish to disable the overrides on the toolbar as they will have no effect."
70
+ }
71
+ },
72
+ "additionalProperties": false
73
+ },
74
+ "LocalProxyOptions": {
75
+ "type": "object",
76
+ "properties": {
77
+ "port": {
78
+ "type": "number",
79
+ "description": "The port number used by the local proxy server.\n\nThe default is `3024`."
80
+ }
81
+ },
82
+ "additionalProperties": false
37
83
  },
38
- "ApplicationConfig": {
84
+ "Application": {
39
85
  "anyOf": [
40
86
  {
41
- "$ref": "#/definitions/DefaultApplicationConfig"
87
+ "$ref": "#/definitions/DefaultApplication"
42
88
  },
43
89
  {
44
- "$ref": "#/definitions/CommonApplicationConfig"
90
+ "$ref": "#/definitions/ChildApplication"
45
91
  }
46
- ],
47
- "description": "A Micro-Frontend Deployment Target"
92
+ ]
48
93
  },
49
- "DefaultApplicationConfig": {
94
+ "DefaultApplication": {
50
95
  "type": "object",
51
96
  "properties": {
52
- "default": {
53
- "type": "boolean",
54
- "const": true,
55
- "description": "The default application is used no other application is matched via the routing config"
56
- },
57
- "routing": {
58
- "$ref": "#/definitions/Routing"
97
+ "vercel": {
98
+ "$ref": "#/definitions/Vercel"
59
99
  },
60
100
  "development": {
61
- "type": "object",
62
- "properties": {
63
- "local": {
64
- "$ref": "#/definitions/HostConfig"
65
- },
66
- "fallback": {
67
- "$ref": "#/definitions/HostConfig",
68
- "description": "Fallback for local development, could be a host config that points to any environment. If this is not provided, or the application is not running - requests to the application in local development will error."
69
- },
70
- "task": {
71
- "type": "string",
72
- "description": "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
73
- }
74
- },
75
- "required": [
76
- "local"
77
- ]
101
+ "$ref": "#/definitions/Development"
78
102
  },
79
103
  "production": {
80
104
  "$ref": "#/definitions/HostConfig"
81
- },
82
- "metadata": {
83
- "type": "object",
84
- "additionalProperties": {
85
- "type": "string"
86
- }
87
- },
88
- "federation": {
89
- "type": "object",
90
- "properties": {
91
- "exposes": {
92
- "type": "array",
93
- "items": {
94
- "type": "object",
95
- "properties": {
96
- "name": {
97
- "type": "string",
98
- "description": "The name of the module - should be used when importing the module from another application"
99
- },
100
- "path": {
101
- "type": "string",
102
- "description": "Relative path to the module within its `application`"
103
- }
104
- },
105
- "required": [
106
- "name",
107
- "path"
108
- ]
109
- },
110
- "description": "Modules that are exposed by this application"
111
- },
112
- "uses": {
113
- "type": "array",
114
- "items": {
115
- "type": "string"
116
- },
117
- "description": "Modules that are used by this application. Only the name of the module is required."
118
- }
119
- }
120
- },
121
- "vercel": {
122
- "$ref": "#/definitions/Vercel"
123
105
  }
124
106
  },
125
107
  "required": [
126
- "default",
127
- "development",
128
108
  "production"
129
- ]
109
+ ],
110
+ "additionalProperties": false
130
111
  },
131
- "Routing": {
112
+ "Vercel": {
132
113
  "type": "object",
133
114
  "properties": {
134
- "assetPrefix": {
115
+ "projectId": {
135
116
  "type": "string",
136
- "description": "[assetPrefix] for the application"
137
- },
138
- "matches": {
139
- "type": "array",
140
- "items": {
141
- "$ref": "#/definitions/PathGroup"
142
- },
143
- "description": "Path expressions that are routed to this application."
117
+ "description": "Vercel project ID"
144
118
  }
145
119
  },
146
120
  "required": [
147
- "matches"
148
- ]
121
+ "projectId"
122
+ ],
123
+ "additionalProperties": false
149
124
  },
150
- "PathGroup": {
125
+ "Development": {
151
126
  "type": "object",
152
127
  "properties": {
153
- "group": {
154
- "type": "string",
155
- "description": "Optional group name for the paths"
128
+ "local": {
129
+ "$ref": "#/definitions/LocalHostConfig"
156
130
  },
157
- "options": {
158
- "type": "object",
159
- "properties": {
160
- "flag": {
161
- "type": "string",
162
- "description": "flag name that can be used to enable/disable all paths in the group"
163
- }
164
- }
131
+ "fallback": {
132
+ "$ref": "#/definitions/HostConfig",
133
+ "description": "Fallback for local development, could be a host config that points to any environment. If this is not provided, or the application is not running - requests to the application in local development will error."
165
134
  },
166
- "paths": {
167
- "type": "array",
168
- "items": {
169
- "type": "string"
170
- }
135
+ "task": {
136
+ "type": "string",
137
+ "description": "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
171
138
  }
172
139
  },
173
- "required": [
174
- "paths"
175
- ]
140
+ "additionalProperties": false
176
141
  },
177
- "HostConfig": {
142
+ "LocalHostConfig": {
178
143
  "type": "object",
144
+ "additionalProperties": false,
179
145
  "properties": {
146
+ "host": {
147
+ "type": "string",
148
+ "description": "The hostname or IP address of the server. This can be a domain name (e.g., `example.com`) or an IP address (e.g., `192.168.1.1`)."
149
+ },
180
150
  "protocol": {
181
151
  "type": "string",
182
152
  "enum": [
183
153
  "http",
184
154
  "https"
185
155
  ],
186
- "description": "The protocol to be used for the connection.\n- `http`: Hypertext Transfer Protocol (HTTP).\n- `https`: Secure Hypertext Transfer Protocol (HTTPS).\n\n* @defaultValue \"https\""
187
- },
188
- "host": {
189
- "type": "string",
190
- "description": "The hostname or IP address of the server. This can be a domain name (e.g., `example.com`) or an IP address (e.g., `192.168.1.1`)."
156
+ "description": "The protocol to be used for the connection.\n- `http`: Hypertext Transfer Protocol (HTTP).\n- `https`: Secure Hypertext Transfer Protocol (HTTPS).\n\n* @defaultValue \"http\" for local development, \"https\" for otherwise"
191
157
  },
192
158
  "port": {
193
159
  "type": "number",
194
- "description": "The port number to be used for the connection. Common values include `80` for HTTP and `443` for HTTPS.\n\nThis field is optional and can be omitted if the default ports for the specified protocol are used"
160
+ "description": "The port number to be used for the connection. Common values include `80` for HTTP and `443` for HTTPS."
195
161
  }
196
- },
197
- "required": [
198
- "host"
199
- ]
162
+ }
200
163
  },
201
- "Vercel": {
164
+ "HostConfig": {
202
165
  "type": "object",
203
166
  "properties": {
204
- "projectId": {
205
- "type": "string",
206
- "description": "Vercel project ID"
207
- },
208
- "projectName": {
167
+ "protocol": {
209
168
  "type": "string",
210
- "description": "Vercel project name (temporary until we can use project ID)"
169
+ "enum": [
170
+ "http",
171
+ "https"
172
+ ],
173
+ "description": "The protocol to be used for the connection.\n- `http`: Hypertext Transfer Protocol (HTTP).\n- `https`: Secure Hypertext Transfer Protocol (HTTPS).\n\n* @defaultValue \"http\" for local development, \"https\" for otherwise"
211
174
  },
212
- "defaultRoute": {
175
+ "host": {
213
176
  "type": "string",
214
- "description": "The default route for the application. Used to render screenshots, favicons, and provide direct zone links"
177
+ "description": "The hostname or IP address of the server. This can be a domain name (e.g., `example.com`) or an IP address (e.g., `192.168.1.1`)."
215
178
  },
216
- "routeSpeedInsightsToDefaultZone": {
217
- "type": "boolean",
218
- "description": "Whether to route Speed Insights to the default zone or each individual microfrontend."
179
+ "port": {
180
+ "type": "number",
181
+ "description": "The port number to be used for the connection. Common values include `80` for HTTP and `443` for HTTPS."
219
182
  }
220
183
  },
221
184
  "required": [
222
- "projectId"
223
- ]
185
+ "host"
186
+ ],
187
+ "additionalProperties": false
224
188
  },
225
- "CommonApplicationConfig": {
189
+ "ChildApplication": {
226
190
  "type": "object",
227
191
  "properties": {
228
- "default": {
229
- "type": "boolean",
230
- "const": false,
231
- "description": "The default application is used no other application is matched via the routing config"
232
- },
233
- "routing": {
234
- "$ref": "#/definitions/Routing"
192
+ "vercel": {
193
+ "$ref": "#/definitions/Vercel"
235
194
  },
236
195
  "development": {
237
- "type": "object",
238
- "properties": {
239
- "local": {
240
- "$ref": "#/definitions/HostConfig"
241
- },
242
- "fallback": {
243
- "$ref": "#/definitions/HostConfig",
244
- "description": "Fallback for local development, could be a host config that points to any environment. If this is not provided, or the application is not running - requests to the application in local development will error."
245
- },
246
- "task": {
247
- "type": "string",
248
- "description": "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
249
- }
250
- },
251
- "required": [
252
- "local"
253
- ]
196
+ "$ref": "#/definitions/Development"
197
+ },
198
+ "routing": {
199
+ "$ref": "#/definitions/Routing",
200
+ "description": "Groups of path expressions that are routed to this application."
254
201
  },
255
202
  "production": {
256
203
  "$ref": "#/definitions/HostConfig"
257
- },
258
- "metadata": {
259
- "type": "object",
260
- "additionalProperties": {
261
- "type": "string"
262
- }
263
- },
264
- "federation": {
265
- "type": "object",
266
- "properties": {
267
- "exposes": {
268
- "type": "array",
269
- "items": {
270
- "type": "object",
271
- "properties": {
272
- "name": {
273
- "type": "string",
274
- "description": "The name of the module - should be used when importing the module from another application"
275
- },
276
- "path": {
277
- "type": "string",
278
- "description": "Relative path to the module within its `application`"
279
- }
280
- },
281
- "required": [
282
- "name",
283
- "path"
284
- ]
285
- },
286
- "description": "Modules that are exposed by this application"
287
- },
288
- "uses": {
289
- "type": "array",
290
- "items": {
291
- "type": "string"
292
- },
293
- "description": "Modules that are used by this application. Only the name of the module is required."
294
- }
295
- }
296
- },
297
- "vercel": {
298
- "$ref": "#/definitions/Vercel"
299
204
  }
300
205
  },
301
206
  "required": [
302
- "default",
303
- "development",
304
- "production",
305
207
  "routing"
306
- ]
208
+ ],
209
+ "additionalProperties": false
307
210
  },
308
- "Options": {
309
- "type": "object",
310
- "properties": {
311
- "vercel": {
312
- "$ref": "#/definitions/VercelOptions",
313
- "description": "Micro-Frontends wide options for Vercel."
314
- },
315
- "localProxy": {
316
- "$ref": "#/definitions/LocalProxyOptions",
317
- "description": "Options for local proxy."
318
- }
211
+ "Routing": {
212
+ "type": "array",
213
+ "items": {
214
+ "$ref": "#/definitions/PathGroup"
319
215
  }
320
216
  },
321
- "VercelOptions": {
217
+ "PathGroup": {
322
218
  "type": "object",
323
219
  "properties": {
324
- "previewDeploymentSuffix": {
220
+ "group": {
325
221
  "type": "string",
326
- "description": "If your team uses a custom Preview Deployment Suffix, please specify it here. See https://vercel.com/docs/deployments/preview-deployment-suffix. The default is `vercel.app`."
222
+ "description": "Optional group name for the paths"
327
223
  },
328
- "teamSlug": {
224
+ "flag": {
329
225
  "type": "string",
330
- "description": "Team slug for the Vercel team"
226
+ "description": "flag name that can be used to enable/disable all paths in the group"
331
227
  },
332
- "disableOverrides": {
333
- "type": "boolean",
334
- "description": "If you want to disable the overrides for the site. For example, if you are managing rewrites between applications externally, you may wish to disable the overrides on the toolbar as they will have no effect."
228
+ "paths": {
229
+ "type": "array",
230
+ "items": {
231
+ "type": "string"
232
+ }
335
233
  }
234
+ },
235
+ "required": [
236
+ "paths"
237
+ ],
238
+ "additionalProperties": false
239
+ },
240
+ "ApplicationRouting": {
241
+ "type": "object",
242
+ "additionalProperties": {
243
+ "$ref": "#/definitions/Application"
336
244
  }
337
245
  },
338
- "LocalProxyOptions": {
246
+ "ChildConfig": {
339
247
  "type": "object",
340
248
  "properties": {
341
- "port": {
342
- "type": "number",
343
- "description": "The port number used by the local proxy server.\n\nThe default is `3024`."
249
+ "$schema": {
250
+ "type": "string"
251
+ },
252
+ "version": {
253
+ "type": "string",
254
+ "const": "2"
255
+ },
256
+ "options": {
257
+ "$ref": "#/definitions/Options"
258
+ },
259
+ "remotes": {
260
+ "type": "object",
261
+ "additionalProperties": {
262
+ "$ref": "#/definitions/Application"
263
+ },
264
+ "description": "Applications that only serve a subset of the microfrontend routes only need to reference the name of the primary application that owns the full microfrontends configuration."
265
+ },
266
+ "partOf": {
267
+ "type": "string",
268
+ "description": "Applications that only serve a subset of the microfrontend routes only need to reference the name of the primary application that owns the full microfrontends configuration."
344
269
  }
345
- }
270
+ },
271
+ "required": [
272
+ "partOf",
273
+ "version"
274
+ ],
275
+ "additionalProperties": false
346
276
  }
347
277
  }
348
278
  }
@@ -1,54 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/config/client/client-config.ts
21
- var client_config_exports = {};
22
- __export(client_config_exports, {
23
- getClientConfigFromEnv: () => getClientConfigFromEnv,
24
- getConfigForClient: () => getConfigForClient
25
- });
26
- module.exports = __toCommonJS(client_config_exports);
27
- function getConfigForClient(config) {
28
- return {
29
- applications: Object.fromEntries(
30
- Object.entries(config.applications).map(([name, application]) => [
31
- name,
32
- {
33
- default: application.default,
34
- routing: application.routing
35
- }
36
- ])
37
- )
38
- };
39
- }
40
- function getClientConfigFromEnv() {
41
- const clientConfigJson = process.env.NEXT_PUBLIC_MFE_CLIENT_CONFIG;
42
- if (!clientConfigJson) {
43
- throw new Error(
44
- "Could not find client micro-frontends config in the environment"
45
- );
46
- }
47
- return JSON.parse(clientConfigJson);
48
- }
49
- // Annotate the CommonJS export names for ESM import in node:
50
- 0 && (module.exports = {
51
- getClientConfigFromEnv,
52
- getConfigForClient
53
- });
54
- //# sourceMappingURL=client.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/config/client/client-config.ts"],"sourcesContent":["import type { Config } from '../schema';\nimport type { ClientConfig, WellKnownClientData } from './types';\n\n/**\n * Given a micro-frontends configuration, this returns a version that is\n * acceptable to be used client-side without leaking any information.\n */\nexport function getConfigForClient(config: Config): ClientConfig {\n return {\n applications: Object.fromEntries(\n Object.entries(config.applications).map(([name, application]) => [\n name,\n {\n default: application.default,\n routing: application.routing,\n },\n ]),\n ),\n };\n}\n\nexport function getClientConfigFromEnv(): ClientConfig {\n // This has to use the actual name rather than the constant variable in order\n // for the env var to be replaced during the build correctly.\n const clientConfigJson = process.env.NEXT_PUBLIC_MFE_CLIENT_CONFIG;\n if (!clientConfigJson) {\n throw new Error(\n 'Could not find client micro-frontends config in the environment',\n );\n }\n return JSON.parse(clientConfigJson) as ClientConfig;\n}\n\nexport type { ClientConfig, WellKnownClientData };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,SAAS,mBAAmB,QAA8B;AAC/D,SAAO;AAAA,IACL,cAAc,OAAO;AAAA,MACnB,OAAO,QAAQ,OAAO,YAAY,EAAE,IAAI,CAAC,CAAC,MAAM,WAAW,MAAM;AAAA,QAC/D;AAAA,QACA;AAAA,UACE,SAAS,YAAY;AAAA,UACrB,SAAS,YAAY;AAAA,QACvB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEO,SAAS,yBAAuC;AAGrD,QAAM,mBAAmB,QAAQ,IAAI;AACrC,MAAI,CAAC,kBAAkB;AACrB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO,KAAK,MAAM,gBAAgB;AACpC;","names":[]}
@@ -1,23 +0,0 @@
1
- import { A as ApplicationConfig, C as Config } from '../schema-2922d49e.js';
2
-
3
- type ClientApplicationConfig = Pick<ApplicationConfig, 'default' | 'routing'>;
4
- interface ClientConfig {
5
- applications: Record<string, ClientApplicationConfig>;
6
- }
7
- /**
8
- * Data that is returned from the `.well-known/vercel/microfrontends/client-config`
9
- * endpoint that is used by the client to ensure that navigations and prefetches
10
- * are routed correctly.
11
- */
12
- interface WellKnownClientData {
13
- config: ClientConfig;
14
- }
15
-
16
- /**
17
- * Given a micro-frontends configuration, this returns a version that is
18
- * acceptable to be used client-side without leaking any information.
19
- */
20
- declare function getConfigForClient(config: Config): ClientConfig;
21
- declare function getClientConfigFromEnv(): ClientConfig;
22
-
23
- export { ClientConfig, WellKnownClientData, getClientConfigFromEnv, getConfigForClient };
@@ -1,28 +0,0 @@
1
- // src/config/client/client-config.ts
2
- function getConfigForClient(config) {
3
- return {
4
- applications: Object.fromEntries(
5
- Object.entries(config.applications).map(([name, application]) => [
6
- name,
7
- {
8
- default: application.default,
9
- routing: application.routing
10
- }
11
- ])
12
- )
13
- };
14
- }
15
- function getClientConfigFromEnv() {
16
- const clientConfigJson = process.env.NEXT_PUBLIC_MFE_CLIENT_CONFIG;
17
- if (!clientConfigJson) {
18
- throw new Error(
19
- "Could not find client micro-frontends config in the environment"
20
- );
21
- }
22
- return JSON.parse(clientConfigJson);
23
- }
24
- export {
25
- getClientConfigFromEnv,
26
- getConfigForClient
27
- };
28
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/config/client/client-config.ts"],"sourcesContent":["import type { Config } from '../schema';\nimport type { ClientConfig, WellKnownClientData } from './types';\n\n/**\n * Given a micro-frontends configuration, this returns a version that is\n * acceptable to be used client-side without leaking any information.\n */\nexport function getConfigForClient(config: Config): ClientConfig {\n return {\n applications: Object.fromEntries(\n Object.entries(config.applications).map(([name, application]) => [\n name,\n {\n default: application.default,\n routing: application.routing,\n },\n ]),\n ),\n };\n}\n\nexport function getClientConfigFromEnv(): ClientConfig {\n // This has to use the actual name rather than the constant variable in order\n // for the env var to be replaced during the build correctly.\n const clientConfigJson = process.env.NEXT_PUBLIC_MFE_CLIENT_CONFIG;\n if (!clientConfigJson) {\n throw new Error(\n 'Could not find client micro-frontends config in the environment',\n );\n }\n return JSON.parse(clientConfigJson) as ClientConfig;\n}\n\nexport type { ClientConfig, WellKnownClientData };\n"],"mappings":";AAOO,SAAS,mBAAmB,QAA8B;AAC/D,SAAO;AAAA,IACL,cAAc,OAAO;AAAA,MACnB,OAAO,QAAQ,OAAO,YAAY,EAAE,IAAI,CAAC,CAAC,MAAM,WAAW,MAAM;AAAA,QAC/D;AAAA,QACA;AAAA,UACE,SAAS,YAAY;AAAA,UACrB,SAAS,YAAY;AAAA,QACvB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEO,SAAS,yBAAuC;AAGrD,QAAM,mBAAmB,QAAQ,IAAI;AACrC,MAAI,CAAC,kBAAkB;AACrB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO,KAAK,MAAM,gBAAgB;AACpC;","names":[]}