@vercel/microfrontends 1.4.2 → 1.5.0-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 (48) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/bin/cli.cjs +28 -74
  3. package/dist/config.cjs +4 -46
  4. package/dist/config.cjs.map +1 -1
  5. package/dist/config.d.ts +5 -11
  6. package/dist/config.js +4 -46
  7. package/dist/config.js.map +1 -1
  8. package/dist/experimental/sveltekit.cjs +27 -73
  9. package/dist/experimental/sveltekit.cjs.map +1 -1
  10. package/dist/experimental/sveltekit.js +27 -73
  11. package/dist/experimental/sveltekit.js.map +1 -1
  12. package/dist/experimental/vite.cjs +27 -73
  13. package/dist/experimental/vite.cjs.map +1 -1
  14. package/dist/experimental/vite.js +27 -73
  15. package/dist/experimental/vite.js.map +1 -1
  16. package/dist/microfrontends/server.cjs +27 -73
  17. package/dist/microfrontends/server.cjs.map +1 -1
  18. package/dist/microfrontends/server.d.ts +2 -2
  19. package/dist/microfrontends/server.js +27 -73
  20. package/dist/microfrontends/server.js.map +1 -1
  21. package/dist/next/config.cjs +27 -73
  22. package/dist/next/config.cjs.map +1 -1
  23. package/dist/next/config.js +27 -73
  24. package/dist/next/config.js.map +1 -1
  25. package/dist/next/middleware.cjs +4 -46
  26. package/dist/next/middleware.cjs.map +1 -1
  27. package/dist/next/middleware.js +4 -46
  28. package/dist/next/middleware.js.map +1 -1
  29. package/dist/next/testing.cjs +4 -46
  30. package/dist/next/testing.cjs.map +1 -1
  31. package/dist/next/testing.d.ts +2 -2
  32. package/dist/next/testing.js +4 -46
  33. package/dist/next/testing.js.map +1 -1
  34. package/dist/overrides.d.ts +3 -3
  35. package/dist/schema.d.ts +2 -2
  36. package/dist/{types-ab31c948.d.ts → types-1cec43e6.d.ts} +0 -15
  37. package/dist/{types-d3cb74a6.d.ts → types-1fb60496.d.ts} +1 -1
  38. package/dist/utils/mfe-port.cjs +27 -73
  39. package/dist/utils/mfe-port.cjs.map +1 -1
  40. package/dist/utils/mfe-port.js +27 -73
  41. package/dist/utils/mfe-port.js.map +1 -1
  42. package/dist/validation.cjs +23 -27
  43. package/dist/validation.cjs.map +1 -1
  44. package/dist/validation.d.ts +1 -1
  45. package/dist/validation.js +23 -27
  46. package/dist/validation.js.map +1 -1
  47. package/package.json +3 -3
  48. package/schema/schema.json +0 -20
@@ -580,33 +580,6 @@ var validateConfigDefaultApplication = (applicationConfigsById) => {
580
580
  );
581
581
  }
582
582
  };
583
- var validateDeprecatedFields = (config) => {
584
- const errors = [];
585
- for (const [applicationId, application] of Object.entries(
586
- config.applications
587
- )) {
588
- if (application.development?.localPort) {
589
- errors.push(
590
- `Application '${applicationId}' cannot contain deprecated field 'development.localPort'. Use 'developement.local' instead.`
591
- );
592
- }
593
- if (application.projectId) {
594
- errors.push(
595
- `Application '${applicationId}' cannot contain deprecated field 'projectId'. If the application ID matches the Vercel project name, then please remove the 'projectId' field. Otherwise, either update the application ID / Vercel project name to match, or set the 'packageName' field to the name of the package.json name.`
596
- );
597
- }
598
- }
599
- if (errors.length) {
600
- throw new MicrofrontendError(
601
- `Microfrontends configuration file errors:
602
- - ${errors.join("\n- ")}`,
603
- {
604
- type: "config",
605
- subtype: "depcrecated_field"
606
- }
607
- );
608
- }
609
- };
610
583
 
611
584
  // src/config/microfrontends-config/isomorphic/utils/generate-asset-prefix.ts
612
585
  var PREFIX = "vc-ap";
