@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
package/dist/next/config.js
CHANGED
|
@@ -588,33 +588,6 @@ var validateConfigDefaultApplication = (applicationConfigsById) => {
|
|
|
588
588
|
);
|
|
589
589
|
}
|
|
590
590
|
};
|
|
591
|
-
var validateDeprecatedFields = (config) => {
|
|
592
|
-
const errors = [];
|
|
593
|
-
for (const [applicationId, application] of Object.entries(
|
|
594
|
-
config.applications
|
|
595
|
-
)) {
|
|
596
|
-
if (application.development?.localPort) {
|
|
597
|
-
errors.push(
|
|
598
|
-
`Application '${applicationId}' cannot contain deprecated field 'development.localPort'. Use 'developement.local' instead.`
|
|
599
|
-
);
|
|
600
|
-
}
|
|
601
|
-
if (application.projectId) {
|
|
602
|
-
errors.push(
|
|
603
|
-
`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.`
|
|
604
|
-
);
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
if (errors.length) {
|
|
608
|
-
throw new MicrofrontendError(
|
|
609
|
-
`Microfrontends configuration file errors:
|
|
610
|
-
- ${errors.join("\n- ")}`,
|
|
611
|
-
{
|
|
612
|
-
type: "config",
|
|
613
|
-
subtype: "depcrecated_field"
|
|
614
|
-
}
|
|
615
|
-
);
|
|
616
|
-
}
|
|
617
|
-
};
|
|
618
591
|
|
|
619
592
|
// src/config/microfrontends-config/isomorphic/utils/generate-asset-prefix.ts
|
|
620
593
|
var PREFIX = "vc-ap";
|
|
@@ -719,20 +692,12 @@ var Host = class {
|
|
|
719
692
|
var LocalHost = class extends Host {
|
|
720
693
|
constructor({
|
|
721
694
|
appName,
|
|
722
|
-
localPort,
|
|
723
695
|
local
|
|
724
696
|
}) {
|
|
725
|
-
if (localPort && local) {
|
|
726
|
-
throw new Error(
|
|
727
|
-
`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.`
|
|
728
|
-
);
|
|
729
|
-
}
|
|
730
697
|
let protocol;
|
|
731
698
|
let host;
|
|
732
699
|
let port;
|
|
733
|
-
if (
|
|
734
|
-
port = localPort;
|
|
735
|
-
} else if (typeof local === "number") {
|
|
700
|
+
if (typeof local === "number") {
|
|
736
701
|
port = local;
|
|
737
702
|
} else if (typeof local === "string") {
|
|
738
703
|
if (/^\d+$/.test(local)) {
|
|
@@ -774,7 +739,6 @@ var Application = class {
|
|
|
774
739
|
this.development = {
|
|
775
740
|
local: new LocalHost({
|
|
776
741
|
appName: name,
|
|
777
|
-
localPort: app.development?.localPort,
|
|
778
742
|
local: app.development?.local
|
|
779
743
|
}),
|
|
780
744
|
fallback: app.development?.fallback ? new Host(app.development.fallback) : void 0
|
|
@@ -782,7 +746,6 @@ var Application = class {
|
|
|
782
746
|
if (app.development?.fallback) {
|
|
783
747
|
this.fallback = new Host(app.development.fallback);
|
|
784
748
|
}
|
|
785
|
-
this.projectId = app.projectId;
|
|
786
749
|
this.packageName = app.packageName;
|
|
787
750
|
this.overrides = overrides?.environment ? {
|
|
788
751
|
environment: new Host(overrides.environment)
|
|
@@ -846,11 +809,10 @@ var DEFAULT_LOCAL_PROXY_PORT = 3024;
|
|
|
846
809
|
var MicrofrontendConfigIsomorphic = class {
|
|
847
810
|
constructor({
|
|
848
811
|
config,
|
|
849
|
-
overrides
|
|
850
|
-
opts
|
|
812
|
+
overrides
|
|
851
813
|
}) {
|
|
852
814
|
this.childApplications = {};
|
|
853
|
-
MicrofrontendConfigIsomorphic.validate(config
|
|
815
|
+
MicrofrontendConfigIsomorphic.validate(config);
|
|
854
816
|
const disableOverrides = config.options?.disableOverrides ?? false;
|
|
855
817
|
this.overrides = overrides && !disableOverrides ? overrides : void 0;
|
|
856
818
|
let defaultApplication;
|
|
@@ -885,14 +847,10 @@ var MicrofrontendConfigIsomorphic = class {
|
|
|
885
847
|
overrides
|
|
886
848
|
};
|
|
887
849
|
}
|
|
888
|
-
static validate(config
|
|
889
|
-
const skipValidation = opts?.skipValidation ?? [];
|
|
850
|
+
static validate(config) {
|
|
890
851
|
const c = typeof config === "string" ? parse2(config) : config;
|
|
891
852
|
validateConfigPaths(c.applications);
|
|
892
853
|
validateConfigDefaultApplication(c.applications);
|
|
893
|
-
if (!skipValidation.includes("deprecatedFields")) {
|
|
894
|
-
validateDeprecatedFields(c);
|
|
895
|
-
}
|
|
896
854
|
return c;
|
|
897
855
|
}
|
|
898
856
|
static fromEnv({
|
|
@@ -1073,7 +1031,9 @@ var schema_default = {
|
|
|
1073
1031
|
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"
|
|
1074
1032
|
}
|
|
1075
1033
|
},
|
|
1076
|
-
required: [
|
|
1034
|
+
required: [
|
|
1035
|
+
"applications"
|
|
1036
|
+
],
|
|
1077
1037
|
additionalProperties: false
|
|
1078
1038
|
},
|
|
1079
1039
|
Options: {
|
|
@@ -1112,11 +1072,6 @@ var schema_default = {
|
|
|
1112
1072
|
DefaultApplication: {
|
|
1113
1073
|
type: "object",
|
|
1114
1074
|
properties: {
|
|
1115
|
-
projectId: {
|
|
1116
|
-
type: "string",
|
|
1117
|
-
description: "Vercel project ID, only required if the application name / id is different to the Vercel project name.",
|
|
1118
|
-
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)."
|
|
1119
|
-
},
|
|
1120
1075
|
packageName: {
|
|
1121
1076
|
type: "string",
|
|
1122
1077
|
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`."
|
|
@@ -1126,21 +1081,21 @@ var schema_default = {
|
|
|
1126
1081
|
description: "Development configuration for the default application."
|
|
1127
1082
|
}
|
|
1128
1083
|
},
|
|
1129
|
-
required: [
|
|
1084
|
+
required: [
|
|
1085
|
+
"development"
|
|
1086
|
+
],
|
|
1130
1087
|
additionalProperties: false
|
|
1131
1088
|
},
|
|
1132
1089
|
DefaultDevelopment: {
|
|
1133
1090
|
type: "object",
|
|
1134
1091
|
properties: {
|
|
1135
1092
|
local: {
|
|
1136
|
-
type: [
|
|
1093
|
+
type: [
|
|
1094
|
+
"number",
|
|
1095
|
+
"string"
|
|
1096
|
+
],
|
|
1137
1097
|
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"
|
|
1138
1098
|
},
|
|
1139
|
-
localPort: {
|
|
1140
|
-
type: "number",
|
|
1141
|
-
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.",
|
|
1142
|
-
deprecated: "Please set the port with the 'local' field instead."
|
|
1143
|
-
},
|
|
1144
1099
|
task: {
|
|
1145
1100
|
type: "string",
|
|
1146
1101
|
description: "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
|
|
@@ -1150,17 +1105,14 @@ var schema_default = {
|
|
|
1150
1105
|
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."
|
|
1151
1106
|
}
|
|
1152
1107
|
},
|
|
1153
|
-
required: [
|
|
1108
|
+
required: [
|
|
1109
|
+
"fallback"
|
|
1110
|
+
],
|
|
1154
1111
|
additionalProperties: false
|
|
1155
1112
|
},
|
|
1156
1113
|
ChildApplication: {
|
|
1157
1114
|
type: "object",
|
|
1158
1115
|
properties: {
|
|
1159
|
-
projectId: {
|
|
1160
|
-
type: "string",
|
|
1161
|
-
description: "Vercel project ID, only required if the application name / id is different to the Vercel project name.",
|
|
1162
|
-
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)."
|
|
1163
|
-
},
|
|
1164
1116
|
packageName: {
|
|
1165
1117
|
type: "string",
|
|
1166
1118
|
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`."
|
|
@@ -1174,21 +1126,21 @@ var schema_default = {
|
|
|
1174
1126
|
description: "Groups of path expressions that are routed to this application."
|
|
1175
1127
|
}
|
|
1176
1128
|
},
|
|
1177
|
-
required: [
|
|
1129
|
+
required: [
|
|
1130
|
+
"routing"
|
|
1131
|
+
],
|
|
1178
1132
|
additionalProperties: false
|
|
1179
1133
|
},
|
|
1180
1134
|
ChildDevelopment: {
|
|
1181
1135
|
type: "object",
|
|
1182
1136
|
properties: {
|
|
1183
1137
|
local: {
|
|
1184
|
-
type: [
|
|
1138
|
+
type: [
|
|
1139
|
+
"number",
|
|
1140
|
+
"string"
|
|
1141
|
+
],
|
|
1185
1142
|
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"
|
|
1186
1143
|
},
|
|
1187
|
-
localPort: {
|
|
1188
|
-
type: "number",
|
|
1189
|
-
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.",
|
|
1190
|
-
deprecated: "Please set the port with the 'local' field instead."
|
|
1191
|
-
},
|
|
1192
1144
|
task: {
|
|
1193
1145
|
type: "string",
|
|
1194
1146
|
description: "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
|
|
@@ -1224,7 +1176,9 @@ var schema_default = {
|
|
|
1224
1176
|
}
|
|
1225
1177
|
}
|
|
1226
1178
|
},
|
|
1227
|
-
required: [
|
|
1179
|
+
required: [
|
|
1180
|
+
"paths"
|
|
1181
|
+
],
|
|
1228
1182
|
additionalProperties: false
|
|
1229
1183
|
}
|
|
1230
1184
|
}
|