@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
@@ -20,12 +20,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/schema/validation.ts
21
21
  var validation_exports = {};
22
22
  __export(validation_exports, {
23
- validateV1Schema: () => validateSchema2,
24
- validateV2Schema: () => validateSchema
23
+ validateSchema: () => validateSchema
25
24
  });
26
25
  module.exports = __toCommonJS(validation_exports);
27
26
 
28
- // src/config-v2/microfrontends/server/validation.ts
27
+ // src/config/microfrontends/server/validation.ts
29
28
  var import_jsonc_parser = require("jsonc-parser");
30
29
  var import_ajv = require("ajv");
31
30
 
@@ -121,8 +120,8 @@ var MicrofrontendError = class extends Error {
121
120
  }
122
121
  };
123
122
 
124
- // schema/schema-v2.json
125
- var schema_v2_default = {
123
+ // schema/schema.json
124
+ var schema_default = {
126
125
  $schema: "http://json-schema.org/draft-07/schema#",
127
126
  $ref: "#/definitions/Config",
128
127
  definitions: {
@@ -161,7 +160,8 @@ var schema_v2_default = {
161
160
  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"
162
161
  }
163
162
  },
164
- required: ["applications", "version"]
163
+ required: ["applications", "version"],
164
+ additionalProperties: false
165
165
  },
166
166
  Options: {
167
167
  type: "object",
@@ -174,7 +174,8 @@ var schema_v2_default = {
174
174
  $ref: "#/definitions/LocalProxyOptions",
175
175
  description: "Options for local proxy."
176
176
  }
177
- }
177
+ },
178
+ additionalProperties: false
178
179
  },
179
180
  VercelOptions: {
180
181
  type: "object",
@@ -187,7 +188,8 @@ var schema_v2_default = {
187
188
  type: "boolean",
188
189
  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."
189
190
  }
190
- }
191
+ },
192
+ additionalProperties: false
191
193
  },
192
194
  LocalProxyOptions: {
193
195
  type: "object",
@@ -196,7 +198,8 @@ var schema_v2_default = {
196
198
  type: "number",
197
199
  description: "The port number used by the local proxy server.\n\nThe default is `3024`."
198
200
  }
199
- }
201
+ },
202
+ additionalProperties: false
200
203
  },
201
204
  Application: {
202
205
  anyOf: [
@@ -221,7 +224,8 @@ var schema_v2_default = {
221
224
  $ref: "#/definitions/HostConfig"
222
225
  }
223
226
  },
224
- required: ["production"]
227
+ required: ["production"],
228
+ additionalProperties: false
225
229
  },
226
230
  Vercel: {
227
231
  type: "object",
@@ -231,7 +235,8 @@ var schema_v2_default = {
231
235
  description: "Vercel project ID"
232
236
  }
233
237
  },
234
- required: ["projectId"]
238
+ required: ["projectId"],
239
+ additionalProperties: false
235
240
  },
236
241
  Development: {
237
242
  type: "object",
@@ -247,10 +252,12 @@ var schema_v2_default = {
247
252
  type: "string",
248
253
  description: "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
249
254
  }
250
- }
255
+ },
256
+ additionalProperties: false
251
257
  },
252
258
  LocalHostConfig: {
253
259
  type: "object",
260
+ additionalProperties: false,
254
261
  properties: {
255
262
  host: {
256
263
  type: "string",
@@ -284,7 +291,8 @@ var schema_v2_default = {
284
291
  description: "The port number to be used for the connection. Common values include `80` for HTTP and `443` for HTTPS."
285
292
  }
286
293
  },
287
- required: ["host"]
294
+ required: ["host"],
295
+ additionalProperties: false
288
296
  },
289
297
  ChildApplication: {
290
298
  type: "object",
@@ -303,7 +311,8 @@ var schema_v2_default = {
303
311
  $ref: "#/definitions/HostConfig"
304
312
  }
305
313
  },
306
- required: ["routing"]
314
+ required: ["routing"],
315
+ additionalProperties: false
307
316
  },
308
317
  Routing: {
309
318
  type: "array",
@@ -329,7 +338,8 @@ var schema_v2_default = {
329
338
  }
330
339
  }
331
340
  },
332
- required: ["paths"]
341
+ required: ["paths"],
342
+ additionalProperties: false
333
343
  },
334
344
  ApplicationRouting: {
335
345
  type: "object",
@@ -362,15 +372,16 @@ var schema_v2_default = {
362
372
  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."
363
373
  }
364
374
  },
365
- required: ["partOf", "version"]
375
+ required: ["partOf", "version"],
376
+ additionalProperties: false
366
377
  }
367
378
  }
368
379
  };
369
380
 
370
- // src/config-v2/schema/utils/load.ts
371
- var SCHEMA = schema_v2_default;
381
+ // src/config/schema/utils/load.ts
382
+ var SCHEMA = schema_default;
372
383
 
