@vercel/microfrontends 1.0.0 → 1.0.1-canary.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/bin/cli.cjs +183 -27
  2. package/dist/config.cjs +46 -1
  3. package/dist/config.cjs.map +1 -1
  4. package/dist/config.d.ts +1 -1
  5. package/dist/config.js +46 -1
  6. package/dist/config.js.map +1 -1
  7. package/dist/experimental/sveltekit.cjs +1735 -0
  8. package/dist/experimental/sveltekit.cjs.map +1 -0
  9. package/dist/experimental/sveltekit.d.ts +12 -0
  10. package/dist/experimental/sveltekit.js +1698 -0
  11. package/dist/experimental/sveltekit.js.map +1 -0
  12. package/dist/experimental/vite.cjs +1745 -0
  13. package/dist/experimental/vite.cjs.map +1 -0
  14. package/dist/experimental/vite.d.ts +29 -0
  15. package/dist/experimental/vite.js +1710 -0
  16. package/dist/experimental/vite.js.map +1 -0
  17. package/dist/{index-09b1ddf9.d.ts → index-d5994ac5.d.ts} +1 -1
  18. package/dist/microfrontends/server.cjs +73 -10
  19. package/dist/microfrontends/server.cjs.map +1 -1
  20. package/dist/microfrontends/server.d.ts +1 -1
  21. package/dist/microfrontends/server.js +73 -10
  22. package/dist/microfrontends/server.js.map +1 -1
  23. package/dist/microfrontends.cjs +47 -2
  24. package/dist/microfrontends.cjs.map +1 -1
  25. package/dist/microfrontends.d.ts +1 -1
  26. package/dist/microfrontends.js +47 -2
  27. package/dist/microfrontends.js.map +1 -1
  28. package/dist/next/config.cjs +123 -51
  29. package/dist/next/config.cjs.map +1 -1
  30. package/dist/next/config.js +122 -52
  31. package/dist/next/config.js.map +1 -1
  32. package/dist/next/middleware.cjs +77 -7
  33. package/dist/next/middleware.cjs.map +1 -1
  34. package/dist/next/middleware.js +77 -7
  35. package/dist/next/middleware.js.map +1 -1
  36. package/dist/next/testing.cjs +46 -5
  37. package/dist/next/testing.cjs.map +1 -1
  38. package/dist/next/testing.d.ts +1 -1
  39. package/dist/next/testing.js +46 -5
  40. package/dist/next/testing.js.map +1 -1
  41. package/dist/utils/mfe-port.cjs +73 -10
  42. package/dist/utils/mfe-port.cjs.map +1 -1
  43. package/dist/utils/mfe-port.js +73 -10
  44. package/dist/utils/mfe-port.js.map +1 -1
  45. package/dist/validation.cjs +26 -8
  46. package/dist/validation.cjs.map +1 -1
  47. package/dist/validation.js +26 -8
  48. package/dist/validation.js.map +1 -1
  49. package/package.json +26 -2
@@ -359,6 +359,48 @@ var validateConfigDefaultApplication = (applicationConfigsById) => {
359
359
  );
360
360
  }
361
361
  };
362
+ var validateDeprecatedFields = (config) => {
363
+ const errors = [];
364
+ if (config.options?.vercel) {
365
+ errors.push(
366
+ `Configuration cannot contain deprecated field 'options.vercel'. Use 'options.disableOverrides' instead.`
367
+ );
368
+ }
369
+ if (config.options?.localProxy) {
370
+ errors.push(
371
+ `Configuration cannot contain deprecated field 'options.localProxy'. Use 'options.localProxyPort' instead.`
372
+ );
373
+ }
374
+ for (const [applicationId, application] of Object.entries(
375
+ config.applications
376
+ )) {
377
+ if (application.vercel) {
378
+ errors.push(
379
+ `Application '${applicationId}' cannot contain deprecated field 'vercel'. Use 'projectId' instead.`
380
+ );
381
+ }
382
+ if (application.production) {
383
+ errors.push(
384
+ `Application '${applicationId}' cannot contain deprecated field 'production'. Use 'development.fallback' instead.`
385
+ );
386
+ }
387
+ if (application.development?.local) {
388
+ errors.push(
389
+ `Application '${applicationId}' cannot contain deprecated field 'development.local'. Use 'developement.localPort' instead.`
390
+ );
391
+ }
392
+ }
393
+ if (errors.length) {
394
+ throw new MicrofrontendError(
395
+ `Microfrontends configuration file errors:
396
+ - ${errors.join("\n- ")}`,
397
+ {
398
+ type: "config",
399
+ subtype: "depcrecated_field"
400
+ }
401
+ );
402
+ }
403
+ };
362
404
 
363
405
  // src/config/microfrontends-config/isomorphic/utils/generate-asset-prefix.ts
364
406
  var PREFIX = "vc-ap";
