@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.
- package/CHANGELOG.md +13 -0
- package/dist/bin/cli.cjs +28 -74
- package/dist/config.cjs +4 -46
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.ts +5 -11
- package/dist/config.js +4 -46
- package/dist/config.js.map +1 -1
- package/dist/experimental/sveltekit.cjs +27 -73
- package/dist/experimental/sveltekit.cjs.map +1 -1
- package/dist/experimental/sveltekit.js +27 -73
- package/dist/experimental/sveltekit.js.map +1 -1
- package/dist/experimental/vite.cjs +27 -73
- package/dist/experimental/vite.cjs.map +1 -1
- package/dist/experimental/vite.js +27 -73
- package/dist/experimental/vite.js.map +1 -1
- package/dist/microfrontends/server.cjs +27 -73
- package/dist/microfrontends/server.cjs.map +1 -1
- package/dist/microfrontends/server.d.ts +2 -2
- package/dist/microfrontends/server.js +27 -73
- package/dist/microfrontends/server.js.map +1 -1
- package/dist/next/config.cjs +27 -73
- package/dist/next/config.cjs.map +1 -1
- package/dist/next/config.js +27 -73
- package/dist/next/config.js.map +1 -1
- package/dist/next/middleware.cjs +4 -46
- package/dist/next/middleware.cjs.map +1 -1
- package/dist/next/middleware.js +4 -46
- package/dist/next/middleware.js.map +1 -1
- package/dist/next/testing.cjs +4 -46
- package/dist/next/testing.cjs.map +1 -1
- package/dist/next/testing.d.ts +2 -2
- package/dist/next/testing.js +4 -46
- package/dist/next/testing.js.map +1 -1
- package/dist/overrides.d.ts +3 -3
- package/dist/schema.d.ts +2 -2
- package/dist/{types-ab31c948.d.ts → types-1cec43e6.d.ts} +0 -15
- package/dist/{types-d3cb74a6.d.ts → types-1fb60496.d.ts} +1 -1
- package/dist/utils/mfe-port.cjs +27 -73
- package/dist/utils/mfe-port.cjs.map +1 -1
- package/dist/utils/mfe-port.js +27 -73
- package/dist/utils/mfe-port.js.map +1 -1
- package/dist/validation.cjs +23 -27
- package/dist/validation.cjs.map +1 -1
- package/dist/validation.d.ts +1 -1
- package/dist/validation.js +23 -27
- package/dist/validation.js.map +1 -1
- package/package.json +3 -3
- package/schema/schema.json +0 -20
|
@@ -571,33 +571,6 @@ var validateConfigDefaultApplication = (applicationConfigsById) => {
|
|
|
571
571
|
);
|
|
572
572
|
}
|
|
573
573
|
};
|
|
574
|
-
var validateDeprecatedFields = (config) => {
|
|
575
|
-
const errors = [];
|
|
576
|
-
for (const [applicationId, application] of Object.entries(
|
|
577
|
-
config.applications
|
|
578
|
-
)) {
|
|
579
|
-
if (application.development?.localPort) {
|
|
580
|
-
errors.push(
|
|
581
|
-
`Application '${applicationId}' cannot contain deprecated field 'development.localPort'. Use 'developement.local' instead.`
|
|
582
|
-
);
|
|
583
|
-
}
|
|
584
|
-
if (application.projectId) {
|
|
585
|
-
errors.push(
|
|
586
|
-
`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.`
|
|
587
|
-
);
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
if (errors.length) {
|
|
591
|
-
throw new MicrofrontendError(
|
|
592
|
-
`Microfrontends configuration file errors:
|
|
593
|
-
- ${errors.join("\n- ")}`,
|
|
594
|
-
{
|
|
595
|
-
type: "config",
|
|
596
|
-
subtype: "depcrecated_field"
|
|
597
|
-
}
|
|
598
|
-
);
|
|
599
|
-
}
|
|
600
|
-
};
|
|
601
574
|
|
|
602
575
|
// src/config/microfrontends-config/isomorphic/utils/generate-asset-prefix.ts
|
|
603
576
|
var PREFIX = "vc-ap";
|
|
@@ -702,20 +675,12 @@ var Host = class {
|
|
|
702
675
|
var LocalHost = class extends Host {
|
|
703
676
|
constructor({
|
|
704
677
|
appName,
|
|
705
|
-
localPort,
|
|
706
678
|
local
|
|
707
679
|
}) {
|
|
708
|
-
if (localPort && local) {
|
|
709
|
-
throw new Error(
|
|
710
|
-
`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.`
|
|
711
|
-
);
|
|
712
|
-
}
|
|
713
680
|
let protocol;
|
|
714
681
|
let host;
|
|
715
682
|
let port;
|
|
716
|
-
if (
|
|
717
|
-
port = localPort;
|
|
718
|
-
} else if (typeof local === "number") {
|
|
683
|
+
if (typeof local === "number") {
|
|
719
684
|
port = local;
|
|
720
685
|
} else if (typeof local === "string") {
|
|
721
686
|
if (/^\d+$/.test(local)) {
|
|
@@ -757,7 +722,6 @@ var Application = class {
|
|
|
757
722
|
this.development = {
|
|
758
723
|
local: new LocalHost({
|
|
759
724
|
appName: name,
|
|
760
|
-
localPort: app.development?.localPort,
|
|
761
725
|
local: app.development?.local
|
|
762
726
|
}),
|
|
763
727
|
fallback: app.development?.fallback ? new Host(app.development.fallback) : void 0
|
|
@@ -765,7 +729,6 @@ var Application = class {
|
|
|
765
729
|
if (app.development?.fallback) {
|
|
766
730
|
this.fallback = new Host(app.development.fallback);
|
|
767
731
|
}
|
|
768
|
-
this.projectId = app.projectId;
|
|
769
732
|
this.packageName = app.packageName;
|
|
770
733
|
this.overrides = overrides?.environment ? {
|
|
771
734
|
environment: new Host(overrides.environment)
|
|
@@ -829,11 +792,10 @@ var DEFAULT_LOCAL_PROXY_PORT = 3024;
|
|
|
829
792
|
var MicrofrontendConfigIsomorphic = class {
|
|
830
793
|
constructor({
|
|
831
794
|
config,
|
|
832
|
-
overrides
|
|
833
|
-
opts
|
|
795
|
+
overrides
|
|
834
796
|
}) {
|
|
835
797
|
this.childApplications = {};
|
|
836
|
-
MicrofrontendConfigIsomorphic.validate(config
|
|
798
|
+
MicrofrontendConfigIsomorphic.validate(config);
|
|
837
799
|
const disableOverrides = config.options?.disableOverrides ?? false;
|
|
838
800
|
this.overrides = overrides && !disableOverrides ? overrides : void 0;
|
|
839
801
|
let defaultApplication;
|
|
@@ -868,14 +830,10 @@ var MicrofrontendConfigIsomorphic = class {
|
|
|
868
830
|
overrides
|
|
869
831
|
};
|
|
870
832
|
}
|
|
871
|
-
static validate(config
|
|
872
|
-
const skipValidation = opts?.skipValidation ?? [];
|
|
833
|
+
static validate(config) {
|
|
873
834
|
const c = typeof config === "string" ? parse2(config) : config;
|
|
874
835
|
validateConfigPaths(c.applications);
|
|
875
836
|
validateConfigDefaultApplication(c.applications);
|
|
876
|
-
if (!skipValidation.includes("deprecatedFields")) {
|
|
877
|
-
validateDeprecatedFields(c);
|
|
878
|
-
}
|
|
879
837
|
return c;
|
|
880
838
|
}
|
|
881
839
|
static fromEnv({
|
|
@@ -1056,7 +1014,9 @@ var schema_default = {
|
|
|
1056
1014
|
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"
|
|
1057
1015
|
}
|
|
1058
1016
|
},
|
|
1059
|
-
required: [
|
|
1017
|
+
required: [
|
|
1018
|
+
"applications"
|
|
1019
|
+
],
|
|
1060
1020
|
additionalProperties: false
|
|
1061
1021
|
},
|
|
1062
1022
|
Options: {
|
|
@@ -1095,11 +1055,6 @@ var schema_default = {
|
|
|
1095
1055
|
DefaultApplication: {
|
|
1096
1056
|
type: "object",
|
|
1097
1057
|
properties: {
|
|
1098
|
-
projectId: {
|
|
1099
|
-
type: "string",
|
|
1100
|
-
description: "Vercel project ID, only required if the application name / id is different to the Vercel project name.",
|
|
1101
|
-
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)."
|
|
1102
|
-
},
|
|
1103
1058
|
packageName: {
|
|
1104
1059
|
type: "string",
|
|
1105
1060
|
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`."
|
|
@@ -1109,21 +1064,21 @@ var schema_default = {
|
|
|
1109
1064
|
description: "Development configuration for the default application."
|
|
1110
1065
|
}
|
|
1111
1066
|
},
|
|
1112
|
-
required: [
|
|
1067
|
+
required: [
|
|
1068
|
+
"development"
|
|
1069
|
+
],
|
|
1113
1070
|
additionalProperties: false
|
|
1114
1071
|
},
|
|
1115
1072
|
DefaultDevelopment: {
|
|
1116
1073
|
type: "object",
|
|
1117
1074
|
properties: {
|
|
1118
1075
|
local: {
|
|
1119
|
-
type: [
|
|
1076
|
+
type: [
|
|
1077
|
+
"number",
|
|
1078
|
+
"string"
|
|
1079
|
+
],
|
|
1120
1080
|
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"
|
|
1121
1081
|
},
|
|
1122
|
-
localPort: {
|
|
1123
|
-
type: "number",
|
|
1124
|
-
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.",
|
|
1125
|
-
deprecated: "Please set the port with the 'local' field instead."
|
|
1126
|
-
},
|
|
1127
1082
|
task: {
|
|
1128
1083
|
type: "string",
|
|
1129
1084
|
description: "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
|
|
@@ -1133,17 +1088,14 @@ var schema_default = {
|
|
|
1133
1088
|
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."
|
|
1134
1089
|
}
|
|
1135
1090
|
},
|
|
1136
|
-
required: [
|
|
1091
|
+
required: [
|
|
1092
|
+
"fallback"
|
|
1093
|
+
],
|
|
1137
1094
|
additionalProperties: false
|
|
1138
1095
|
},
|
|
1139
1096
|
ChildApplication: {
|
|
1140
1097
|
type: "object",
|
|
1141
1098
|
properties: {
|
|
1142
|
-
projectId: {
|
|
1143
|
-
type: "string",
|
|
1144
|
-
description: "Vercel project ID, only required if the application name / id is different to the Vercel project name.",
|
|
1145
|
-
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)."
|
|
1146
|
-
},
|
|
1147
1099
|
packageName: {
|
|
1148
1100
|
type: "string",
|
|
1149
1101
|
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`."
|
|
@@ -1157,21 +1109,21 @@ var schema_default = {
|
|
|
1157
1109
|
description: "Groups of path expressions that are routed to this application."
|
|
1158
1110
|
}
|
|
1159
1111
|
},
|
|
1160
|
-
required: [
|
|
1112
|
+
required: [
|
|
1113
|
+
"routing"
|
|
1114
|
+
],
|
|
1161
1115
|
additionalProperties: false
|
|
1162
1116
|
},
|
|
1163
1117
|
ChildDevelopment: {
|
|
1164
1118
|
type: "object",
|
|
1165
1119
|
properties: {
|
|
1166
1120
|
local: {
|
|
1167
|
-
type: [
|
|
1121
|
+
type: [
|
|
1122
|
+
"number",
|
|
1123
|
+
"string"
|
|
1124
|
+
],
|
|
1168
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"
|
|
1169
1126
|
},
|
|
1170
|
-
localPort: {
|
|
1171
|
-
type: "number",
|
|
1172
|
-
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.",
|
|
1173
|
-
deprecated: "Please set the port with the 'local' field instead."
|
|
1174
|
-
},
|
|
1175
1127
|
task: {
|
|
1176
1128
|
type: "string",
|
|
1177
1129
|
description: "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
|
|
@@ -1207,7 +1159,9 @@ var schema_default = {
|
|
|
1207
1159
|
}
|
|
1208
1160
|
}
|
|
1209
1161
|
},
|
|
1210
|
-
required: [
|
|
1162
|
+
required: [
|
|
1163
|
+
"paths"
|
|
1164
|
+
],
|
|
1211
1165
|
additionalProperties: false
|
|
1212
1166
|
}
|
|
1213
1167
|
}
|