@vercel/microfrontends 0.13.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 (120) hide show
  1. package/README.md +3 -3
  2. package/dist/bin/cli.cjs +403 -1627
  3. package/dist/config.cjs +460 -1004
  4. package/dist/config.cjs.map +1 -1
  5. package/dist/config.d.ts +4 -25
  6. package/dist/config.js +456 -983
  7. package/dist/config.js.map +1 -1
  8. package/dist/{index-83133f2d.d.ts → index-bf67a461.d.ts} +3 -10
  9. package/dist/{v2/microfrontends → microfrontends}/server.cjs +128 -194
  10. package/dist/microfrontends/server.cjs.map +1 -0
  11. package/dist/{v2/microfrontends → microfrontends}/server.d.ts +6 -5
  12. package/dist/{v2/microfrontends → microfrontends}/server.js +125 -191
  13. package/dist/microfrontends/server.js.map +1 -0
  14. package/dist/{v2/microfrontends.cjs → microfrontends.cjs} +21 -35
  15. package/dist/microfrontends.cjs.map +1 -0
  16. package/dist/{v2/microfrontends.d.ts → microfrontends.d.ts} +4 -3
  17. package/dist/{v2/microfrontends.js → microfrontends.js} +20 -34
  18. package/dist/microfrontends.js.map +1 -0
  19. package/dist/next/client.cjs +1 -1
  20. package/dist/next/client.cjs.map +1 -1
  21. package/dist/next/client.js +1 -1
  22. package/dist/next/client.js.map +1 -1
  23. package/dist/next/config.cjs +1323 -1024
  24. package/dist/next/config.cjs.map +1 -1
  25. package/dist/next/config.d.ts +1 -1
  26. package/dist/next/config.js +1327 -1028
  27. package/dist/next/config.js.map +1 -1
  28. package/dist/next/endpoints.cjs +77 -18
  29. package/dist/next/endpoints.cjs.map +1 -1
  30. package/dist/next/endpoints.d.ts +14 -3
  31. package/dist/next/endpoints.js +77 -18
  32. package/dist/next/endpoints.js.map +1 -1
  33. package/dist/next/middleware.cjs +745 -425
  34. package/dist/next/middleware.cjs.map +1 -1
  35. package/dist/next/middleware.d.ts +10 -5
  36. package/dist/next/middleware.js +745 -425
  37. package/dist/next/middleware.js.map +1 -1
  38. package/dist/next/testing.cjs +595 -1032
  39. package/dist/next/testing.cjs.map +1 -1
  40. package/dist/next/testing.d.ts +14 -12
  41. package/dist/next/testing.js +589 -1016
  42. package/dist/next/testing.js.map +1 -1
  43. package/dist/overrides.cjs +40 -108
  44. package/dist/overrides.cjs.map +1 -1
  45. package/dist/overrides.d.ts +24 -2
  46. package/dist/overrides.js +36 -106
  47. package/dist/overrides.js.map +1 -1
  48. package/dist/routing.cjs +19 -0
  49. package/dist/routing.cjs.map +1 -0
  50. package/dist/routing.d.ts +26 -0
  51. package/dist/routing.js +1 -0
  52. package/dist/{v2/schema.cjs → schema.cjs} +1 -1
  53. package/dist/schema.cjs.map +1 -0
  54. package/dist/schema.d.ts +1 -0
  55. package/dist/schema.js.map +1 -0
  56. package/dist/{types-a995174e.d.ts → types-a29d224a.d.ts} +1 -7
  57. package/dist/{types-15b7f215.d.ts → types-cfe3308b.d.ts} +1 -1
  58. package/dist/types-fc30696d.d.ts +11 -0
  59. package/dist/utils/mfe-port.cjs +254 -1362
  60. package/dist/utils/mfe-port.cjs.map +1 -1
  61. package/dist/utils/mfe-port.js +250 -1358
  62. package/dist/utils/mfe-port.js.map +1 -1
  63. package/dist/validation.cjs +31 -365
  64. package/dist/validation.cjs.map +1 -1
  65. package/dist/validation.d.ts +3 -152
  66. package/dist/validation.js +30 -363
  67. package/dist/validation.js.map +1 -1
  68. package/package.json +32 -80
  69. package/schema/schema.json +174 -244
  70. package/dist/config/client.cjs +0 -54
  71. package/dist/config/client.cjs.map +0 -1
  72. package/dist/config/client.d.ts +0 -23
  73. package/dist/config/client.js +0 -28
  74. package/dist/config/client.js.map +0 -1
  75. package/dist/config/edge.cjs +0 -508
  76. package/dist/config/edge.cjs.map +0 -1
  77. package/dist/config/edge.d.ts +0 -20
  78. package/dist/config/edge.js +0 -481
  79. package/dist/config/edge.js.map +0 -1
  80. package/dist/microfrontend-config-983a5139.d.ts +0 -154
  81. package/dist/schema-2922d49e.d.ts +0 -182
  82. package/dist/v2/config.cjs +0 -723
  83. package/dist/v2/config.cjs.map +0 -1
  84. package/dist/v2/config.d.ts +0 -3
  85. package/dist/v2/config.js +0 -698
  86. package/dist/v2/config.js.map +0 -1
  87. package/dist/v2/microfrontends/server.cjs.map +0 -1
  88. package/dist/v2/microfrontends/server.js.map +0 -1
  89. package/dist/v2/microfrontends.cjs.map +0 -1
  90. package/dist/v2/microfrontends.js.map +0 -1
  91. package/dist/v2/next/client.cjs +0 -3
  92. package/dist/v2/next/client.cjs.map +0 -1
  93. package/dist/v2/next/client.d.ts +0 -45
  94. package/dist/v2/next/client.js +0 -3
  95. package/dist/v2/next/client.js.map +0 -1
  96. package/dist/v2/next/config.cjs +0 -2132
  97. package/dist/v2/next/config.cjs.map +0 -1
  98. package/dist/v2/next/config.d.ts +0 -22
  99. package/dist/v2/next/config.js +0 -2097
  100. package/dist/v2/next/config.js.map +0 -1
  101. package/dist/v2/next/endpoints.cjs +0 -141
  102. package/dist/v2/next/endpoints.cjs.map +0 -1
  103. package/dist/v2/next/endpoints.d.ts +0 -15
  104. package/dist/v2/next/endpoints.js +0 -116
  105. package/dist/v2/next/endpoints.js.map +0 -1
  106. package/dist/v2/next/middleware.cjs +0 -1143
  107. package/dist/v2/next/middleware.cjs.map +0 -1
  108. package/dist/v2/next/middleware.d.ts +0 -29
  109. package/dist/v2/next/middleware.js +0 -1115
  110. package/dist/v2/next/middleware.js.map +0 -1
  111. package/dist/v2/overrides.cjs +0 -75
  112. package/dist/v2/overrides.cjs.map +0 -1
  113. package/dist/v2/overrides.d.ts +0 -24
  114. package/dist/v2/overrides.js +0 -45
  115. package/dist/v2/overrides.js.map +0 -1
  116. package/dist/v2/schema.cjs.map +0 -1
  117. package/dist/v2/schema.d.ts +0 -1
  118. package/schema/schema-v2.json +0 -270
  119. /package/dist/{v2/schema.js.map → routing.js.map} +0 -0
  120. /package/dist/{v2/schema.js → schema.js} +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,15 +174,12 @@ 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",