@@ -569,7 +611,7 @@ var MicrofrontendConfigIsomorphic = class {
569
611
  }) {
570
612
  this.childApplications = {};
571
613
  MicrofrontendConfigIsomorphic.validate(config, opts);
572
- const disableOverrides = config.options?.vercel?.disableOverrides ?? false;
614
+ const disableOverrides = config.options?.disableOverrides ?? config.options?.vercel?.disableOverrides ?? false;
573
615
  this.overrides = overrides && !disableOverrides ? overrides : void 0;
574
616
  this.isMainConfig = isMainConfig(config);
575
617
  if (isMainConfig(config)) {
@@ -626,6 +668,9 @@ var MicrofrontendConfigIsomorphic = class {
626
668
  if (!skipValidation.includes("defaultApplication")) {
627
669
  validateConfigDefaultApplication(c.applications);
628
670
  }
671
+ if (!skipValidation.includes("deprecatedFields")) {
672
+ validateDeprecatedFields(c);
673
+ }
629
674
  }
630
675
  return c;
631
676
  }
@@ -760,7 +805,7 @@ var MicrofrontendMainConfig = class extends MicrofrontendConfigIsomorphic {
760
805
  }) {
761
806
  super({ config, overrides, meta });
762
807
  this.isMainConfig = true;
763
- const disableOverrides = config.options?.vercel?.disableOverrides ?? false;
808
+ const disableOverrides = config.options?.disableOverrides ?? config.options?.vercel?.disableOverrides ?? false;
764
809
  let defaultApplication;
765
810
  for (const [appId, appConfig] of Object.entries(config.applications)) {
766
811
  const appOverrides = !disableOverrides ? this.overrides?.applications[appId] : void 0;
@@ -1073,7 +1118,9 @@ var schema_default = {
1073
1118
  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"
1074
1119
  }
1075
1120
  },
1076
- required: ["applications"],
1121
+ required: [
1122
+ "applications"
1123
+ ],
1077
1124
  additionalProperties: false
1078
1125
  },
1079
1126
  Options: {
@@ -1168,7 +1215,9 @@ var schema_default = {
1168
1215
  description: "Vercel project ID"
1169
1216
  }
1170
1217
  },
1171
- required: ["projectId"],
1218
+ required: [
1219
+ "projectId"
1220
+ ],
1172
1221
  additionalProperties: false
1173
1222
  },
1174
1223
  HostConfig: {
@@ -1176,7 +1225,10 @@ var schema_default = {
1176
1225
  properties: {
1177
1226
  protocol: {
1178
1227
  type: "string",
1179
- enum: ["http", "https"],
1228
+ enum: [
1229
+ "http",
1230
+ "https"
1231
+ ],
1180
1232
  description: "The protocol to be used for the connection.\n- `http`: Hypertext Transfer Protocol (HTTP).\n- `https`: Secure Hypertext Transfer Protocol (HTTPS).\n\n*"
1181
1233
  },
1182
1234
  host: {
@@ -1188,7 +1240,9 @@ var schema_default = {
1188
1240
  description: "The port number to be used for the connection. Common values include `80` for HTTP and `443` for HTTPS."
1189
1241
  }
1190
1242
  },
1191
- required: ["host"],
1243
+ required: [
1244
+ "host"
1245
+ ],
1192
1246
  additionalProperties: false
1193
1247
  },
1194
1248
  Development: {
@@ -1230,7 +1284,10 @@ var schema_default = {
1230
1284
  },
1231
1285
  protocol: {
1232
1286
  type: "string",
1233
- enum: ["http", "https"],
1287
+ enum: [
1288
+ "http",
1289
+ "https"
1290
+ ],
1234
1291
  description: "The protocol to be used for the connection.\n- `http`: Hypertext Transfer Protocol (HTTP).\n- `https`: Secure Hypertext Transfer Protocol (HTTPS).\n\n*"
1235
1292
  },
1236
1293
  port: {
@@ -1262,7 +1319,9 @@ var schema_default = {
1262
1319
  description: "Groups of path expressions that are routed to this application."
1263
1320
  }
1264
1321
  },
1265
- required: ["routing"],
1322
+ required: [
1323
+ "routing"
1324
+ ],
1266
1325
  additionalProperties: false
1267
1326
  },
1268
1327
  Routing: {
@@ -1289,7 +1348,9 @@ var schema_default = {
1289
1348
  }
1290
1349
  }
1291
1350
  },
1292
- required: ["paths"],
1351
+ required: [
1352
+ "paths"
1353
+ ],
1293
1354
  additionalProperties: false
1294
1355
  },
1295
1356
  ChildConfig: {
@@ -1310,7 +1371,9 @@ var schema_default = {
1310
1371
  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."
1311
1372
  }
1312
1373
  },
1313
- required: ["partOf"],
1374
+ required: [
1375
+ "partOf"
1376
+ ],
1314
1377
  additionalProperties: false
1315
1378
  }
1316
1379
  }