@equinor/fusion-framework-vite-plugin-spa 4.0.6 → 4.0.7
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 +6 -0
- package/dist/esm/html/sw.js +14 -4
- package/dist/esm/html/sw.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/html/bootstrap.js +1 -1
- package/dist/html/bootstrap.js.map +1 -1
- package/dist/html/sw.js +14 -4
- package/dist/html/sw.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/html/index.html.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +4 -4
- package/src/html/sw.ts +15 -4
- package/src/version.ts +1 -1
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
* @constant
|
|
16
16
|
* @type {string}
|
|
17
17
|
*/
|
|
18
|
-
export declare const html = "\n <!DOCTYPE html>\n <html>\n <head>\n <title>%FUSION_SPA_TITLE%</title>\n <meta name=\"mode\" content=\"%MODE%\">\n <meta name=\"fusion-spa-plugin-version\" content=\"4.0.
|
|
18
|
+
export declare const html = "\n <!DOCTYPE html>\n <html>\n <head>\n <title>%FUSION_SPA_TITLE%</title>\n <meta name=\"mode\" content=\"%MODE%\">\n <meta name=\"fusion-spa-plugin-version\" content=\"4.0.7\">\n <link rel=\"stylesheet\" href=\"https://cdn.eds.equinor.com/font/equinor-font.css\" />\n <script type=\"module\" src=\"%FUSION_SPA_BOOTSTRAP%\"></script>\n <script>\n // Set AG Grid license key globally if provided\n window.FUSION_AG_GRID_KEY = '%FUSION_SPA_AG_GRID_KEY%';\n \n // suppress console error for custom elements already defined. \n // WebComponents should be added by the portal, but not removed from application\n const _customElementsDefine = window.customElements.define;\n window.customElements.define = (name, cl, conf) => {\n if (!customElements.get(name)) {\n _customElementsDefine.call(window.customElements, name, cl, conf);\n }\n };\n </script>\n <style>\n html, body {\n margin: 0;\n padding: 0;\n height: 100%;\n font-family: 'EquinorFont', sans-serif;\n }\n </style>\n </head>\n <body></body>\n </html>\n";
|
|
19
19
|
export default html;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "4.0.
|
|
1
|
+
export declare const version = "4.0.7";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/fusion-framework-vite-plugin-spa",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.7",
|
|
4
4
|
"description": "Vite plugin for SPA development",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@equinor/fusion-framework-module
|
|
41
|
-
"@equinor/fusion-framework-module-service-discovery": "10.0.1",
|
|
40
|
+
"@equinor/fusion-framework-module": "6.0.0",
|
|
42
41
|
"@equinor/fusion-framework-module-http": "8.0.1",
|
|
42
|
+
"@equinor/fusion-framework-module-msal": "8.0.4",
|
|
43
43
|
"@equinor/fusion-framework-module-telemetry": "5.0.2",
|
|
44
|
-
"@equinor/fusion-framework-module": "
|
|
44
|
+
"@equinor/fusion-framework-module-service-discovery": "10.0.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@rollup/plugin-commonjs": "^29.0.0",
|
package/src/html/sw.ts
CHANGED
|
@@ -192,12 +192,13 @@ self.addEventListener('message', async (event: ExtendableMessageEvent) => {
|
|
|
192
192
|
|
|
193
193
|
// Handle fetch events
|
|
194
194
|
self.addEventListener('fetch', (event: FetchEvent) => {
|
|
195
|
-
const
|
|
195
|
+
const request = event.request.clone();
|
|
196
|
+
const url = new URL(request.url);
|
|
196
197
|
const matchedConfig = getMatchingConfig(url.toString());
|
|
197
198
|
|
|
198
199
|
// only handle requests that match the config
|
|
199
200
|
if (matchedConfig) {
|
|
200
|
-
const requestHeaders = new Headers(
|
|
201
|
+
const requestHeaders = new Headers(request.headers);
|
|
201
202
|
const handleRequest = async () => {
|
|
202
203
|
// if the matched config has scopes, append the token to the request
|
|
203
204
|
if (matchedConfig.scopes) {
|
|
@@ -210,8 +211,18 @@ self.addEventListener('fetch', (event: FetchEvent) => {
|
|
|
210
211
|
url.pathname = url.pathname.replace(matchedConfig?.url, matchedConfig.rewrite);
|
|
211
212
|
}
|
|
212
213
|
|
|
213
|
-
//
|
|
214
|
-
|
|
214
|
+
// Consume the ReadableStream body and convert to text
|
|
215
|
+
// ReadableStreams can only be consumed once, so we extract the content here
|
|
216
|
+
// request.text() resolves to empty string when the request has no body
|
|
217
|
+
const body = await request.text();
|
|
218
|
+
|
|
219
|
+
// fetch the request with the modified url and headers, preserving the original HTTP method and body
|
|
220
|
+
// This ensures OPTIONS, PATCH, DELETE and other methods are forwarded correctly
|
|
221
|
+
return fetch(url, {
|
|
222
|
+
method: request.method,
|
|
223
|
+
headers: requestHeaders,
|
|
224
|
+
body: body || undefined,
|
|
225
|
+
});
|
|
215
226
|
};
|
|
216
227
|
event.respondWith(handleRequest());
|
|
217
228
|
}
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '4.0.
|
|
2
|
+
export const version = '4.0.7';
|