@equinor/fusion-framework-cli 10.5.5 → 10.6.0
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 +16 -0
- package/dist/bin/create-dev-serve.js +9 -0
- package/dist/bin/create-dev-serve.js.map +1 -1
- package/dist/bin/dev-portal/Header.Actions.js.map +1 -1
- package/dist/bin/dev-portal/PersonSideSheet/sheets/FeatureSheetContent.js.map +1 -1
- package/dist/bin/dev-portal/config.js +16 -1
- package/dist/bin/dev-portal/config.js.map +1 -1
- package/dist/bin/public/assets/{index-B8bufLkr.js → index-BarrErBH.js} +7 -7
- package/dist/bin/public/index.html +1 -1
- package/dist/lib/plugins/help-proxy/help-proxy-plugin.js +90 -0
- package/dist/lib/plugins/help-proxy/help-proxy-plugin.js.map +1 -0
- package/dist/lib/plugins/help-proxy/index.js +2 -0
- package/dist/lib/plugins/help-proxy/index.js.map +1 -0
- package/dist/types/lib/plugins/help-proxy/help-proxy-plugin.d.ts +42 -0
- package/dist/types/lib/plugins/help-proxy/index.d.ts +1 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +17 -17
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Preserce token for executing proxy assets
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* This assumes the client will execute a api call using bearer token before
|
|
15
|
+
* acquiring a asset. By default the Framework will execute a rest call to load
|
|
16
|
+
* application manufest for resolving build assets to import
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* This is a quick and dirty method to authorize requests without bearer token
|
|
20
|
+
* like browser `import`.
|
|
21
|
+
* The correct way would be to have a auth controller within the dev-server,
|
|
22
|
+
* but since the token is only exposed to the plugin and the cli is a tool for
|
|
23
|
+
* local development, this should be sufficient.
|
|
24
|
+
*/
|
|
25
|
+
let __HELP_API_TOKEN__ = '';
|
|
26
|
+
/**
|
|
27
|
+
* The `helpProxyPlugin` function creates a Vite plugin that configures a proxy
|
|
28
|
+
* for assets API requests to the Fusion Help Service.
|
|
29
|
+
*
|
|
30
|
+
* @param {HelpProxyPluginOptions} options - The options for configuring the help proxy plugin.
|
|
31
|
+
*
|
|
32
|
+
* @returns {Plugin} - The configured Vite plugin.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const plugin = helpProxyPlugin({
|
|
37
|
+
* proxy: {
|
|
38
|
+
* path: '/help-proxy',
|
|
39
|
+
* target: 'https://help.ci.api.fusion-dev.net',
|
|
40
|
+
* onProxyReq: (proxyReq, req, res) => {
|
|
41
|
+
* proxyReq.on('response', (res) => { console.log(res.statusCode) });
|
|
42
|
+
* },
|
|
43
|
+
* },
|
|
44
|
+
* });
|
|
45
|
+
*
|
|
46
|
+
* // Fetch a resource through the proxy
|
|
47
|
+
* fetch('/help-proxy/assets/resources/images/image.jpg');
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export const helpProxyPlugin = (options) => {
|
|
51
|
+
const { proxy: { onProxyReq = () => void 0, path: proxyPath, target }, } = options;
|
|
52
|
+
return {
|
|
53
|
+
name: 'fusion:help-proxy',
|
|
54
|
+
apply: 'serve',
|
|
55
|
+
config(config) {
|
|
56
|
+
var _a;
|
|
57
|
+
(_a = config.server) !== null && _a !== void 0 ? _a : (config.server = {});
|
|
58
|
+
config.server.proxy = {
|
|
59
|
+
// proxy all api calls to the Fusion Help Proxy path
|
|
60
|
+
[proxyPath]: {
|
|
61
|
+
target,
|
|
62
|
+
changeOrigin: true,
|
|
63
|
+
secure: false,
|
|
64
|
+
rewrite: (path) => path.replace(proxyPath, ''),
|
|
65
|
+
configure: (proxy) => {
|
|
66
|
+
proxy.on('proxyReq', (proxyReq) => {
|
|
67
|
+
if (__HELP_API_TOKEN__) {
|
|
68
|
+
// apply token to proxy request
|
|
69
|
+
proxyReq.setHeader('authorization', __HELP_API_TOKEN__);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
proxy.on('proxyReq', onProxyReq);
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
configureServer(server) {
|
|
78
|
+
server.middlewares.use(proxyPath, (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
if (req.headers.authorization) {
|
|
80
|
+
__HELP_API_TOKEN__ = req.headers.authorization || '';
|
|
81
|
+
res.end();
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
next();
|
|
85
|
+
}));
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
export default helpProxyPlugin;
|
|
90
|
+
//# sourceMappingURL=help-proxy-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help-proxy-plugin.js","sourceRoot":"","sources":["../../../../src/lib/plugins/help-proxy/help-proxy-plugin.ts"],"names":[],"mappings":";;;;;;;;;AAGA;;;;;;;;;;;;;;GAcG;AACH,IAAI,kBAAkB,GAAG,EAAE,CAAC;AAiB5B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAA+B,EAAU,EAAE;IACzE,MAAM,EACJ,KAAK,EAAE,EAAE,UAAU,GAAG,GAAG,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QACL,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/plugins/help-proxy/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAA+B,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ClientRequest, IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
+
import type { Plugin } from 'vite';
|
|
3
|
+
/**
|
|
4
|
+
* Options for configuring the Help Proxy Plugin.
|
|
5
|
+
*/
|
|
6
|
+
export type HelpProxyPluginOptions = {
|
|
7
|
+
/** Configuration for the proxy. */
|
|
8
|
+
proxy: {
|
|
9
|
+
/** The path to be proxyed. */
|
|
10
|
+
path: string;
|
|
11
|
+
/** The target URL for the proxy. */
|
|
12
|
+
target: string;
|
|
13
|
+
/** Optional callback function to modify the proxy request. */
|
|
14
|
+
onProxyReq?: (proxyReq: ClientRequest, req: IncomingMessage, res: ServerResponse) => void;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The `helpProxyPlugin` function creates a Vite plugin that configures a proxy
|
|
19
|
+
* for assets API requests to the Fusion Help Service.
|
|
20
|
+
*
|
|
21
|
+
* @param {HelpProxyPluginOptions} options - The options for configuring the help proxy plugin.
|
|
22
|
+
*
|
|
23
|
+
* @returns {Plugin} - The configured Vite plugin.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const plugin = helpProxyPlugin({
|
|
28
|
+
* proxy: {
|
|
29
|
+
* path: '/help-proxy',
|
|
30
|
+
* target: 'https://help.ci.api.fusion-dev.net',
|
|
31
|
+
* onProxyReq: (proxyReq, req, res) => {
|
|
32
|
+
* proxyReq.on('response', (res) => { console.log(res.statusCode) });
|
|
33
|
+
* },
|
|
34
|
+
* },
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* // Fetch a resource through the proxy
|
|
38
|
+
* fetch('/help-proxy/assets/resources/images/image.jpg');
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare const helpProxyPlugin: (options: HelpProxyPluginOptions) => Plugin;
|
|
42
|
+
export default helpProxyPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, helpProxyPlugin, type HelpProxyPluginOptions } from './help-proxy-plugin.js';
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "10.
|
|
1
|
+
export declare const version = "10.6.0";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/fusion-framework-cli",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.6.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"Fusion",
|
|
6
6
|
"Fusion Framework",
|
|
@@ -83,22 +83,22 @@
|
|
|
83
83
|
"rollup": "^4.22.4",
|
|
84
84
|
"rxjs": "^7.8.1",
|
|
85
85
|
"styled-components": "^6.0.7",
|
|
86
|
-
"typescript": "^5.
|
|
87
|
-
"@equinor/fusion-framework": "^
|
|
88
|
-
"@equinor/fusion-framework-app": "^
|
|
89
|
-
"@equinor/fusion-framework-module-
|
|
90
|
-
"@equinor/fusion-framework
|
|
91
|
-
"@equinor/fusion-framework-
|
|
92
|
-
"@equinor/fusion-framework-module-feature-flag": "^1.1.
|
|
93
|
-
"@equinor/fusion-framework-module-navigation": "^4.0.
|
|
94
|
-
"@equinor/fusion-framework-module-msal": "^4.0.
|
|
95
|
-
"@equinor/fusion-framework-
|
|
96
|
-
"@equinor/fusion-framework-
|
|
97
|
-
"@equinor/fusion-framework-react-components-bookmark": "^1.0.
|
|
98
|
-
"@equinor/fusion-framework-react-components-people-provider": "^1.5.
|
|
99
|
-
"@equinor/fusion-framework-react-module-bookmark": "^3.0.
|
|
100
|
-
"@equinor/fusion-observable": "^8.4.
|
|
101
|
-
"@equinor/fusion-query": "^5.2.
|
|
86
|
+
"typescript": "^5.8.2",
|
|
87
|
+
"@equinor/fusion-framework-module-bookmark": "^2.1.3",
|
|
88
|
+
"@equinor/fusion-framework-module-app": "^6.1.6",
|
|
89
|
+
"@equinor/fusion-framework-module-context": "^5.0.19",
|
|
90
|
+
"@equinor/fusion-framework": "^7.3.3",
|
|
91
|
+
"@equinor/fusion-framework-app": "^9.3.3",
|
|
92
|
+
"@equinor/fusion-framework-module-feature-flag": "^1.1.14",
|
|
93
|
+
"@equinor/fusion-framework-module-navigation": "^4.0.9",
|
|
94
|
+
"@equinor/fusion-framework-module-msal": "^4.0.2",
|
|
95
|
+
"@equinor/fusion-framework-react": "^7.4.3",
|
|
96
|
+
"@equinor/fusion-framework-module-services": "^5.1.2",
|
|
97
|
+
"@equinor/fusion-framework-react-components-bookmark": "^1.0.11",
|
|
98
|
+
"@equinor/fusion-framework-react-components-people-provider": "^1.5.7",
|
|
99
|
+
"@equinor/fusion-framework-react-module-bookmark": "^3.0.3",
|
|
100
|
+
"@equinor/fusion-observable": "^8.4.6",
|
|
101
|
+
"@equinor/fusion-query": "^5.2.3"
|
|
102
102
|
},
|
|
103
103
|
"scripts": {
|
|
104
104
|
"prebuild": "pnpm build:source",
|