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