@equinor/fusion-framework-vite-plugin-spa 1.0.0-next.3 → 1.0.0-next.6
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 +41 -0
- package/dist/esm/plugin.js +13 -8
- package/dist/esm/plugin.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/html/bootstrap.js +32672 -0
- package/dist/html/bootstrap.js.map +1 -0
- package/dist/html/sw.js +171 -0
- package/dist/html/sw.js.map +1 -0
- 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 +19 -12
- package/rollup.config.js +20 -0
- package/src/plugin.ts +16 -8
- 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=\"1.0.0-next.
|
|
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=\"1.0.0-next.6\">\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 // 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 = "1.0.0-next.
|
|
1
|
+
export declare const version = "1.0.0-next.6";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/fusion-framework-vite-plugin-spa",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.6",
|
|
4
4
|
"description": "Vite plugin for SPA development",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -9,9 +9,13 @@
|
|
|
9
9
|
"import": "./dist/esm/index.js",
|
|
10
10
|
"types": "./dist/types/index.d.ts"
|
|
11
11
|
},
|
|
12
|
-
"./
|
|
13
|
-
"import": "./dist/
|
|
14
|
-
"types": "./dist/types/
|
|
12
|
+
"./bootstrap.js": {
|
|
13
|
+
"import": "./dist/html/bootstrap.js",
|
|
14
|
+
"types": "./dist/types/bootstrap.d.ts"
|
|
15
|
+
},
|
|
16
|
+
"./sw.js": {
|
|
17
|
+
"import": "./dist/html/sw.js",
|
|
18
|
+
"types": "./dist/types/sw.d.ts"
|
|
15
19
|
}
|
|
16
20
|
},
|
|
17
21
|
"directories": {
|
|
@@ -32,21 +36,24 @@
|
|
|
32
36
|
"publishConfig": {
|
|
33
37
|
"access": "public"
|
|
34
38
|
},
|
|
35
|
-
"
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@rollup/plugin-commonjs": "^28.0.3",
|
|
41
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
42
|
+
"@rollup/plugin-typescript": "^12.1.2",
|
|
43
|
+
"@types/lodash.mergewith": "^4.6.9",
|
|
36
44
|
"lodash.mergewith": "^4.6.2",
|
|
45
|
+
"rollup": "^4.39.0",
|
|
46
|
+
"typescript": "^5.5.4",
|
|
47
|
+
"vite": "^6.3.5",
|
|
37
48
|
"@equinor/fusion-framework-module": "^4.4.3-next.1",
|
|
38
49
|
"@equinor/fusion-framework-module-msal": "^4.0.7-next.1",
|
|
39
50
|
"@equinor/fusion-framework-module-service-discovery": "^8.0.15-next.2",
|
|
40
|
-
"@equinor/fusion-framework-
|
|
41
|
-
"@equinor/fusion-framework-
|
|
42
|
-
},
|
|
43
|
-
"devDependencies": {
|
|
44
|
-
"@types/lodash.mergewith": "^4.6.9",
|
|
45
|
-
"typescript": "^5.5.4",
|
|
46
|
-
"vite": "^6.3.5"
|
|
51
|
+
"@equinor/fusion-framework-vite-plugin-api-service": "^1.0.0-next.1",
|
|
52
|
+
"@equinor/fusion-framework-module-http": "^6.3.3-next.2"
|
|
47
53
|
},
|
|
48
54
|
"scripts": {
|
|
49
55
|
"build": "tsc -b",
|
|
56
|
+
"postbuild": "rollup -c rollup.config.js",
|
|
50
57
|
"test": "vitest"
|
|
51
58
|
}
|
|
52
59
|
}
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
2
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
3
|
+
|
|
4
|
+
/** @type {import('rollup').RollupOptions} */
|
|
5
|
+
export default [
|
|
6
|
+
{
|
|
7
|
+
input: {
|
|
8
|
+
'html/bootstrap': 'dist/esm/html/bootstrap.js',
|
|
9
|
+
'html/sw': 'dist/esm/html/sw.js',
|
|
10
|
+
},
|
|
11
|
+
output: {
|
|
12
|
+
format: 'esm',
|
|
13
|
+
dir: 'dist',
|
|
14
|
+
entryFileNames: '[name].js',
|
|
15
|
+
sourcemap: true,
|
|
16
|
+
strict: false,
|
|
17
|
+
},
|
|
18
|
+
plugins: [resolve({ preferBuiltins: true }), commonjs()],
|
|
19
|
+
},
|
|
20
|
+
];
|
package/src/plugin.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Plugin } from 'vite';
|
|
2
2
|
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
3
5
|
import mergeWith from 'lodash.mergewith';
|
|
4
6
|
|
|
5
7
|
import defaultTemplate from './html/index.html.js';
|
|
@@ -44,16 +46,22 @@ export const plugin = <TEnv extends TemplateEnv = TemplateEnv>(
|
|
|
44
46
|
|
|
45
47
|
return {
|
|
46
48
|
name: 'fusion-framework-plugin-spa',
|
|
47
|
-
resolveId(id) {
|
|
49
|
+
resolveId: async (id) => {
|
|
48
50
|
// resolve resource aliases to the correct path
|
|
49
51
|
switch (id) {
|
|
50
|
-
case '/@fusion-spa-bootstrap.js':
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
case '/@fusion-spa-bootstrap.js': {
|
|
53
|
+
const file = await import.meta.resolve(
|
|
54
|
+
'@equinor/fusion-framework-vite-plugin-spa/bootstrap.js',
|
|
55
|
+
);
|
|
56
|
+
return fileURLToPath(file);
|
|
57
|
+
}
|
|
58
|
+
case '/@fusion-spa-sw.js': {
|
|
59
|
+
const file = await import.meta.resolve('@equinor/fusion-framework-vite-plugin-spa/sw.js');
|
|
60
|
+
return fileURLToPath(file);
|
|
61
|
+
}
|
|
54
62
|
}
|
|
55
63
|
},
|
|
56
|
-
config(config, configEnv) {
|
|
64
|
+
config: async (config, configEnv) => {
|
|
57
65
|
const templateEnvPrefix = options?.templateEnvPrefix ?? 'FUSION_SPA_';
|
|
58
66
|
// generate environment variables from plugin options
|
|
59
67
|
const pluginEnvObj = { ...defaultEnv, ...options?.generateTemplateEnv?.(configEnv) };
|
|
@@ -79,8 +87,8 @@ export const plugin = <TEnv extends TemplateEnv = TemplateEnv>(
|
|
|
79
87
|
config.server ??= {};
|
|
80
88
|
config.server.fs ??= {};
|
|
81
89
|
config.server.fs.allow ??= [];
|
|
82
|
-
// allow access to the
|
|
83
|
-
config.server.fs.allow.push(new URL('
|
|
90
|
+
// allow access to the html directory
|
|
91
|
+
config.server.fs.allow.push(new URL('../html', import.meta.url).pathname);
|
|
84
92
|
|
|
85
93
|
log?.info(`plugin configured for ${env.FUSION_SPA_PORTAL_ID}`);
|
|
86
94
|
},
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '1.0.0-next.
|
|
2
|
+
export const version = '1.0.0-next.6';
|