@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
@@ -616,33 +616,6 @@ var validateConfigDefaultApplication = (applicationConfigsById) => {
616
616
  );
617
617
  }
618
618
  };
619
- var validateDeprecatedFields = (config) => {
620
- const errors = [];
621
- for (const [applicationId, application] of Object.entries(
622
- config.applications
623
- )) {
624
- if (application.development?.localPort) {
625
- errors.push(
626
- `Application '${applicationId}' cannot contain deprecated field 'development.localPort'. Use 'developement.local' instead.`
627
- );
628
- }
629
- if (application.projectId) {
630
- errors.push(
631
- `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.`
632
- );
633
- }
634
- }
635
- if (errors.length) {
636
- throw new MicrofrontendError(
637
- `Microfrontends configuration file errors:
638
- - ${errors.join("\n- ")}`,
639
- {
640
- type: "config",
641
- subtype: "depcrecated_field"
642
- }
643
- );
644
- }
645
- };
646
619
 
647
620
  // src/config/microfrontends-config/isomorphic/utils/generate-asset-prefix.ts
648
621
  var PREFIX = "vc-ap";
@@ -747,20 +720,12 @@ var Host = class {
747
720
  var LocalHost = class extends Host {
748
721
  constructor({
749
722
  appName,
750
- localPort,
751
723
  local
752
724
  }) {
753
- if (localPort && local) {
754
- throw new Error(
755
- `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.`
756
- );
757
- }
758
725
  let protocol;
759
726
  let host;
760
727
  let port;
761
- if (localPort) {
762
- port = localPort;
763
- } else if (typeof local === "number") {
728
+ if (typeof local === "number") {
764
729
  port = local;
765
730
  } else if (typeof local === "string") {
766
731
  if (/^\d+$/.test(local)) {
@@ -802,7 +767,6 @@ var Application = class {
802
767
  this.development = {
803
768
  local: new LocalHost({
804
769
  appName: name,
805
- localPort: app.development?.localPort,
806
770
  local: app.development?.local
807
771
  }),
808
772
  fallback: app.development?.fallback ? new Host(app.development.fallback) : void 0
@@ -810,7 +774,6 @@ var Application = class {
810
774
  if (app.development?.fallback) {
811
775
  this.fallback = new Host(app.development.fallback);
812
776
  }
813
- this.projectId = app.projectId;
814
777
  this.packageName = app.packageName;
815
778
  this.overrides = overrides?.environment ? {
816
779
  environment: new Host(overrides.environment)
@@ -874,11 +837,10 @@ var DEFAULT_LOCAL_PROXY_PORT = 3024;
874
837
  var MicrofrontendConfigIsomorphic = class {
875
838
  constructor({
876
839
  config,
877
- overrides,
878
- opts
840
+ overrides
879
841
  }) {
880
842
  this.childApplications = {};
881
- MicrofrontendConfigIsomorphic.validate(config, opts);
843
+ MicrofrontendConfigIsomorphic.validate(config);
882
844
  const disableOverrides = config.options?.disableOverrides ?? false;
883
845
  this.overrides = overrides && !disableOverrides ? overrides : void 0;
884
846
  let defaultApplication;
@@ -913,14 +875,10 @@ var MicrofrontendConfigIsomorphic = class {
913
875
  overrides
914
876
  };
915
877
  }
916
- static validate(config, opts) {
917
- const skipValidation = opts?.skipValidation ?? [];
878
+ static validate(config) {
918
879
  const c = typeof config === "string" ? (0, import_jsonc_parser2.parse)(config) : config;
919
880
  validateConfigPaths(c.applications);
920
881
  validateConfigDefaultApplication(c.applications);
921
- if (!skipValidation.includes("deprecatedFields")) {
922
- validateDeprecatedFields(c);
923
- }
924
882
  return c;
925
883
  }
926
884
  static fromEnv({
@@ -1101,7 +1059,9 @@ var schema_default = {
1101
1059
  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"
1102
1060
  }
1103
1061
  },
1104
- required: ["applications"],
1062
+ required: [
1063
+ "applications"
1064
+ ],
1105
1065
  additionalProperties: false
1106
1066
  },
1107
1067
  Options: {
@@ -1140,11 +1100,6 @@ var schema_default = {
1140
1100
  DefaultApplication: {
1141
1101
  type: "object",
1142
1102
  properties: {
1143
- projectId: {
1144
- type: "string",
1145
- description: "Vercel project ID, only required if the application name / id is different to the Vercel project name.",
1146
- 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)."
1147
- },
1148
1103
  packageName: {
1149
1104
  type: "string",
1150
1105
  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`."
@@ -1154,21 +1109,21 @@ var schema_default = {
1154
1109
  description: "Development configuration for the default application."
1155
1110
  }
1156
1111
  },
1157
- required: ["development"],
1112
+ required: [
1113
+ "development"
1114
+ ],
1158
1115
  additionalProperties: false
1159
1116
  },
1160
1117
  DefaultDevelopment: {
1161
1118
  type: "object",
1162
1119
  properties: {
1163
1120
  local: {
1164
- type: ["number", "string"],
1121
+ type: [
1122
+ "number",
1123
+ "string"
1124
+ ],
1165
1125
  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"
1166
1126
  },
1167
- localPort: {
1168
- type: "number",
1169
- 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.",
1170
- deprecated: "Please set the port with the 'local' field instead."
1171
- },
1172
1127
  task: {
1173
1128
  type: "string",
1174
1129
  description: "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
@@ -1178,17 +1133,14 @@ var schema_default = {
1178
1133
  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."
1179
1134
  }
1180
1135
  },
1181
- required: ["fallback"],
1136
+ required: [
1137
+ "fallback"
1138
+ ],
1182
1139
  additionalProperties: false
1183
1140
  },
1184
1141
  ChildApplication: {
1185
1142
  type: "object",
1186
1143
  properties: {
1187
- projectId: {
1188
- type: "string",
1189
- description: "Vercel project ID, only required if the application name / id is different to the Vercel project name.",
1190
- 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)."
1191
- },
1192
1144
  packageName: {
1193
1145
  type: "string",
1194
1146
  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`."
@@ -1202,21 +1154,21 @@ var schema_default = {
1202
1154
  description: "Groups of path expressions that are routed to this application."
1203
1155
  }
1204
1156
  },
1205
- required: ["routing"],
1157
+ required: [
1158
+ "routing"
1159
+ ],
1206
1160
  additionalProperties: false
1207
1161
  },
1208
1162
  ChildDevelopment: {
1209
1163
  type: "object",
1210
1164
  properties: {
1211
1165
  local: {
1212
- type: ["number", "string"],
1166
+ type: [
1167
+ "number",
1168
+ "string"
1169
+ ],
1213
1170
  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"
1214
1171
  },
1215
- localPort: {
1216
- type: "number",
1217
- 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.",
1218
- deprecated: "Please set the port with the 'local' field instead."
1219
- },
1220
1172
  task: {
1221
1173
  type: "string",
1222
1174
  description: "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
@@ -1252,7 +1204,9 @@ var schema_default = {
1252
1204
  }
1253
1205
  }
1254
1206
  },
1255
- required: ["paths"],
1207
+ required: [
1208
+ "paths"
1209
+ ],
1256
1210
  additionalProperties: false
1257
1211
  }
1258
1212
  }