@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
@@ -606,33 +606,6 @@ var validateConfigDefaultApplication = (applicationConfigsById) => {
606
606
  );
607
607
  }
608
608
  };
609
- var validateDeprecatedFields = (config) => {
610
- const errors = [];
611
- for (const [applicationId, application] of Object.entries(
612
- config.applications
613
- )) {
614
- if (application.development?.localPort) {
615
- errors.push(
616
- `Application '${applicationId}' cannot contain deprecated field 'development.localPort'. Use 'developement.local' instead.`
617
- );
618
- }
619
- if (application.projectId) {
620
- errors.push(
621
- `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.`
622
- );
623
- }
624
- }
625
- if (errors.length) {
626
- throw new MicrofrontendError(
627
- `Microfrontends configuration file errors:
628
- - ${errors.join("\n- ")}`,
629
- {
630
- type: "config",
631
- subtype: "depcrecated_field"
632
- }
633
- );
634
- }
635
- };
636
609
 
637
610
  // src/config/microfrontends-config/isomorphic/utils/generate-asset-prefix.ts
638
611
  var PREFIX = "vc-ap";
@@ -737,20 +710,12 @@ var Host = class {
737
710
  var LocalHost = class extends Host {
738
711
  constructor({
739
712
  appName,
740
- localPort,
741
713
  local
742
714
  }) {
743
- if (localPort && local) {
744
- throw new Error(
745
- `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.`
746
- );
747
- }
748
715
  let protocol;
749
716
  let host;
750
717
  let port;
751
- if (localPort) {
752
- port = localPort;
753
- } else if (typeof local === "number") {
718
+ if (typeof local === "number") {
754
719
  port = local;
755
720
  } else if (typeof local === "string") {
756
721
  if (/^\d+$/.test(local)) {
@@ -792,7 +757,6 @@ var Application = class {
792
757
  this.development = {
793
758
  local: new LocalHost({
794
759
  appName: name,
795
- localPort: app.development?.localPort,
796
760
  local: app.development?.local
797
761
  }),
798
762
  fallback: app.development?.fallback ? new Host(app.development.fallback) : void 0
@@ -800,7 +764,6 @@ var Application = class {
800
764
  if (app.development?.fallback) {
801
765
  this.fallback = new Host(app.development.fallback);
802
766
  }
803
- this.projectId = app.projectId;
804
767
  this.packageName = app.packageName;
805
768
  this.overrides = overrides?.environment ? {
806
769
  environment: new Host(overrides.environment)
@@ -864,11 +827,10 @@ var DEFAULT_LOCAL_PROXY_PORT = 3024;
864
827
  var MicrofrontendConfigIsomorphic = class {
865
828
  constructor({
866
829
  config,
867
- overrides,
868
- opts
830
+ overrides
869
831
  }) {
870
832
  this.childApplications = {};
871
- MicrofrontendConfigIsomorphic.validate(config, opts);
833
+ MicrofrontendConfigIsomorphic.validate(config);
872
834
  const disableOverrides = config.options?.disableOverrides ?? false;
873
835
  this.overrides = overrides && !disableOverrides ? overrides : void 0;
874
836
  let defaultApplication;
@@ -903,14 +865,10 @@ var MicrofrontendConfigIsomorphic = class {
903
865
  overrides
904
866
  };
905
867
  }
906
- static validate(config, opts) {
907
- const skipValidation = opts?.skipValidation ?? [];
868
+ static validate(config) {
908
869
  const c = typeof config === "string" ? (0, import_jsonc_parser2.parse)(config) : config;
909
870
  validateConfigPaths(c.applications);
910
871
  validateConfigDefaultApplication(c.applications);
911
- if (!skipValidation.includes("deprecatedFields")) {
912
- validateDeprecatedFields(c);
913
- }
914
872
  return c;
915
873
  }
916
874
  static fromEnv({
@@ -1091,7 +1049,9 @@ var schema_default = {
1091
1049
  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"
1092
1050
  }
1093
1051
  },
1094
- required: ["applications"],
1052
+ required: [
1053
+ "applications"
1054
+ ],
1095
1055
  additionalProperties: false
1096
1056
  },
1097
1057
  Options: {
@@ -1130,11 +1090,6 @@ var schema_default = {
1130
1090
  DefaultApplication: {
1131
1091
  type: "object",
1132
1092
  properties: {
1133
- projectId: {
1134
- type: "string",
1135
- description: "Vercel project ID, only required if the application name / id is different to the Vercel project name.",
1136
- 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)."
1137
- },
1138
1093
  packageName: {
1139
1094
  type: "string",
1140
1095
  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`."
@@ -1144,21 +1099,21 @@ var schema_default = {
1144
1099
  description: "Development configuration for the default application."
1145
1100
  }
1146
1101
  },
1147
- required: ["development"],
1102
+ required: [
1103
+ "development"
1104
+ ],
1148
1105
  additionalProperties: false
1149
1106
  },
1150
1107
  DefaultDevelopment: {
1151
1108
  type: "object",
1152
1109
  properties: {
1153
1110
  local: {
1154
- type: ["number", "string"],
1111
+ type: [
1112
+ "number",
1113
+ "string"
1114
+ ],
1155
1115
  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"
1156
1116
  },
1157
- localPort: {
1158
- type: "number",
1159
- 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.",
1160
- deprecated: "Please set the port with the 'local' field instead."
1161
- },
1162
1117
  task: {
1163
1118
  type: "string",
1164
1119
  description: "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
@@ -1168,17 +1123,14 @@ var schema_default = {
1168
1123
  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."
1169
1124
  }
1170
1125
  },
1171
- required: ["fallback"],
1126
+ required: [
1127
+ "fallback"
1128
+ ],
1172
1129
  additionalProperties: false
1173
1130
  },
1174
1131
  ChildApplication: {
1175
1132
  type: "object",
1176
1133
  properties: {
1177
- projectId: {
1178
- type: "string",
1179
- description: "Vercel project ID, only required if the application name / id is different to the Vercel project name.",
1180
- 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)."
1181
- },
1182
1134
  packageName: {
1183
1135
  type: "string",
1184
1136
  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`."
@@ -1192,21 +1144,21 @@ var schema_default = {
1192
1144
  description: "Groups of path expressions that are routed to this application."
1193
1145
  }
1194
1146
  },
1195
- required: ["routing"],
1147
+ required: [
1148
+ "routing"
1149
+ ],
1196
1150
  additionalProperties: false
1197
1151
  },
1198
1152
  ChildDevelopment: {
1199
1153
  type: "object",
1200
1154
  properties: {
1201
1155
  local: {
1202
- type: ["number", "string"],
1156
+ type: [
1157
+ "number",
1158
+ "string"
1159
+ ],
1203
1160
  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"
1204
1161
  },
1205
- localPort: {
1206
- type: "number",
1207
- 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.",
1208
- deprecated: "Please set the port with the 'local' field instead."
1209
- },
1210
1162
  task: {
1211
1163
  type: "string",
1212
1164
  description: "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
@@ -1242,7 +1194,9 @@ var schema_default = {
1242
1194
  }
1243
1195
  }
1244
1196
  },
1245
- required: ["paths"],
1197
+ required: [
1198
+ "paths"
1199
+ ],
1246
1200
  additionalProperties: false
1247
1201
  }
1248
1202
  }