373
- // src/config-v2/microfrontends/server/validation.ts
384
+ // src/config/microfrontends/server/validation.ts
374
385
  function validateSchema(configString) {
375
386
  const parsedConfig = (0, import_jsonc_parser.parse)(configString);
376
387
  const ajv = new import_ajv.Ajv();
@@ -384,349 +395,8 @@ function validateSchema(configString) {
384
395
  }
385
396
  return parsedConfig;
386
397
  }
387
-
388
- // src/config/validation.ts
389
- var import_jsonc_parser2 = require("jsonc-parser");
390
- var import_path_to_regexp = require("path-to-regexp");
391
- var import_ajv2 = require("ajv");
392
-
393
- // schema/schema.json
394
- var schema_default = {
395
- $schema: "http://json-schema.org/draft-07/schema#",
396
- $ref: "#/definitions/Config",
397
- definitions: {
398
- Config: {
399
- type: "object",
400
- properties: {
401
- version: {
402
- type: "string"
403
- },
404
- $schema: {
405
- type: "string"
406
- },
407
- name: {
408
- type: "string",
409
- description: 'Name for the micro-frontend site (eg. "vercel.com", "vercel-site" etc.).'
410
- },
411
- applications: {
412
- $ref: "#/definitions/ApplicationConfigsById"
413
- },
414
- options: {
415
- $ref: "#/definitions/Options",
416
- description: "Optional configuration for the entire micro-frontends setup."
417
- }
418
- },
419
- required: ["version", "applications"],
420
- description: "Configuration for micro-frontend applications\n\nTODO: Add proxy configuration"
421
- },
422
- ApplicationConfigsById: {
423
- type: "object",
424
- additionalProperties: {
425
- $ref: "#/definitions/ApplicationConfig"
426
- }
427
- },
428
- ApplicationConfig: {
429
- anyOf: [
430
- {
431
- $ref: "#/definitions/DefaultApplicationConfig"
432
- },
433
- {
434
- $ref: "#/definitions/CommonApplicationConfig"
435
- }
436
- ],
437
- description: "A Micro-Frontend Deployment Target"
438
- },
439
- DefaultApplicationConfig: {
440
- type: "object",
441
- properties: {
442
- default: {
443
- type: "boolean",
444
- const: true,
445
- description: "The default application is used no other application is matched via the routing config"
446
- },
447
- routing: {
448
- $ref: "#/definitions/Routing"
449
- },
450
- development: {
451
- type: "object",
452
- properties: {
453
- local: {
454
- $ref: "#/definitions/HostConfig"
455
- },
456
- fallback: {
457
- $ref: "#/definitions/HostConfig",
458
- 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."
459
- },
460
- task: {
461
- type: "string",
462
- description: "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
463
- }
464
- },
465
- required: ["local"]
466
- },
467
- production: {
468
- $ref: "#/definitions/HostConfig"
469
- },
470
- metadata: {
471
- type: "object",
472
- additionalProperties: {
473
- type: "string"
474
- }
475
- },
476
- federation: {
477
- type: "object",
478
- properties: {
479
- exposes: {
480
- type: "array",
481
- items: {
482
- type: "object",
483
- properties: {
484
- name: {
485
- type: "string",
486
- description: "The name of the module - should be used when importing the module from another application"
487
- },
488
- path: {
489
- type: "string",
490
- description: "Relative path to the module within its `application`"
491
- }
492
- },
493
- required: ["name", "path"]
494
- },
495
- description: "Modules that are exposed by this application"
496
- },
497
- uses: {
498
- type: "array",
499
- items: {
500
- type: "string"
501
- },
502
- description: "Modules that are used by this application. Only the name of the module is required."
503
- }
504
- }
505
- },
506
- vercel: {
507
- $ref: "#/definitions/Vercel"
508
- }
509
- },
510
- required: ["default", "development", "production"]
511
- },
512
- Routing: {
513
- type: "object",
514
- properties: {
515
- assetPrefix: {
516
- type: "string",
517
- description: "[assetPrefix] for the application"
518
- },
519
- matches: {
520
- type: "array",
521
- items: {
522
- $ref: "#/definitions/PathGroup"
523
- },
524
- description: "Path expressions that are routed to this application."
525
- }
526
- },
527
- required: ["matches"]
528
- },
529
- PathGroup: {
530
- type: "object",
531
- properties: {
532
- group: {
533
- type: "string",
534
- description: "Optional group name for the paths"
535
- },
536
- options: {
537
- type: "object",
538
- properties: {
539
- flag: {
540
- type: "string",
541
- description: "flag name that can be used to enable/disable all paths in the group"
542
- }
543
- }
544
- },
545
- paths: {
546
- type: "array",
547
- items: {
548
- type: "string"
549
- }
550
- }
551
- },
552
- required: ["paths"]
553
- },
554
- HostConfig: {
555
- type: "object",
556
- properties: {
557
- protocol: {
558
- type: "string",
559
- enum: ["http", "https"],
560
- 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"'
561
- },
562
- host: {
563
- type: "string",
564
- 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`)."
565
- },
566
- port: {
567
- type: "number",
568
- 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"
569
- }
570
- },
571
- required: ["host"]
572
- },
573
- Vercel: {
574
- type: "object",
575
- properties: {
576
- projectId: {
577
- type: "string",
578
- description: "Vercel project ID"
579
- },
580
- projectName: {
581
- type: "string",
582
- description: "Vercel project name (temporary until we can use project ID)"
583
- },
584
- defaultRoute: {
585
- type: "string",
586
- description: "The default route for the application. Used to render screenshots, favicons, and provide direct zone links"
587
- },
588
- routeSpeedInsightsToDefaultZone: {
589
- type: "boolean",
590
- description: "Whether to route Speed Insights to the default zone or each individual microfrontend."
591
- }
592
- },
593
- required: ["projectId"]
594
- },
595
- CommonApplicationConfig: {
596
- type: "object",
597
- properties: {
598
- default: {
599
- type: "boolean",
600
- const: false,
601
- description: "The default application is used no other application is matched via the routing config"
602
- },
603
- routing: {
604
- $ref: "#/definitions/Routing"
605
- },
606
- development: {
607
- type: "object",
608
- properties: {
609
- local: {
610
- $ref: "#/definitions/HostConfig"
611
- },
612
- fallback: {
613
- $ref: "#/definitions/HostConfig",
614
- 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."
615
- },
616
- task: {
617
- type: "string",
618
- description: "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
619
- }
620
- },
621
- required: ["local"]
622
- },
623
- production: {
624
- $ref: "#/definitions/HostConfig"
625
- },
626
- metadata: {
627
- type: "object",
628
- additionalProperties: {
629
- type: "string"
630
- }
631
- },
632
- federation: {
633
- type: "object",
634
- properties: {
635
- exposes: {
636
- type: "array",
637
- items: {
638
- type: "object",
639
- properties: {
640
- name: {
641
- type: "string",
642
- description: "The name of the module - should be used when importing the module from another application"
643
- },
644
- path: {
645
- type: "string",
646
- description: "Relative path to the module within its `application`"
647
- }
648
- },
649
- required: ["name", "path"]
650
- },
651
- description: "Modules that are exposed by this application"
652
- },
653
- uses: {
654
- type: "array",
655
- items: {
656
- type: "string"
657
- },
658
- description: "Modules that are used by this application. Only the name of the module is required."
659
- }
660
- }
661
- },
662
- vercel: {
663
- $ref: "#/definitions/Vercel"
664
- }
665
- },
666
- required: ["default", "development", "production", "routing"]
667
- },
668
- Options: {
669
- type: "object",
670
- properties: {
671
- vercel: {
672
- $ref: "#/definitions/VercelOptions",
673
- description: "Micro-Frontends wide options for Vercel."
674
- },
675
- localProxy: {
676
- $ref: "#/definitions/LocalProxyOptions",
677
- description: "Options for local proxy."
678
- }
679
- }
680
- },
681
- VercelOptions: {
682
- type: "object",
683
- properties: {
684
- previewDeploymentSuffix: {
685
- type: "string",
686
- 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`."
687
- },
688
- teamSlug: {
689
- type: "string",
690
- description: "Team slug for the Vercel team"
691
- },
692
- disableOverrides: {
693
- type: "boolean",
694
- 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."
695
- }
696
- }
697
- },
698
- LocalProxyOptions: {
699
- type: "object",
700
- properties: {
701
- port: {
702
- type: "number",
703
- description: "The port number used by the local proxy server.\n\nThe default is `3024`."
704
- }
705
- }
706
- }
707
- }
708
- };
709
-
710
- // src/config/utils/load-schema.ts
711
- var SCHEMA2 = schema_default;
712
-
713
- // src/config/validation.ts
714
- var validateSchema2 = (configString) => {
715
- const parsedConfig = (0, import_jsonc_parser2.parse)(configString);
716
- const ajv = new import_ajv2.Ajv();
717
- const validate = ajv.compile(SCHEMA2);
718
- const isValid = validate(parsedConfig);
719
- if (!isValid) {
720
- throw new MicrofrontendError(
721
- `Invalid config: ${ajv.errorsText(validate.errors)}`,
722
- { type: "config", subtype: "does_not_match_schema" }
723
- );
724
- }
725
- return parsedConfig;
726
- };
727
398
  // Annotate the CommonJS export names for ESM import in node:
728
399
  0 && (module.exports = {
729
- validateV1Schema,
730
- validateV2Schema
400
+ validateSchema
731
401
  });
732
402
  //# sourceMappingURL=validation.cjs.map