@equinor/fusion-framework-cli 9.12.14 → 10.0.0-alpha-17c4eed176e5b4a0fcf867ed245471d3863af237
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 +144 -0
- package/README.md +31 -9
- package/dist/bin/bundle-application.js +3 -2
- package/dist/bin/bundle-application.js.map +1 -1
- package/dist/bin/create-dev-serve.js +84 -113
- package/dist/bin/create-dev-serve.js.map +1 -1
- package/dist/bin/create-export-config.js +68 -6
- package/dist/bin/create-export-config.js.map +1 -1
- package/dist/bin/create-export-manifest.js +3 -4
- package/dist/bin/create-export-manifest.js.map +1 -1
- package/dist/bin/dev-portal/config.js +6 -2
- package/dist/bin/dev-portal/config.js.map +1 -1
- package/dist/bin/main.app.js +42 -1
- package/dist/bin/main.app.js.map +1 -1
- package/dist/bin/main.js +2 -3
- package/dist/bin/main.js.map +1 -1
- package/dist/bin/plugins/app-proxy.js +137 -0
- package/dist/bin/plugins/app-proxy.js.map +1 -0
- package/dist/bin/plugins/external-public.js +67 -0
- package/dist/bin/plugins/external-public.js.map +1 -0
- package/dist/bin/public/assets/{index-D2ohTVV3.js → index-BF2-imeq.js} +407 -407
- package/dist/bin/public/index.html +1 -1
- package/dist/bin/publish-application.js +102 -0
- package/dist/bin/publish-application.js.map +1 -0
- package/dist/bin/tag-application.js +80 -0
- package/dist/bin/tag-application.js.map +1 -0
- package/dist/bin/upload-application.js +69 -0
- package/dist/bin/upload-application.js.map +1 -0
- package/dist/bin/utils/{execute-commant.js → execute-command.js} +1 -1
- package/dist/bin/utils/{execute-commant.js.map → execute-command.js.map} +1 -1
- package/dist/bin/utils/format.js +1 -1
- package/dist/bin/utils/format.js.map +1 -1
- package/dist/bin/utils/getEndpointUrl.js +49 -0
- package/dist/bin/utils/getEndpointUrl.js.map +1 -0
- package/dist/bin/utils/index.js +14 -0
- package/dist/bin/utils/index.js.map +1 -0
- package/dist/bin/utils/isAppRegistered.js +30 -0
- package/dist/bin/utils/isAppRegistered.js.map +1 -0
- package/dist/bin/utils/load-manifest.js +7 -3
- package/dist/bin/utils/load-manifest.js.map +1 -1
- package/dist/bin/utils/proxy-request-logger.js +34 -0
- package/dist/bin/utils/proxy-request-logger.js.map +1 -0
- package/dist/bin/utils/publishAppConfig.js +34 -0
- package/dist/bin/utils/publishAppConfig.js.map +1 -0
- package/dist/bin/utils/requireToken.js +10 -0
- package/dist/bin/utils/requireToken.js.map +1 -0
- package/dist/bin/utils/tagAppBundle.js +33 -0
- package/dist/bin/utils/tagAppBundle.js.map +1 -0
- package/dist/bin/utils/uploadAppBundle.js +52 -0
- package/dist/bin/utils/uploadAppBundle.js.map +1 -0
- package/dist/lib/app-config.js.map +1 -1
- package/dist/lib/app-manifest.js +35 -11
- package/dist/lib/app-manifest.js.map +1 -1
- package/dist/lib/app-package.js +55 -6
- package/dist/lib/app-package.js.map +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/vite-config.js +1 -3
- package/dist/lib/vite-config.js.map +1 -1
- package/dist/types/bin/create-export-config.d.ts +6 -2
- package/dist/types/bin/create-export-manifest.d.ts +1 -8
- package/dist/types/bin/plugins/app-proxy.d.ts +70 -0
- package/dist/types/bin/plugins/external-public.d.ts +22 -0
- package/dist/types/bin/publish-application.d.ts +6 -0
- package/dist/types/bin/tag-application.d.ts +12 -0
- package/dist/types/bin/upload-application.d.ts +6 -0
- package/dist/types/bin/utils/getEndpointUrl.d.ts +10 -0
- package/dist/types/bin/utils/index.d.ts +14 -0
- package/dist/types/bin/utils/isAppRegistered.d.ts +7 -0
- package/dist/types/bin/utils/load-app-config.d.ts +1 -1
- package/dist/types/bin/utils/load-manifest.d.ts +2 -1
- package/dist/types/bin/utils/proxy-request-logger.d.ts +15 -0
- package/dist/types/bin/utils/publishAppConfig.d.ts +9 -0
- package/dist/types/bin/utils/requireToken.d.ts +4 -0
- package/dist/types/bin/utils/tagAppBundle.d.ts +7 -0
- package/dist/types/bin/utils/uploadAppBundle.d.ts +7 -0
- package/dist/types/lib/app-config.d.ts +1 -6
- package/dist/types/lib/app-manifest.d.ts +16 -20
- package/dist/types/lib/app-package.d.ts +35 -4
- package/dist/types/lib/index.d.ts +2 -2
- package/package.json +26 -31
- package/dist/bin/dev-proxy.js +0 -82
- package/dist/bin/dev-proxy.js.map +0 -1
- package/dist/index.js +0 -13
- package/dist/index.js.map +0 -1
- package/dist/types/bin/dev-proxy.d.ts +0 -27
- package/dist/types/index.d.ts +0 -4
- /package/dist/types/bin/utils/{execute-commant.d.ts → execute-command.d.ts} +0 -0
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
import { ResolvedAppPackage } from './app-package.js';
|
|
2
2
|
import { type FindConfigOptions, type ResolvedConfig, ConfigExecuterEnv } from './utils/config.js';
|
|
3
3
|
import { RecursivePartial } from './utils/types.js';
|
|
4
|
-
export type
|
|
4
|
+
export type AppManifestExport = {
|
|
5
5
|
version: string;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
main?: string;
|
|
14
|
-
icon?: string;
|
|
15
|
-
/** this will be deprecated when new app management is live */
|
|
16
|
-
resource?: string[];
|
|
6
|
+
entryPoint: string;
|
|
7
|
+
timestamp?: string;
|
|
8
|
+
commitSha?: string;
|
|
9
|
+
githubRepo?: string;
|
|
10
|
+
projectPage?: string;
|
|
11
|
+
annotations?: Record<string, string>;
|
|
12
|
+
allowedExtensions?: string[];
|
|
17
13
|
};
|
|
18
14
|
export type AppManifestFn = (env: ConfigExecuterEnv, args: {
|
|
19
|
-
base:
|
|
20
|
-
}) =>
|
|
15
|
+
base: AppManifestExport;
|
|
16
|
+
}) => AppManifestExport | Promise<AppManifestExport>;
|
|
21
17
|
type FindManifestOptions = FindConfigOptions & {
|
|
22
18
|
file?: string;
|
|
23
19
|
};
|
|
@@ -42,7 +38,7 @@ export declare const manifestConfigFilename = "app.manifest.config";
|
|
|
42
38
|
* @param fnOrObj - defines the manifest as an object or callback
|
|
43
39
|
*/
|
|
44
40
|
export declare const defineAppManifest: (fn: AppManifestFn) => AppManifestFn;
|
|
45
|
-
export declare function assertAppManifest(value:
|
|
41
|
+
export declare function assertAppManifest(value: AppManifestExport): asserts value;
|
|
46
42
|
/**
|
|
47
43
|
* @example
|
|
48
44
|
* ```ts
|
|
@@ -52,9 +48,9 @@ export declare function assertAppManifest(value: AppManifest): asserts value;
|
|
|
52
48
|
* @param overrides target manifest to apply to base
|
|
53
49
|
* @returns deep merged manifest
|
|
54
50
|
*/
|
|
55
|
-
export declare const mergeManifests: (base: RecursivePartial<
|
|
51
|
+
export declare const mergeManifests: (base: RecursivePartial<AppManifestExport>, overrides: RecursivePartial<AppManifestExport>) => AppManifestExport;
|
|
56
52
|
/** loads manifestFn from file */
|
|
57
|
-
export declare const loadManifest: (filename?: string) => Promise<import("./utils/config.js").ConfigExecuter<
|
|
53
|
+
export declare const loadManifest: (filename?: string) => Promise<import("./utils/config.js").ConfigExecuter<AppManifestExport, import("./utils/config.js").ConfigExecuterArgs>>;
|
|
58
54
|
/**
|
|
59
55
|
* tries to resolve manifest
|
|
60
56
|
* @see {@link resolveConfig | resolving config}
|
|
@@ -62,9 +58,9 @@ export declare const loadManifest: (filename?: string) => Promise<import("./util
|
|
|
62
58
|
export declare const resolveManifest: (options?: FindConfigOptions & {
|
|
63
59
|
file?: string;
|
|
64
60
|
}) => Promise<ResolvedConfig<AppManifestFn> | void>;
|
|
65
|
-
export declare const createManifestFromPackage: (pkg: ResolvedAppPackage) =>
|
|
66
|
-
export declare const createManifest: (env: ConfigExecuterEnv, base:
|
|
67
|
-
manifest:
|
|
61
|
+
export declare const createManifestFromPackage: (pkg: ResolvedAppPackage) => AppManifestExport;
|
|
62
|
+
export declare const createManifest: (env: ConfigExecuterEnv, base: AppManifestExport, options?: FindManifestOptions) => Promise<{
|
|
63
|
+
manifest: AppManifestExport;
|
|
68
64
|
path?: string;
|
|
69
65
|
}>;
|
|
70
66
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PackageJson, type NormalizeOptions as ResolveAppPackageOptions } from 'read-package-up';
|
|
2
|
-
import {
|
|
2
|
+
import { ApplicationManifest } from '@equinor/fusion-framework-module-app';
|
|
3
3
|
export type AppPackageJson = PackageJson & {
|
|
4
|
-
manifest?:
|
|
4
|
+
manifest?: ApplicationManifest;
|
|
5
5
|
};
|
|
6
6
|
type DefinePackageFn = () => AppPackageJson | Promise<AppPackageJson>;
|
|
7
7
|
type DefinePackageExporter = AppPackageJson | DefinePackageFn;
|
|
@@ -16,8 +16,39 @@ export type ResolvedAppPackage = {
|
|
|
16
16
|
path: string;
|
|
17
17
|
};
|
|
18
18
|
export declare function defineAppPackage(fnOrObject: DefinePackageExporter): DefinePackageExporter;
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Resolves the entry point of a given package.
|
|
21
|
+
*
|
|
22
|
+
* This function attempts to find the entry point of a package by checking several
|
|
23
|
+
* common properties in the package's `package.json` file, such as `entrypoint`, `main`,
|
|
24
|
+
* and `module`. If none of these properties are found, it defaults to checking for
|
|
25
|
+
* common entry files like `src/index.ts`, `src/index.tsx`, `src/index.js`, and `src/index.jsx`.
|
|
26
|
+
*
|
|
27
|
+
* @param pkg - The resolved application package containing the package.json and path information.
|
|
28
|
+
* @returns The relative path to the resolved entry point.
|
|
29
|
+
* @throws Will throw an error if no entry point can be resolved.
|
|
30
|
+
*/
|
|
31
|
+
export declare const resolveEntryPoint: (packageJson: PackageJson, pkgPath?: string) => string;
|
|
32
|
+
/**
|
|
33
|
+
* Resolves the application key from the given package.json object.
|
|
34
|
+
*
|
|
35
|
+
* @param packageJson - An object containing the 'name' property from the package.json.
|
|
36
|
+
* @returns The resolved application key, which is the package name with any leading '@' or scope removed.
|
|
37
|
+
* @throws Will throw an error if the 'name' property is not present in the packageJson.
|
|
38
|
+
*/
|
|
20
39
|
export declare const resolveAppKey: (packageJson: Pick<PackageJson, "name">) => string;
|
|
21
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Asserts the validity of a given package by resolving its application key and entry point.
|
|
42
|
+
*
|
|
43
|
+
* @param pkg - A partial representation of the application's package JSON.
|
|
44
|
+
*/
|
|
45
|
+
export declare const assertPackage: (pkg: Partial<AppPackageJson>) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Resolves the application package by searching for the nearest `package.json` file.
|
|
48
|
+
*
|
|
49
|
+
* @param options - Optional parameters to customize the search behavior.
|
|
50
|
+
* @returns A promise that resolves to the found package information.
|
|
51
|
+
* @throws Will throw an error if the `package.json` file is not found.
|
|
52
|
+
*/
|
|
22
53
|
export declare const resolveAppPackage: (options?: ResolveAppPackageOptions) => Promise<ResolvedAppPackage>;
|
|
23
54
|
export default resolveAppPackage;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { mergeManifests, defineAppManifest, type
|
|
2
|
-
export { mergeAppConfigs, defineAppConfig, type
|
|
1
|
+
export { mergeManifests, defineAppManifest, type AppManifestFn } from './app-manifest.js';
|
|
2
|
+
export { mergeAppConfigs, defineAppConfig, type AppConfigFn, type AppConfigExport, } from './app-config.js';
|
|
3
3
|
export { defineAppPackage, resolveAppKey, resolveEntryPoint, type AppPackageJson, type ResolvedAppPackage, } from './app-package.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/fusion-framework-cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0-alpha-17c4eed176e5b4a0fcf867ed245471d3863af237",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"Fusion",
|
|
6
6
|
"Fusion Framework",
|
|
@@ -24,23 +24,11 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@equinor/eds-core-react": "^0.41.2",
|
|
28
|
-
"@equinor/eds-icons": "^0.21.0",
|
|
29
|
-
"@equinor/eds-tokens": "^0.9.2",
|
|
30
|
-
"@equinor/fusion-wc-chip": "^1.2.1",
|
|
31
|
-
"@equinor/fusion-wc-person": "^3.0.1",
|
|
32
|
-
"@types/adm-zip": "^0.5.0",
|
|
33
|
-
"@types/semver": "^7.5.0",
|
|
34
|
-
"@vitejs/plugin-react": "^4.0.4",
|
|
35
27
|
"adm-zip": "^0.5.10",
|
|
36
28
|
"chalk": "^5.3.0",
|
|
37
29
|
"commander": "^12.0.0",
|
|
38
30
|
"deepmerge": "^4.3.1",
|
|
39
|
-
"express": "^4.18.2",
|
|
40
|
-
"express-rate-limit": "^7.0.0",
|
|
41
31
|
"find-up": "^7.0.0",
|
|
42
|
-
"http-proxy-middleware": "^2.0.6",
|
|
43
|
-
"is-mergeable-object": "^1.1.1",
|
|
44
32
|
"ora": "^8.0.1",
|
|
45
33
|
"portfinder": "^1.0.32",
|
|
46
34
|
"pretty-bytes": "^6.1.1",
|
|
@@ -50,45 +38,52 @@
|
|
|
50
38
|
"vite-plugin-environment": "^1.1.3",
|
|
51
39
|
"vite-plugin-restart": "^0.4.0",
|
|
52
40
|
"vite-tsconfig-paths": "^4.2.0",
|
|
53
|
-
"@
|
|
54
|
-
"@equinor/fusion-framework-app": "^9.1.7",
|
|
55
|
-
"@equinor/fusion-framework-react-components-people-provider": "^1.4.6",
|
|
56
|
-
"@equinor/fusion-observable": "^8.4.1"
|
|
41
|
+
"@vitejs/plugin-react": "^4.0.4"
|
|
57
42
|
},
|
|
58
43
|
"devDependencies": {
|
|
44
|
+
"@equinor/eds-core-react": "^0.41.2",
|
|
45
|
+
"@equinor/eds-icons": "^0.21.0",
|
|
46
|
+
"@equinor/eds-tokens": "^0.9.2",
|
|
47
|
+
"@equinor/fusion-wc-chip": "^1.2.1",
|
|
48
|
+
"@equinor/fusion-wc-person": "^3.0.1",
|
|
49
|
+
"@equinor/eslint-config-fusion-react": "^2.0.1",
|
|
59
50
|
"@equinor/fusion-react-context-selector": "^0.6.6",
|
|
60
51
|
"@equinor/fusion-react-progress-indicator": "^0.3.0",
|
|
61
52
|
"@equinor/fusion-react-side-sheet": "1.3.3",
|
|
62
53
|
"@equinor/fusion-react-styles": "^0.6.0",
|
|
63
54
|
"@material-ui/styles": "^4.11.5",
|
|
64
|
-
"@types/express": "^4.17.17",
|
|
65
55
|
"@types/node": "^20.11.14",
|
|
66
56
|
"@types/react": "^18.2.50",
|
|
67
57
|
"@types/react-dom": "^18.2.7",
|
|
58
|
+
"eslint-plugin-rxjs": "^5.0.3",
|
|
68
59
|
"react": "^18.2.0",
|
|
69
60
|
"react-dom": "^18.2.0",
|
|
70
61
|
"react-router-dom": "^6.15.0",
|
|
71
|
-
"rollup": "^4.3.0",
|
|
72
62
|
"rxjs": "^7.8.1",
|
|
73
63
|
"styled-components": "^6.0.7",
|
|
74
64
|
"typescript": "^5.5.4",
|
|
75
|
-
"@
|
|
76
|
-
"@
|
|
65
|
+
"@types/adm-zip": "^0.5.0",
|
|
66
|
+
"@types/semver": "^7.5.0",
|
|
67
|
+
"@equinor/fusion-framework-module-feature-flag": "^1.1.9-alpha-17c4eed176e5b4a0fcf867ed245471d3863af237",
|
|
68
|
+
"@equinor/fusion-framework-react-components-people-provider": "^1.4.7-alpha-17c4eed176e5b4a0fcf867ed245471d3863af237",
|
|
69
|
+
"@equinor/fusion-framework": "^7.2.7-alpha-17c4eed176e5b4a0fcf867ed245471d3863af237",
|
|
77
70
|
"@equinor/fusion-framework-module-app": "^5.3.11",
|
|
78
|
-
"@equinor/fusion-
|
|
79
|
-
"@equinor/fusion-framework-
|
|
80
|
-
"@equinor/fusion-framework-module-
|
|
81
|
-
"@equinor/fusion-framework-module-
|
|
82
|
-
"@equinor/fusion-framework-module-
|
|
83
|
-
"@equinor/fusion-framework-module-
|
|
84
|
-
"@equinor/fusion-framework-
|
|
85
|
-
"@equinor/fusion-framework-react
|
|
86
|
-
"@equinor/fusion-
|
|
87
|
-
"@equinor/fusion-framework-react-module-bookmark": "^2.1.
|
|
71
|
+
"@equinor/fusion-observable": "^8.4.1",
|
|
72
|
+
"@equinor/fusion-framework-app": "^9.1.8-alpha-17c4eed176e5b4a0fcf867ed245471d3863af237",
|
|
73
|
+
"@equinor/fusion-framework-module-bookmark": "^1.2.12-alpha-17c4eed176e5b4a0fcf867ed245471d3863af237",
|
|
74
|
+
"@equinor/fusion-framework-module-context": "^5.0.12-alpha-17c4eed176e5b4a0fcf867ed245471d3863af237",
|
|
75
|
+
"@equinor/fusion-framework-module-msal": "^3.1.5-alpha-17c4eed176e5b4a0fcf867ed245471d3863af237",
|
|
76
|
+
"@equinor/fusion-framework-module-navigation": "^4.0.7-alpha-17c4eed176e5b4a0fcf867ed245471d3863af237",
|
|
77
|
+
"@equinor/fusion-framework-module-services": "^4.1.4-alpha-17c4eed176e5b4a0fcf867ed245471d3863af237",
|
|
78
|
+
"@equinor/fusion-framework-react": "^7.2.2-alpha-17c4eed176e5b4a0fcf867ed245471d3863af237",
|
|
79
|
+
"@equinor/fusion-framework-react-components-bookmark": "^0.4.16-alpha-17c4eed176e5b4a0fcf867ed245471d3863af237",
|
|
80
|
+
"@equinor/fusion-framework-react-module-bookmark": "^2.1.16-alpha-17c4eed176e5b4a0fcf867ed245471d3863af237",
|
|
81
|
+
"@equinor/fusion-query": "^5.1.3"
|
|
88
82
|
},
|
|
89
83
|
"scripts": {
|
|
90
84
|
"prebuild": "pnpm build:source",
|
|
91
85
|
"build": "pnpm build:source && pnpm build:dev-server",
|
|
86
|
+
"build:clean": "rm -rf dist && rm -f tsconfig.tsbuildinfo && pnpm build",
|
|
92
87
|
"build:source": "tsc -b",
|
|
93
88
|
"build:dev-server": "vite build"
|
|
94
89
|
}
|
package/dist/bin/dev-proxy.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
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
|
-
import express from 'express';
|
|
11
|
-
import { createProxyMiddleware, responseInterceptor, } from 'http-proxy-middleware';
|
|
12
|
-
import { Spinner } from './utils/spinner.js';
|
|
13
|
-
import chalk, { formatPath } from './utils/format.js';
|
|
14
|
-
const createResponseInterceptor = (cb) => {
|
|
15
|
-
return responseInterceptor((responseBuffer, proxyRes, req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
-
var _a, _b, _c;
|
|
17
|
-
res.setHeader('x-proxy-status-message', (_a = proxyRes.statusMessage) !== null && _a !== void 0 ? _a : '');
|
|
18
|
-
res.setHeader('x-proxy-status-code', (_b = proxyRes.statusCode) !== null && _b !== void 0 ? _b : '');
|
|
19
|
-
const { response, statusCode, path } = (_c = (yield Promise.resolve(cb(req.params, proxyRes,
|
|
20
|
-
// might check??
|
|
21
|
-
Number(proxyRes.statusCode) < 400 &&
|
|
22
|
-
JSON.parse(responseBuffer.toString('utf8')))))) !== null && _c !== void 0 ? _c : {};
|
|
23
|
-
if (statusCode) {
|
|
24
|
-
res.statusCode = statusCode;
|
|
25
|
-
}
|
|
26
|
-
if (response) {
|
|
27
|
-
path && res.setHeader('x-interceptor-handler', path);
|
|
28
|
-
return JSON.stringify(response);
|
|
29
|
-
}
|
|
30
|
-
return responseBuffer;
|
|
31
|
-
}));
|
|
32
|
-
};
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
|
-
export const createDevProxy = (handler, options) => {
|
|
35
|
-
var _a;
|
|
36
|
-
const proxyOptions = Object.assign({
|
|
37
|
-
changeOrigin: true,
|
|
38
|
-
selfHandleResponse: true,
|
|
39
|
-
onProxyReq: (proxyReq) => {
|
|
40
|
-
const spinner = Spinner.Clone();
|
|
41
|
-
spinner.ora.suffixText = formatPath([proxyReq.protocol, '//', proxyReq.host, proxyReq.path].join(''));
|
|
42
|
-
spinner.start('proxy request');
|
|
43
|
-
proxyReq.on('response', (res) => {
|
|
44
|
-
var _a;
|
|
45
|
-
if (Number(res.statusCode) < 400) {
|
|
46
|
-
spinner.succeed();
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
spinner.warn(chalk.yellow((_a = res.statusMessage) !== null && _a !== void 0 ? _a : `${res.statusCode} `));
|
|
50
|
-
}
|
|
51
|
-
spinner.stop();
|
|
52
|
-
});
|
|
53
|
-
proxyReq.on('error', () => {
|
|
54
|
-
spinner.fail();
|
|
55
|
-
});
|
|
56
|
-
},
|
|
57
|
-
}, options);
|
|
58
|
-
const app = express();
|
|
59
|
-
app.disable('x-powered-by');
|
|
60
|
-
(_a = options.staticAssets) === null || _a === void 0 ? void 0 : _a.forEach((asset) => {
|
|
61
|
-
app.use(express.static(asset.path, asset.options));
|
|
62
|
-
});
|
|
63
|
-
app.use(createProxyMiddleware('/_discovery/environments/current', Object.assign(Object.assign({}, proxyOptions), { onProxyRes: responseInterceptor((responseBuffer, _proxyRes, req) => __awaiter(void 0, void 0, void 0, function* () {
|
|
64
|
-
const response = JSON.parse(responseBuffer.toString('utf8'));
|
|
65
|
-
response.environmentName = 'DEVELOPMENT';
|
|
66
|
-
response.services = response.services.filter((x) => x.key !== 'app');
|
|
67
|
-
/** refer service [app] to vite middleware */
|
|
68
|
-
response.services.push({
|
|
69
|
-
key: 'app',
|
|
70
|
-
uri: new URL('/', req.headers.referer).href,
|
|
71
|
-
});
|
|
72
|
-
return JSON.stringify(response);
|
|
73
|
-
})) })));
|
|
74
|
-
app.get('/api/apps/:appKey/config',
|
|
75
|
-
// '/api/widget/:appKey/config',
|
|
76
|
-
createProxyMiddleware('/api/apps/*/config', Object.assign(Object.assign({}, proxyOptions), { onProxyRes: createResponseInterceptor(handler.onConfigResponse) })));
|
|
77
|
-
app.get('/api/apps/:appKey', createProxyMiddleware('/api/apps/*', Object.assign(Object.assign({}, proxyOptions), { onProxyRes: createResponseInterceptor(handler.onManifestResponse) })));
|
|
78
|
-
app.get('/api/apps', createProxyMiddleware('/api/apps', Object.assign(Object.assign({}, proxyOptions), { onProxyRes: createResponseInterceptor(handler.onManifestListResponse) })));
|
|
79
|
-
return app;
|
|
80
|
-
};
|
|
81
|
-
export default createDevProxy;
|
|
82
|
-
//# sourceMappingURL=dev-proxy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dev-proxy.js","sourceRoot":"","sources":["../../src/bin/dev-proxy.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,OAAuC,MAAM,SAAS,CAAC;AAE9D,OAAO,EACH,qBAAqB,EACrB,mBAAmB,GAEtB,MAAM,uBAAuB,CAAC;AAK/B,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAuBtD,MAAM,yBAAyB,GAAG,CAC9B,EAAsF,EACxF,EAAE;IACA,OAAO,mBAAmB,CAAC,CAAO,cAAc,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;;QACpE,GAAG,CAAC,SAAS,CAAC,wBAAwB,EAAE,MAAA,QAAQ,CAAC,aAAa,mCAAI,EAAE,CAAC,CAAC;QACtE,GAAG,CAAC,SAAS,CAAC,qBAAqB,EAAE,MAAA,QAAQ,CAAC,UAAU,mCAAI,EAAE,CAAC,CAAC;QAChE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,GAChC,MAAA,CAAC,MAAM,OAAO,CAAC,OAAO,CAClB,EAAE,CACG,GAAsB,CAAC,MAAM,EAC9B,QAAQ;QACR,gBAAgB;QAChB,MAAM,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O,CAAC,OAAO,CAAC,CAAC,IAAI;aAC9C,CAAC,CAAC;YACH,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACpC,CAAC,CAAA,CAAC,IACJ,CACL,CAAC;IAEF,GAAG,CAAC,GAAG,CACH,0BAA0B;IAC1B,gCAAgC;IAChC,qBAAqB,CAAC,oBAAoB,kCACnC,YAAY,KACf,UAAU,EAAE,yBAAyB,CAAC,OAAO,CAAC,gBAAgB,CAAC,IACjE,CACL,CAAC;IAEF,GAAG,CAAC,GAAG,CACH,mBAAmB,EACnB,qBAAqB,CAAC,aAAa,kCAC5B,YAAY,KACf,UAAU,EAAE,yBAAyB,CAAC,OAAO,CAAC,kBAAkB,CAAC,IACnE,CACL,CAAC;IAEF,GAAG,CAAC,GAAG,CACH,WAAW,EACX,qBAAqB,CAAC,WAAW,kCAC1B,YAAY,KACf,UAAU,EAAE,yBAAyB,CAAC,OAAO,CAAC,sBAAsB,CAAC,IACvE,CACL,CAAC;IAEF,OAAO,GAAG,CAAC;AACf,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/dist/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as ReactDOM from 'react-dom/client';
|
|
3
|
-
// import 'vite/modulepreload-polyfill';
|
|
4
|
-
const Test = (args) => {
|
|
5
|
-
return (_jsxs("div", { children: [_jsx("p", { children: "Hello there this is all! good \uD83E\uDD19\uD83C\uDFFB" }), _jsx("pre", { children: JSON.stringify(args, undefined, 4) })] }));
|
|
6
|
-
};
|
|
7
|
-
export const render = (el, args) => {
|
|
8
|
-
const root = ReactDOM.createRoot(el);
|
|
9
|
-
root.render(_jsx(Test, { env: args.env }));
|
|
10
|
-
return () => root.unmount();
|
|
11
|
-
};
|
|
12
|
-
export default render;
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAE7C,wCAAwC;AAExC,MAAM,IAAI,GAAG,CAAC,IAAsB,EAAE,EAAE;IACpC,OAAO,CACH,0BACI,iFAAyC,EACzC,wBAAM,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,GAAO,IAC7C,CACT,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EAAe,EAAE,IAAsB,EAAE,EAAE;IAC9D,MAAM,IAAI,GAAG,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IACrC,IAAI,CAAC,MAAM,CAAC,KAAC,IAAI,IAAC,GAAG,EAAE,IAAI,CAAC,GAAG,GAAI,CAAC,CAAC;IACrC,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;AAChC,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import express, { type Express } from 'express';
|
|
2
|
-
import { type Options as ProxyOptions } from 'http-proxy-middleware';
|
|
3
|
-
import { type AppManifest } from '../lib/app-manifest.js';
|
|
4
|
-
import { type IncomingMessage } from 'node:http';
|
|
5
|
-
import { type AppConfig } from '../lib/app-config.js';
|
|
6
|
-
type ProxyHandlerResult<T> = {
|
|
7
|
-
response?: T;
|
|
8
|
-
statusCode?: number;
|
|
9
|
-
path?: string;
|
|
10
|
-
} | void;
|
|
11
|
-
type ProxyHandlerReturn<T> = Promise<ProxyHandlerResult<T>> | ProxyHandlerResult<T>;
|
|
12
|
-
export interface ProxyHandler {
|
|
13
|
-
onManifestListResponse(slug: object, message: IncomingMessage, data?: Array<AppManifest>): ProxyHandlerReturn<Array<AppManifest>>;
|
|
14
|
-
onManifestResponse(slug: {
|
|
15
|
-
appKey: string;
|
|
16
|
-
}, message: IncomingMessage, data?: AppManifest): ProxyHandlerReturn<AppManifest>;
|
|
17
|
-
onConfigResponse(slug: {
|
|
18
|
-
appKey: string;
|
|
19
|
-
}, message: IncomingMessage, data?: AppConfig): ProxyHandlerReturn<AppConfig>;
|
|
20
|
-
}
|
|
21
|
-
export declare const createDevProxy: (handler: ProxyHandler, options: Pick<ProxyOptions, "target"> & {
|
|
22
|
-
staticAssets?: {
|
|
23
|
-
path: string;
|
|
24
|
-
options?: Parameters<typeof express.static>[1];
|
|
25
|
-
}[];
|
|
26
|
-
}) => Express;
|
|
27
|
-
export default createDevProxy;
|
package/dist/types/index.d.ts
DELETED
|
File without changes
|