181
182
  properties: {
182
- previewDeploymentSuffix: {
183
- type: "string",
184
- 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`."
185
- },
186
183
  teamSlug: {
187
184
  type: "string",
188
185
  description: "Team slug for the Vercel team"
@@ -191,7 +188,8 @@ var schema_v2_default = {
191
188
  type: "boolean",
192
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."
193
190
  }
194
- }
191
+ },
192
+ additionalProperties: false
195
193
  },
196
194
  LocalProxyOptions: {
197
195
  type: "object",
@@ -200,7 +198,8 @@ var schema_v2_default = {
200
198
  type: "number",
201
199
  description: "The port number used by the local proxy server.\n\nThe default is `3024`."
202
200
  }
203
- }
201
+ },
202
+ additionalProperties: false
204
203
  },
205
204
  Application: {
206
205
  anyOf: [
@@ -225,7 +224,8 @@ var schema_v2_default = {
225
224
  $ref: "#/definitions/HostConfig"
226
225
  }
227
226
  },
228
- required: ["production"]
227
+ required: ["production"],
228
+ additionalProperties: false
229
229
  },
230
230
  Vercel: {
231
231
  type: "object",
@@ -235,7 +235,8 @@ var schema_v2_default = {
235
235
  description: "Vercel project ID"
236
236
  }
237
237
  },
238
- required: ["projectId"]
238
+ required: ["projectId"],
239
+ additionalProperties: false
239
240
  },
240
241
  Development: {
241
242
  type: "object",
@@ -251,10 +252,12 @@ var schema_v2_default = {
251
252
  type: "string",
252
253
  description: "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
253
254
  }
254
- }
255
+ },
256
+ additionalProperties: false
255
257
  },
256
258
  LocalHostConfig: {
257
259
  type: "object",
260
+ additionalProperties: false,
258
261
  properties: {
259
262
  host: {
260
263
  type: "string",
@@ -288,7 +291,8 @@ var schema_v2_default = {
288
291
  description: "The port number to be used for the connection. Common values include `80` for HTTP and `443` for HTTPS."
289
292
  }
290
293
  },
291
- required: ["host"]
294
+ required: ["host"],
295
+ additionalProperties: false
292
296
  },
293
297
  ChildApplication: {
294
298
  type: "object",
@@ -307,7 +311,8 @@ var schema_v2_default = {
307
311
  $ref: "#/definitions/HostConfig"
308
312
  }
309
313
  },
310
- required: ["routing"]
314
+ required: ["routing"],
315
+ additionalProperties: false
311
316
  },
312
317
  Routing: {
313
318
  type: "array",
@@ -333,7 +338,8 @@ var schema_v2_default = {
333
338
  }
334
339
  }
335
340
  },
336
- required: ["paths"]
341
+ required: ["paths"],
342
+ additionalProperties: false
337
343
  },
338
344
  ApplicationRouting: {
339
345
  type: "object",
@@ -366,15 +372,16 @@ var schema_v2_default = {
366
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."
367
373
  }
368
374
  },
369
- required: ["partOf", "version"]
375
+ required: ["partOf", "version"],
376
+ additionalProperties: false
370
377
  }
371
378
  }
372
379
  };
373
380
 
374
- // src/config-v2/schema/utils/load.ts
375
- var SCHEMA = schema_v2_default;
381
+ // src/config/schema/utils/load.ts
382
+ var SCHEMA = schema_default;
376
383
 
377
- // src/config-v2/microfrontends/server/validation.ts
384
+ // src/config/microfrontends/server/validation.ts
378
385
  function validateSchema(configString) {
379
386
  const parsedConfig = (0, import_jsonc_parser.parse)(configString);
380
387
  const ajv = new import_ajv.Ajv();
@@ -388,349 +395,8 @@ function validateSchema(configString) {
388
395
  }
389
396
  return parsedConfig;
390
397
  }
391
-
392
- // src/config/validation.ts
393
- var import_jsonc_parser2 = require("jsonc-parser");
394
- var import_path_to_regexp = require("path-to-regexp");
395
- var import_ajv2 = require("ajv");
396
-
397
- // schema/schema.json
398
- var schema_default = {
399
- $schema: "http://json-schema.org/draft-07/schema#",
400
- $ref: "#/definitions/Config",
401
- definitions: {
402
- Config: {
403
- type: "object",
404
- properties: {
405
- version: {
406
- type: "string"
407
- },
408
- $schema: {
409
- type: "string"
410
- },
411
- name: {
412
- type: "string",
413
- description: 'Name for the micro-frontend site (eg. "vercel.com", "vercel-site" etc.).'
414
- },
415
- applications: {
416
- $ref: "#/definitions/ApplicationConfigsById"
417
- },
418
- options: {
419
- $ref: "#/definitions/Options",
420
- description: "Optional configuration for the entire micro-frontends setup."
421
- }
422
- },
423
- required: ["version", "applications"],
424
- description: "Configuration for micro-frontend applications\n\nTODO: Add proxy configuration"
425
- },
426
- ApplicationConfigsById: {
427
- type: "object",
428
- additionalProperties: {
429
- $ref: "#/definitions/ApplicationConfig"
430
- }
431
- },
432
- ApplicationConfig: {
433
- anyOf: [
434
- {
435
- $ref: "#/definitions/DefaultApplicationConfig"
436
- },
437
- {
438
- $ref: "#/definitions/CommonApplicationConfig"
439
- }
440
- ],
441
- description: "A Micro-Frontend Deployment Target"
442
- },
443
- DefaultApplicationConfig: {
444
- type: "object",
445
- properties: {
446
- default: {
447
- type: "boolean",
448
- const: true,
449
- description: "The default application is used no other application is matched via the routing config"
450
- },
451
- routing: {
452
- $ref: "#/definitions/Routing"
453
- },
454
- development: {
455
- type: "object",
456
- properties: {
457
- local: {
458
- $ref: "#/definitions/HostConfig"
459
- },
460
- fallback: {
461
- $ref: "#/definitions/HostConfig",
462
- 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."
463
- },
464
- task: {
465
- type: "string",
466
- description: "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
467
- }
468
- },
469
- required: ["local"]
470
- },
471
- production: {
472
- $ref: "#/definitions/HostConfig"
473
- },
474
- metadata: {
475
- type: "object",
476
- additionalProperties: {
477
- type: "string"
478
- }
479
- },
480
- federation: {
481
- type: "object",
482
- properties: {
483
- exposes: {
484
- type: "array",
485
- items: {
486
- type: "object",
487
- properties: {
488
- name: {
489
- type: "string",
490
- description: "The name of the module - should be used when importing the module from another application"
491
- },
492
- path: {
493
- type: "string",
494
- description: "Relative path to the module within its `application`"
495
- }
496
- },
497
- required: ["name", "path"]
498
- },
499
- description: "Modules that are exposed by this application"
500
- },
501
- uses: {
502
- type: "array",
503
- items: {
504
- type: "string"
505
- },
506
- description: "Modules that are used by this application. Only the name of the module is required."
507
- }
508
- }
509
- },
510
- vercel: {
511
- $ref: "#/definitions/Vercel"
512
- }
513
- },
514
- required: ["default", "development", "production"]
515
- },
516
- Routing: {
517
- type: "object",
518
- properties: {
519
- assetPrefix: {
520
- type: "string",
521
- description: "[assetPrefix] for the application"
522
- },
523
- matches: {
524
- type: "array",
525
- items: {
526
- $ref: "#/definitions/PathGroup"
527
- },
528
- description: "Path expressions that are routed to this application."
529
- }
530
- },
531
- required: ["matches"]
532
- },
533
- PathGroup: {
534
- type: "object",
535
- properties: {
536
- group: {
537
- type: "string",
538
- description: "Optional group name for the paths"
539
- },
540
- options: {
541
- type: "object",
542
- properties: {
543
- flag: {
544
- type: "string",
545
- description: "flag name that can be used to enable/disable all paths in the group"
546
- }
547
- }
548
- },
549
- paths: {
550
- type: "array",
551
- items: {
552
- type: "string"
553
- }
554
- }
555
- },
556
- required: ["paths"]
557
- },
558
- HostConfig: {
559
- type: "object",
560
- properties: {
561
- protocol: {
562
- type: "string",
563
- enum: ["http", "https"],
564
- 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"'
565
- },
566
- host: {
567
- type: "string",
568
- 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`)."
569
- },
570
- port: {
571
- type: "number",
572
- 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"
573
- }
574
- },
575
- required: ["host"]
576
- },
577
- Vercel: {
578
- type: "object",
579
- properties: {
580
- projectId: {
581
- type: "string",
582
- description: "Vercel project ID"
583
- },
584
- projectName: {
585
- type: "string",
586
- description: "Vercel project name (temporary until we can use project ID)"
587
- },
588
- defaultRoute: {
589
- type: "string",
590
- description: "The default route for the application. Used to render screenshots, favicons, and provide direct zone links"
591
- },
592
- routeSpeedInsightsToDefaultZone: {
593
- type: "boolean",
594
- description: "Whether to route Speed Insights to the default zone or each individual microfrontend."
595
- }
596
- },
597
- required: ["projectId"]
598
- },
599
- CommonApplicationConfig: {
600
- type: "object",
601
- properties: {
602
- default: {
603
- type: "boolean",
604
- const: false,
605
- description: "The default application is used no other application is matched via the routing config"
606
- },
607
- routing: {
608
- $ref: "#/definitions/Routing"
609
- },
610
- development: {
611
- type: "object",
612
- properties: {
613
- local: {
614
- $ref: "#/definitions/HostConfig"
615
- },
616
- fallback: {
617
- $ref: "#/definitions/HostConfig",
618
- 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."
619
- },
620
- task: {
621
- type: "string",
622
- description: "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
623
- }
624
- },
625
- required: ["local"]
626
- },
627
- production: {
628
- $ref: "#/definitions/HostConfig"
629
- },
630
- metadata: {
631
- type: "object",
632
- additionalProperties: {
633
- type: "string"
634
- }
635
- },
636
- federation: {
637
- type: "object",
638
- properties: {
639
- exposes: {
640
- type: "array",
641
- items: {
642
- type: "object",
643
- properties: {
644
- name: {
645
- type: "string",
646
- description: "The name of the module - should be used when importing the module from another application"
647
- },
648
- path: {
649
- type: "string",
650
- description: "Relative path to the module within its `application`"
651
- }
652
- },
653
- required: ["name", "path"]
654
- },
655
- description: "Modules that are exposed by this application"
656
- },
657
- uses: {
658
- type: "array",
659
- items: {
660
- type: "string"
661
- },
662
- description: "Modules that are used by this application. Only the name of the module is required."
663
- }
664
- }
665
- },
666
- vercel: {
667
- $ref: "#/definitions/Vercel"
668
- }
669
- },
670
- required: ["default", "development", "production", "routing"]
671
- },
672
- Options: {
673
- type: "object",
674
- properties: {
675
- vercel: {
676
- $ref: "#/definitions/VercelOptions",
677
- description: "Micro-Frontends wide options for Vercel."
678
- },
679
- localProxy: {
680
- $ref: "#/definitions/LocalProxyOptions",
681
- description: "Options for local proxy."
682
- }
683
- }
684
- },
685
- VercelOptions: {
686
- type: "object",
687
- properties: {
688
- previewDeploymentSuffix: {
689
- type: "string",
690
- 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`."
691
- },
692
- teamSlug: {
693
- type: "string",
694
- description: "Team slug for the Vercel team"
695
- },
696
- disableOverrides: {
697
- type: "boolean",
698
- 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."
699
- }
700
- }
701
- },
702
- LocalProxyOptions: {
703
- type: "object",
704
- properties: {
705
- port: {
706
- type: "number",
707
- description: "The port number used by the local proxy server.\n\nThe default is `3024`."
708
- }
709
- }
710
- }
711
- }
712
- };
713
-
714
- // src/config/utils/load-schema.ts
715
- var SCHEMA2 = schema_default;
716
-
717
- // src/config/validation.ts
718
- var validateSchema2 = (configString) => {
719
- const parsedConfig = (0, import_jsonc_parser2.parse)(configString);
720
- const ajv = new import_ajv2.Ajv();
721
- const validate = ajv.compile(SCHEMA2);
722
- const isValid = validate(parsedConfig);
723
- if (!isValid) {
724
- throw new MicrofrontendError(
725
- `Invalid config: ${ajv.errorsText(validate.errors)}`,
726
- { type: "config", subtype: "does_not_match_schema" }
727
- );
728
- }
729
- return parsedConfig;
730
- };
731
398
  // Annotate the CommonJS export names for ESM import in node:
732
399
  0 && (module.exports = {
733
- validateV1Schema,
734
- validateV2Schema
400
+ validateSchema
735
401
  });
736
402
  //# sourceMappingURL=validation.cjs.map