@@ -711,20 +684,12 @@ var Host = class {
711
684
  var LocalHost = class extends Host {
712
685
  constructor({
713
686
  appName,
714
- localPort,
715
687
  local
716
688
  }) {
717
- if (localPort && local) {
718
- throw new Error(
719
- `Microfrontends configuration error: '${appName}' has both the 'development.local' and 'development.localPort' fields set. Please remove the 'development.localPort' field and ensure the 'development.local' field has the correct port.`
720
- );
721
- }
722
689
  let protocol;
723
690
  let host;
724
691
  let port;
725
- if (localPort) {
726
- port = localPort;
727
- } else if (typeof local === "number") {
692
+ if (typeof local === "number") {
728
693
  port = local;
729
694
  } else if (typeof local === "string") {
730
695
  if (/^\d+$/.test(local)) {
@@ -766,7 +731,6 @@ var Application = class {
766
731
  this.development = {
767
732
  local: new LocalHost({
768
733
  appName: name,
769
- localPort: app.development?.localPort,
770
734
  local: app.development?.local
771
735
  }),
772
736
  fallback: app.development?.fallback ? new Host(app.development.fallback) : void 0
@@ -774,7 +738,6 @@ var Application = class {
774
738
  if (app.development?.fallback) {
775
739
  this.fallback = new Host(app.development.fallback);
776
740
  }
777
- this.projectId = app.projectId;
778
741
  this.packageName = app.packageName;
779
742
  this.overrides = overrides?.environment ? {
780
743
  environment: new Host(overrides.environment)
@@ -838,11 +801,10 @@ var DEFAULT_LOCAL_PROXY_PORT = 3024;
838
801
  var MicrofrontendConfigIsomorphic = class {
839
802
  constructor({
840
803
  config,
841
- overrides,
842
- opts
804
+ overrides
843
805
  }) {
844
806
  this.childApplications = {};
845
- MicrofrontendConfigIsomorphic.validate(config, opts);
807
+ MicrofrontendConfigIsomorphic.validate(config);
846
808
  const disableOverrides = config.options?.disableOverrides ?? false;
847
809
  this.overrides = overrides && !disableOverrides ? overrides : void 0;
848
810
  let defaultApplication;
@@ -877,14 +839,10 @@ var MicrofrontendConfigIsomorphic = class {
877
839
  overrides
878
840
  };
879
841
  }
880
- static validate(config, opts) {
881
- const skipValidation = opts?.skipValidation ?? [];
842
+ static validate(config) {
882
843
  const c = typeof config === "string" ? parse2(config) : config;
883
844
  validateConfigPaths(c.applications);
884
845
  validateConfigDefaultApplication(c.applications);
885
- if (!skipValidation.includes("deprecatedFields")) {
886
- validateDeprecatedFields(c);
887
- }
888
846
  return c;
889
847
  }
890
848
  static fromEnv({
@@ -1065,7 +1023,9 @@ var schema_default = {
1065
1023
  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"
1066
1024
  }
1067
1025
  },
1068
- required: ["applications"],
1026
+ required: [
1027
+ "applications"
1028
+ ],
1069
1029
  additionalProperties: false
1070
1030
  },
1071
1031
  Options: {
@@ -1104,11 +1064,6 @@ var schema_default = {
1104
1064
  DefaultApplication: {
1105
1065
  type: "object",
1106
1066
  properties: {
1107
- projectId: {
1108
- type: "string",
1109
- description: "Vercel project ID, only required if the application name / id is different to the Vercel project name.",
1110
- deprecated: "Instead, the application id should match the Vercel project name. `packageName` can optionally\nbe set to the name of the package.json (if it is different from the project name)."
1111
- },
1112
1067
  packageName: {
1113
1068
  type: "string",
1114
1069
  description: "The name used to run the application, e.g. the `name` field in the `package.json`.\n\nThis is used by the local proxy to map the application config to the locally running app.\n\nThis is only necessary when the application name does not match the `name` used in `package.json`."
@@ -1118,21 +1073,21 @@ var schema_default = {
1118
1073
  description: "Development configuration for the default application."
1119
1074
  }
1120
1075
  },
1121
- required: ["development"],
1076
+ required: [
1077
+ "development"
1078
+ ],
1122
1079
  additionalProperties: false
1123
1080
  },
1124
1081
  DefaultDevelopment: {
1125
1082
  type: "object",
1126
1083
  properties: {
1127
1084
  local: {
1128
- type: ["number", "string"],
1085
+ type: [
1086
+ "number",
1087
+ "string"
1088
+ ],
1129
1089
  description: "A local port number or host string that this application runs on when it is running locally. If passing a string, include the protocol (optional), host (required) and port (optional). For example: `https://this.ismyhost:8080`. If omitted, the protocol defaults to HTTP. If omitted, the port defaults to a unique, but stable (based on the application name) number.\n\nExamples of valid values:\n- 8080\n- my.localhost.me\n- my.localhost.me:8080\n- https://my.localhost.me\n- https://my.localhost.me:8080"
1130
1090
  },
1131
- localPort: {
1132
- type: "number",
1133
- description: "The local port number that this application runs on when it is running locally. Common values include `80` for HTTP and `443` for HTTPS. If omitted, the port defaults to a unique, but stable (based on the application name) number.",
1134
- deprecated: "Please set the port with the 'local' field instead."
1135
- },
1136
1091
  task: {
1137
1092
  type: "string",
1138
1093
  description: "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
@@ -1142,17 +1097,14 @@ var schema_default = {
1142
1097
  description: "Fallback for local development, could point to any environment. This is required for the default app. This value is used as the fallback for child apps as well if they do not have a fallback.\n\nIf passing a string, include the protocol (optional), host (required) and port (optional). For example: `https://this.ismyhost:8080`. If omitted, the protocol defaults to HTTPS. If omitted, the port defaults to `80` for HTTP and `443` for HTTPS."
1143
1098
  }
1144
1099
  },
1145
- required: ["fallback"],
1100
+ required: [
1101
+ "fallback"
1102
+ ],
1146
1103
  additionalProperties: false
1147
1104
  },
1148
1105
  ChildApplication: {
1149
1106
  type: "object",
1150
1107
  properties: {
1151
- projectId: {
1152
- type: "string",
1153
- description: "Vercel project ID, only required if the application name / id is different to the Vercel project name.",
1154
- deprecated: "Instead, the application id should match the Vercel project name. `packageName` can optionally\nbe set to the name of the package.json (if it is different from the project name)."
1155
- },
1156
1108
  packageName: {
1157
1109
  type: "string",
1158
1110
  description: "The name used to run the application, e.g. the `name` field in the `package.json`.\n\nThis is used by the local proxy to map the application config to the locally running app.\n\nThis is only necessary when the application name does not match the `name` used in `package.json`."
@@ -1166,21 +1118,21 @@ var schema_default = {
1166
1118
  description: "Groups of path expressions that are routed to this application."
1167
1119
  }
1168
1120
  },
1169
- required: ["routing"],
1121
+ required: [
1122
+ "routing"
1123
+ ],
1170
1124
  additionalProperties: false
1171
1125
  },
1172
1126
  ChildDevelopment: {
1173
1127
  type: "object",
1174
1128
  properties: {
1175
1129
  local: {
1176
- type: ["number", "string"],
1130
+ type: [
1131
+ "number",
1132
+ "string"
1133
+ ],
1177
1134
  description: "A local port number or host string that this application runs on when it is running locally. If passing a string, include the protocol (optional), host (required) and port (optional). For example: `https://this.ismyhost:8080`. If omitted, the protocol defaults to HTTP. If omitted, the port defaults to a unique, but stable (based on the application name) number.\n\nExamples of valid values:\n- 8080\n- my.localhost.me\n- my.localhost.me:8080\n- https://my.localhost.me\n- https://my.localhost.me:8080"
1178
1135
  },
1179
- localPort: {
1180
- type: "number",
1181
- description: "The local port number that this application runs on when it is running locally. Common values include `80` for HTTP and `443` for HTTPS. If omitted, the port defaults to a unique, but stable (based on the application name) number.",
1182
- deprecated: "Please set the port with the 'local' field instead."
1183
- },
1184
1136
  task: {
1185
1137
  type: "string",
1186
1138
  description: "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
@@ -1216,7 +1168,9 @@ var schema_default = {
1216
1168
  }
1217
1169
  }
1218
1170
  },
1219
- required: ["paths"],
1171
+ required: [
1172
+ "paths"
1173
+ ],
1220
1174
  additionalProperties: false
1221
1175
  }
1222
1176
  }