@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
@@ -355,6 +355,48 @@ var validateConfigDefaultApplication = (applicationConfigsById) => {
355
355
  );
356
356
  }
357
357
  };
358
+ var validateDeprecatedFields = (config) => {
359
+ const errors = [];
360
+ if (config.options?.vercel) {
361
+ errors.push(
362
+ `Configuration cannot contain deprecated field 'options.vercel'. Use 'options.disableOverrides' instead.`
363
+ );
364
+ }
365
+ if (config.options?.localProxy) {
366
+ errors.push(
367
+ `Configuration cannot contain deprecated field 'options.localProxy'. Use 'options.localProxyPort' instead.`
368
+ );
369
+ }
370
+ for (const [applicationId, application] of Object.entries(
371
+ config.applications
372
+ )) {
373
+ if (application.vercel) {
374
+ errors.push(
375
+ `Application '${applicationId}' cannot contain deprecated field 'vercel'. Use 'projectId' instead.`
376
+ );
377
+ }
378
+ if (application.production) {
379
+ errors.push(
380
+ `Application '${applicationId}' cannot contain deprecated field 'production'. Use 'development.fallback' instead.`
381
+ );
382
+ }
383
+ if (application.development?.local) {
384
+ errors.push(
385
+ `Application '${applicationId}' cannot contain deprecated field 'development.local'. Use 'developement.localPort' instead.`
386
+ );
387
+ }
388
+ }
389
+ if (errors.length) {
390
+ throw new MicrofrontendError(
391
+ `Microfrontends configuration file errors:
392
+ - ${errors.join("\n- ")}`,
393
+ {
394
+ type: "config",
395
+ subtype: "depcrecated_field"
396
+ }
397
+ );
398
+ }
399
+ };
358
400
 
359
401
  // src/config/microfrontends-config/isomorphic/utils/generate-asset-prefix.ts
360
402
  var PREFIX = "vc-ap";
@@ -565,7 +607,7 @@ var MicrofrontendConfigIsomorphic = class {
565
607
  }) {
566
608
  this.childApplications = {};
567
609
  MicrofrontendConfigIsomorphic.validate(config, opts);
568
- const disableOverrides = config.options?.vercel?.disableOverrides ?? false;
610
+ const disableOverrides = config.options?.disableOverrides ?? config.options?.vercel?.disableOverrides ?? false;
569
611
  this.overrides = overrides && !disableOverrides ? overrides : void 0;
570
612
  this.isMainConfig = isMainConfig(config);
571
613
  if (isMainConfig(config)) {
@@ -622,6 +664,9 @@ var MicrofrontendConfigIsomorphic = class {
622
664
  if (!skipValidation.includes("defaultApplication")) {
623
665
  validateConfigDefaultApplication(c.applications);
624
666
  }
667
+ if (!skipValidation.includes("deprecatedFields")) {
668
+ validateDeprecatedFields(c);
669
+ }
625
670
  }
626
671
  return c;
627
672
  }
@@ -756,7 +801,7 @@ var MicrofrontendMainConfig = class extends MicrofrontendConfigIsomorphic {
756
801
  }) {
757
802
  super({ config, overrides, meta });
758
803
  this.isMainConfig = true;
759
- const disableOverrides = config.options?.vercel?.disableOverrides ?? false;
804
+ const disableOverrides = config.options?.disableOverrides ?? config.options?.vercel?.disableOverrides ?? false;
760
805
  let defaultApplication;
761
806
  for (const [appId, appConfig] of Object.entries(config.applications)) {
762
807
  const appOverrides = !disableOverrides ? this.overrides?.applications[appId] : void 0;
@@ -1069,7 +1114,9 @@ var schema_default = {
1069
1114
  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"
1070
1115
  }
1071
1116
  },
1072
- required: ["applications"],
1117
+ required: [
1118
+ "applications"
1119
+ ],
1073
1120
  additionalProperties: false
1074
1121
  },
1075
1122
  Options: {
@@ -1164,7 +1211,9 @@ var schema_default = {
1164
1211
  description: "Vercel project ID"
1165
1212
  }
1166
1213
  },
1167
- required: ["projectId"],
1214
+ required: [
1215
+ "projectId"
1216
+ ],
1168
1217
  additionalProperties: false
1169
1218
  },
1170
1219
  HostConfig: {
@@ -1172,7 +1221,10 @@ var schema_default = {
1172
1221
  properties: {
1173
1222
  protocol: {
1174
1223
  type: "string",
1175
- enum: ["http", "https"],
1224
+ enum: [
1225
+ "http",
1226
+ "https"
1227
+ ],
1176
1228
  description: "The protocol to be used for the connection.\n- `http`: Hypertext Transfer Protocol (HTTP).\n- `https`: Secure Hypertext Transfer Protocol (HTTPS).\n\n*"
1177
1229
  },
1178
1230
  host: {
@@ -1184,7 +1236,9 @@ var schema_default = {
1184
1236
  description: "The port number to be used for the connection. Common values include `80` for HTTP and `443` for HTTPS."
1185
1237
  }
1186
1238
  },
1187
- required: ["host"],
1239
+ required: [
1240
+ "host"
1241
+ ],
1188
1242
  additionalProperties: false
1189
1243
  },
1190
1244
  Development: {
@@ -1226,7 +1280,10 @@ var schema_default = {
1226
1280
  },
1227
1281
  protocol: {
1228
1282
  type: "string",
1229
- enum: ["http", "https"],
1283
+ enum: [
1284
+ "http",
1285
+ "https"
1286
+ ],
1230
1287
  description: "The protocol to be used for the connection.\n- `http`: Hypertext Transfer Protocol (HTTP).\n- `https`: Secure Hypertext Transfer Protocol (HTTPS).\n\n*"
1231
1288
  },
1232
1289
  port: {
@@ -1258,7 +1315,9 @@ var schema_default = {
1258
1315
  description: "Groups of path expressions that are routed to this application."
1259
1316
  }
1260
1317
  },
1261
- required: ["routing"],
1318
+ required: [
1319
+ "routing"
1320
+ ],
1262
1321
  additionalProperties: false
1263
1322
  },
1264
1323
  Routing: {
@@ -1285,7 +1344,9 @@ var schema_default = {
1285
1344
  }
1286
1345
  }
1287
1346
  },
1288
- required: ["paths"],
1347
+ required: [
1348
+ "paths"
1349
+ ],
1289
1350
  additionalProperties: false
1290
1351
  },
1291
1352
  ChildConfig: {
@@ -1306,7 +1367,9 @@ var schema_default = {
1306
1367
  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."
1307
1368
  }
1308
1369
  },
1309
- required: ["partOf"],
1370
+ required: [
1371
+ "partOf"
1372
+ ],
1310
1373
  additionalProperties: false
1311
1374
  }
1312
1375
  }