@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/utils/mfe-port.js
CHANGED
|
@@ -575,33 +575,6 @@ var validateConfigDefaultApplication = (applicationConfigsById) => {
|
|
|
575
575
|
);
|
|
576
576
|
}
|
|
577
577
|
};
|
|
578
|
-
var validateDeprecatedFields = (config) => {
|
|
579
|
-
const errors = [];
|
|
580
|
-
for (const [applicationId, application] of Object.entries(
|
|
581
|
-
config.applications
|
|
582
|
-
)) {
|
|
583
|
-
if (application.development?.localPort) {
|
|
584
|
-
errors.push(
|
|
585
|
-
`Application '${applicationId}' cannot contain deprecated field 'development.localPort'. Use 'developement.local' instead.`
|
|
586
|
-
);
|
|
587
|
-
}
|
|
588
|
-
if (application.projectId) {
|
|
589
|
-
errors.push(
|
|
590
|
-
`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.`
|
|
591
|
-
);
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
if (errors.length) {
|
|
595
|
-
throw new MicrofrontendError(
|
|
596
|
-
`Microfrontends configuration file errors:
|
|
597
|
-
- ${errors.join("\n- ")}`,
|
|
598
|
-
{
|
|
599
|
-
type: "config",
|
|
600
|
-
subtype: "depcrecated_field"
|
|
601
|
-
}
|
|
602
|
-
);
|
|
603
|
-
}
|
|
604
|
-
};
|
|
605
578
|
|
|
606
579
|
// src/config/microfrontends-config/isomorphic/utils/generate-asset-prefix.ts
|
|
607
580
|
var PREFIX = "vc-ap";
|
|
@@ -706,20 +679,12 @@ var Host = class {
|
|
|
706
679
|
var LocalHost = class extends Host {
|
|
707
680
|
constructor({
|
|
708
681
|
appName,
|
|
709
|
-
localPort,
|
|
710
682
|
local
|
|
711
683
|
}) {
|
|
712
|
-
if (localPort && local) {
|
|
713
|
-
throw new Error(
|
|
714
|
-
`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.`
|
|
715
|
-
);
|
|
716
|
-
}
|
|
717
684
|
let protocol;
|
|
718
685
|
let host;
|
|
719
686
|
let port;
|
|
720
|
-
if (
|
|
721
|
-
port = localPort;
|
|
722
|
-
} else if (typeof local === "number") {
|
|
687
|
+
if (typeof local === "number") {
|
|
723
688
|
port = local;
|
|
724
689
|
} else if (typeof local === "string") {
|
|
725
690
|
if (/^\d+$/.test(local)) {
|
|
@@ -761,7 +726,6 @@ var Application = class {
|
|
|
761
726
|
this.development = {
|
|
762
727
|
local: new LocalHost({
|
|
763
728
|
appName: name,
|
|
764
|
-
localPort: app.development?.localPort,
|
|
765
729
|
local: app.development?.local
|
|
766
730
|
}),
|
|
767
731
|
fallback: app.development?.fallback ? new Host(app.development.fallback) : void 0
|
|
@@ -769,7 +733,6 @@ var Application = class {
|
|
|
769
733
|
if (app.development?.fallback) {
|
|
770
734
|
this.fallback = new Host(app.development.fallback);
|
|
771
735
|
}
|
|
772
|
-
this.projectId = app.projectId;
|
|
773
736
|
this.packageName = app.packageName;
|
|
774
737
|
this.overrides = overrides?.environment ? {
|
|
775
738
|
environment: new Host(overrides.environment)
|
|
@@ -833,11 +796,10 @@ var DEFAULT_LOCAL_PROXY_PORT = 3024;
|
|
|
833
796
|
var MicrofrontendConfigIsomorphic = class {
|
|
834
797
|
constructor({
|
|
835
798
|
config,
|
|
836
|
-
overrides
|
|
837
|
-
opts
|
|
799
|
+
overrides
|
|
838
800
|
}) {
|
|
839
801
|
this.childApplications = {};
|
|
840
|
-
MicrofrontendConfigIsomorphic.validate(config
|
|
802
|
+
MicrofrontendConfigIsomorphic.validate(config);
|
|
841
803
|
const disableOverrides = config.options?.disableOverrides ?? false;
|
|
842
804
|
this.overrides = overrides && !disableOverrides ? overrides : void 0;
|
|
843
805
|
let defaultApplication;
|
|
@@ -872,14 +834,10 @@ var MicrofrontendConfigIsomorphic = class {
|
|
|
872
834
|
overrides
|
|
873
835
|
};
|
|
874
836
|
}
|
|
875
|
-
static validate(config
|
|
876
|
-
const skipValidation = opts?.skipValidation ?? [];
|
|
837
|
+
static validate(config) {
|
|
877
838
|
const c = typeof config === "string" ? parse2(config) : config;
|
|
878
839
|
validateConfigPaths(c.applications);
|
|
879
840
|
validateConfigDefaultApplication(c.applications);
|
|
880
|
-
if (!skipValidation.includes("deprecatedFields")) {
|
|
881
|
-
validateDeprecatedFields(c);
|
|
882
|
-
}
|
|
883
841
|
return c;
|
|
884
842
|
}
|
|
885
843
|
static fromEnv({
|
|
@@ -1060,7 +1018,9 @@ var schema_default = {
|
|
|
1060
1018
|
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"
|
|
1061
1019
|
}
|
|
1062
1020
|
},
|
|
1063
|
-
required: [
|
|
1021
|
+
required: [
|
|
1022
|
+
"applications"
|
|
1023
|
+
],
|
|
1064
1024
|
additionalProperties: false
|
|
1065
1025
|
},
|
|
1066
1026
|
Options: {
|
|
@@ -1099,11 +1059,6 @@ var schema_default = {
|
|
|
1099
1059
|
DefaultApplication: {
|
|
1100
1060
|
type: "object",
|
|
1101
1061
|
properties: {
|
|
1102
|
-
projectId: {
|
|
1103
|
-
type: "string",
|
|
1104
|
-
description: "Vercel project ID, only required if the application name / id is different to the Vercel project name.",
|
|
1105
|
-
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)."
|
|
1106
|
-
},
|
|
1107
1062
|
packageName: {
|
|
1108
1063
|
type: "string",
|
|
1109
1064
|
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`."
|
|
@@ -1113,21 +1068,21 @@ var schema_default = {
|
|
|
1113
1068
|
description: "Development configuration for the default application."
|
|
1114
1069
|
}
|
|
1115
1070
|
},
|
|
1116
|
-
required: [
|
|
1071
|
+
required: [
|
|
1072
|
+
"development"
|
|
1073
|
+
],
|
|
1117
1074
|
additionalProperties: false
|
|
1118
1075
|
},
|
|
1119
1076
|
DefaultDevelopment: {
|
|
1120
1077
|
type: "object",
|
|
1121
1078
|
properties: {
|
|
1122
1079
|
local: {
|
|
1123
|
-
type: [
|
|
1080
|
+
type: [
|
|
1081
|
+
"number",
|
|
1082
|
+
"string"
|
|
1083
|
+
],
|
|
1124
1084
|
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"
|
|
1125
1085
|
},
|
|
1126
|
-
localPort: {
|
|
1127
|
-
type: "number",
|
|
1128
|
-
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.",
|
|
1129
|
-
deprecated: "Please set the port with the 'local' field instead."
|
|
1130
|
-
},
|
|
1131
1086
|
task: {
|
|
1132
1087
|
type: "string",
|
|
1133
1088
|
description: "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
|
|
@@ -1137,17 +1092,14 @@ var schema_default = {
|
|
|
1137
1092
|
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."
|
|
1138
1093
|
}
|
|
1139
1094
|
},
|
|
1140
|
-
required: [
|
|
1095
|
+
required: [
|
|
1096
|
+
"fallback"
|
|
1097
|
+
],
|
|
1141
1098
|
additionalProperties: false
|
|
1142
1099
|
},
|
|
1143
1100
|
ChildApplication: {
|
|
1144
1101
|
type: "object",
|
|
1145
1102
|
properties: {
|
|
1146
|
-
projectId: {
|
|
1147
|
-
type: "string",
|
|
1148
|
-
description: "Vercel project ID, only required if the application name / id is different to the Vercel project name.",
|
|
1149
|
-
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)."
|
|
1150
|
-
},
|
|
1151
1103
|
packageName: {
|
|
1152
1104
|
type: "string",
|
|
1153
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`."
|
|
@@ -1161,21 +1113,21 @@ var schema_default = {
|
|
|
1161
1113
|
description: "Groups of path expressions that are routed to this application."
|
|
1162
1114
|
}
|
|
1163
1115
|
},
|
|
1164
|
-
required: [
|
|
1116
|
+
required: [
|
|
1117
|
+
"routing"
|
|
1118
|
+
],
|
|
1165
1119
|
additionalProperties: false
|
|
1166
1120
|
},
|
|
1167
1121
|
ChildDevelopment: {
|
|
1168
1122
|
type: "object",
|
|
1169
1123
|
properties: {
|
|
1170
1124
|
local: {
|
|
1171
|
-
type: [
|
|
1125
|
+
type: [
|
|
1126
|
+
"number",
|
|
1127
|
+
"string"
|
|
1128
|
+
],
|
|
1172
1129
|
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"
|
|
1173
1130
|
},
|
|
1174
|
-
localPort: {
|
|
1175
|
-
type: "number",
|
|
1176
|
-
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.",
|
|
1177
|
-
deprecated: "Please set the port with the 'local' field instead."
|
|
1178
|
-
},
|
|
1179
1131
|
task: {
|
|
1180
1132
|
type: "string",
|
|
1181
1133
|
description: "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
|
|
@@ -1211,7 +1163,9 @@ var schema_default = {
|
|
|
1211
1163
|
}
|
|
1212
1164
|
}
|
|
1213
1165
|
},
|
|
1214
|
-
required: [
|
|
1166
|
+
required: [
|
|
1167
|
+
"paths"
|
|
1168
|
+
],
|
|
1215
1169
|
additionalProperties: false
|
|
1216
1170
|
}
|
|
1217
1171
|
}
|