@bleedingdev/modern-js-create 3.4.0-ultramodern.14 → 3.4.0-ultramodern.16
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/package.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"engines": {
|
|
22
22
|
"node": ">=20"
|
|
23
23
|
},
|
|
24
|
-
"version": "3.4.0-ultramodern.
|
|
24
|
+
"version": "3.4.0-ultramodern.16",
|
|
25
25
|
"types": "./dist/types/index.d.ts",
|
|
26
26
|
"main": "./dist/esm-node/index.js",
|
|
27
27
|
"bin": {
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"@modern-js/codesmith": "2.6.9",
|
|
78
78
|
"oxfmt": "0.55.0",
|
|
79
79
|
"ultracite": "7.8.3",
|
|
80
|
-
"@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.4.0-ultramodern.
|
|
80
|
+
"@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.4.0-ultramodern.16"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@rslib/core": "0.23.0",
|
|
@@ -99,6 +99,6 @@
|
|
|
99
99
|
"test": "rm -rf dist && rslib build -c rslibconfig.mts && rstest --passWithNoTests"
|
|
100
100
|
},
|
|
101
101
|
"ultramodern": {
|
|
102
|
-
"frameworkVersion": "3.4.0-ultramodern.
|
|
102
|
+
"frameworkVersion": "3.4.0-ultramodern.16"
|
|
103
103
|
}
|
|
104
104
|
}
|
|
@@ -6,6 +6,20 @@ function normalizeUrlWithTrailingSlash(url) {
|
|
|
6
6
|
return url.endsWith('/') ? url : `${url}/`;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
function resolveModuleFederationPublicPath(publicPath, manifestUrl) {
|
|
10
|
+
if (typeof publicPath !== 'string' || publicPath.trim().length === 0) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
return normalizeUrlWithTrailingSlash(
|
|
16
|
+
new URL(publicPath.trim(), manifestUrl).toString(),
|
|
17
|
+
);
|
|
18
|
+
} catch {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
9
23
|
async function fetchText(url) {
|
|
10
24
|
const response = await fetch(url);
|
|
11
25
|
return {
|
|
@@ -721,7 +735,8 @@ async function validateModuleFederationManifestEvidence(evidence, app, publicUrl
|
|
|
721
735
|
const budgets = qualityGates.budgets ?? {};
|
|
722
736
|
|
|
723
737
|
const manifestRoute = routes.mfManifest ?? '/mf-manifest.json';
|
|
724
|
-
const
|
|
738
|
+
const manifestUrl = joinUrl(publicUrl, manifestRoute);
|
|
739
|
+
const manifest = await fetchText(manifestUrl);
|
|
725
740
|
const manifestJson = parseMaybeJson(manifest.body);
|
|
726
741
|
evidence.assertions.push({
|
|
727
742
|
type: 'mf-manifest',
|
|
@@ -754,17 +769,26 @@ async function validateModuleFederationManifestEvidence(evidence, app, publicUrl
|
|
|
754
769
|
manifest.accessControlAllowOrigin === '*',
|
|
755
770
|
`${app.id} MF manifest is missing Cloudflare CORS headers`,
|
|
756
771
|
);
|
|
757
|
-
const expectedPublicPath = normalizeUrlWithTrailingSlash(
|
|
772
|
+
const expectedPublicPath = normalizeUrlWithTrailingSlash(
|
|
773
|
+
new URL('.', manifestUrl).toString(),
|
|
774
|
+
);
|
|
758
775
|
const manifestPublicPath = manifestJson?.metaData?.publicPath;
|
|
776
|
+
const resolvedPublicPath = resolveModuleFederationPublicPath(
|
|
777
|
+
manifestPublicPath,
|
|
778
|
+
manifestUrl,
|
|
779
|
+
);
|
|
759
780
|
evidence.assertions.push({
|
|
760
781
|
type: 'mf-manifest-public-path',
|
|
761
782
|
expected: expectedPublicPath,
|
|
762
783
|
actual: manifestPublicPath,
|
|
763
|
-
|
|
784
|
+
resolved: resolvedPublicPath,
|
|
785
|
+
status: resolvedPublicPath === expectedPublicPath ? 'pass' : 'fail',
|
|
764
786
|
});
|
|
765
787
|
assert(
|
|
766
|
-
|
|
767
|
-
`${app.id} MF manifest publicPath must resolve remote assets from ${expectedPublicPath}
|
|
788
|
+
resolvedPublicPath === expectedPublicPath,
|
|
789
|
+
`${app.id} MF manifest publicPath must resolve remote assets from ${expectedPublicPath}; got ${String(
|
|
790
|
+
manifestPublicPath,
|
|
791
|
+
)}`,
|
|
768
792
|
);
|
|
769
793
|
}
|
|
770
794
|
|
|
@@ -848,4 +872,4 @@ async function validateApp(app, publicUrl) {
|
|
|
848
872
|
return evidence;
|
|
849
873
|
}
|
|
850
874
|
|
|
851
|
-
export { validateApp };
|
|
875
|
+
export { resolveModuleFederationPublicPath, validateApp };
|