@equinor/fusion-framework-cli 10.0.0-beta-8c92234668d5f4b20de0650ff947f3afeb7c335c → 10.0.0-next-9f6eec8c5a4cb3dd430fc6bee227442a3dc28bb8

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.
Files changed (175) hide show
  1. package/CHANGELOG.md +399 -6
  2. package/README.md +31 -9
  3. package/dist/bin/build-application.js +22 -1
  4. package/dist/bin/build-application.js.map +1 -1
  5. package/dist/bin/bundle-application.js +8 -11
  6. package/dist/bin/bundle-application.js.map +1 -1
  7. package/dist/bin/create-dev-serve.js +89 -117
  8. package/dist/bin/create-dev-serve.js.map +1 -1
  9. package/dist/bin/create-export-config.js +54 -12
  10. package/dist/bin/create-export-config.js.map +1 -1
  11. package/dist/bin/create-export-manifest.js +44 -36
  12. package/dist/bin/create-export-manifest.js.map +1 -1
  13. package/dist/bin/dev-portal/AppLoader.js +23 -0
  14. package/dist/bin/dev-portal/AppLoader.js.map +1 -1
  15. package/dist/bin/dev-portal/ContextSelector/ContextSelector.js +17 -2
  16. package/dist/bin/dev-portal/ContextSelector/ContextSelector.js.map +1 -1
  17. package/dist/bin/dev-portal/ContextSelector/useContextResolver.js +35 -1
  18. package/dist/bin/dev-portal/ContextSelector/useContextResolver.js.map +1 -1
  19. package/dist/bin/dev-portal/Header.js +1 -0
  20. package/dist/bin/dev-portal/Header.js.map +1 -1
  21. package/dist/bin/dev-portal/PersonSideSheet/index.js +4 -0
  22. package/dist/bin/dev-portal/PersonSideSheet/index.js.map +1 -1
  23. package/dist/bin/dev-portal/PersonSideSheet/sheets/FeatureSheetContent.js +4 -0
  24. package/dist/bin/dev-portal/PersonSideSheet/sheets/FeatureSheetContent.js.map +1 -1
  25. package/dist/bin/dev-portal/PersonSideSheet/sheets/FeatureTogglerApp.js +3 -0
  26. package/dist/bin/dev-portal/PersonSideSheet/sheets/FeatureTogglerApp.js.map +1 -1
  27. package/dist/bin/dev-portal/PersonSideSheet/sheets/FeatureTogglerPortal.js +3 -0
  28. package/dist/bin/dev-portal/PersonSideSheet/sheets/FeatureTogglerPortal.js.map +1 -1
  29. package/dist/bin/dev-portal/PersonSideSheet/sheets/LandingSheetContent.js +3 -0
  30. package/dist/bin/dev-portal/PersonSideSheet/sheets/LandingSheetContent.js.map +1 -1
  31. package/dist/bin/dev-portal/Router.js +3 -0
  32. package/dist/bin/dev-portal/Router.js.map +1 -1
  33. package/dist/bin/dev-portal/config.js +7 -2
  34. package/dist/bin/dev-portal/config.js.map +1 -1
  35. package/dist/bin/dev-portal/useAppContextNavigation.js +27 -6
  36. package/dist/bin/dev-portal/useAppContextNavigation.js.map +1 -1
  37. package/dist/bin/main.app.js +32 -19
  38. package/dist/bin/main.app.js.map +1 -1
  39. package/dist/bin/main.js +3 -0
  40. package/dist/bin/main.js.map +1 -1
  41. package/dist/bin/public/assets/index-CwGBhRCD.js +5235 -0
  42. package/dist/bin/public/index.html +1 -1
  43. package/dist/bin/publish-application.js +75 -20
  44. package/dist/bin/publish-application.js.map +1 -1
  45. package/dist/bin/tag-application.js +52 -16
  46. package/dist/bin/tag-application.js.map +1 -1
  47. package/dist/bin/upload-application.js +47 -14
  48. package/dist/bin/upload-application.js.map +1 -1
  49. package/dist/bin/utils/{execute-commant.js → execute-command.js} +5 -2
  50. package/dist/bin/utils/execute-command.js.map +1 -0
  51. package/dist/bin/utils/format.js +1 -1
  52. package/dist/bin/utils/format.js.map +1 -1
  53. package/dist/bin/utils/getEndpointUrl.js +49 -0
  54. package/dist/bin/utils/getEndpointUrl.js.map +1 -0
  55. package/dist/bin/utils/index.js +14 -0
  56. package/dist/bin/utils/index.js.map +1 -0
  57. package/dist/bin/utils/isAppRegistered.js +32 -0
  58. package/dist/bin/utils/isAppRegistered.js.map +1 -0
  59. package/dist/bin/utils/load-app-config.js +1 -0
  60. package/dist/bin/utils/load-app-config.js.map +1 -1
  61. package/dist/bin/utils/load-manifest.js +9 -4
  62. package/dist/bin/utils/load-manifest.js.map +1 -1
  63. package/dist/bin/utils/proxy-request-logger.js +34 -0
  64. package/dist/bin/utils/proxy-request-logger.js.map +1 -0
  65. package/dist/bin/utils/publishAppConfig.js +36 -0
  66. package/dist/bin/utils/publishAppConfig.js.map +1 -0
  67. package/dist/bin/utils/requireToken.js +10 -0
  68. package/dist/bin/utils/requireToken.js.map +1 -0
  69. package/dist/bin/utils/spinner.js +10 -0
  70. package/dist/bin/utils/spinner.js.map +1 -1
  71. package/dist/bin/utils/tagAppBundle.js +35 -0
  72. package/dist/bin/utils/tagAppBundle.js.map +1 -0
  73. package/dist/bin/utils/uploadAppBundle.js +54 -0
  74. package/dist/bin/utils/uploadAppBundle.js.map +1 -0
  75. package/dist/lib/app-config.js +3 -1
  76. package/dist/lib/app-config.js.map +1 -1
  77. package/dist/lib/app-manifest.js +97 -15
  78. package/dist/lib/app-manifest.js.map +1 -1
  79. package/dist/lib/app-package.js +52 -5
  80. package/dist/lib/app-package.js.map +1 -1
  81. package/dist/lib/plugins/app-assets/app-asset-plugin.js +102 -0
  82. package/dist/lib/plugins/app-assets/app-asset-plugin.js.map +1 -0
  83. package/dist/lib/plugins/app-assets/emit-asset.js +41 -0
  84. package/dist/lib/plugins/app-assets/emit-asset.js.map +1 -0
  85. package/dist/lib/plugins/app-assets/extension-filter-pattern.js +20 -0
  86. package/dist/lib/plugins/app-assets/extension-filter-pattern.js.map +1 -0
  87. package/dist/lib/plugins/app-assets/index.js +4 -0
  88. package/dist/lib/plugins/app-assets/index.js.map +1 -0
  89. package/dist/lib/plugins/app-assets/read-asset-content.js +34 -0
  90. package/dist/lib/plugins/app-assets/read-asset-content.js.map +1 -0
  91. package/dist/lib/plugins/app-assets/resolve-asset-id.js +63 -0
  92. package/dist/lib/plugins/app-assets/resolve-asset-id.js.map +1 -0
  93. package/dist/lib/plugins/app-assets/static.js +15 -0
  94. package/dist/lib/plugins/app-assets/static.js.map +1 -0
  95. package/dist/lib/plugins/app-proxy/app-proxy-plugin.js +127 -0
  96. package/dist/lib/plugins/app-proxy/app-proxy-plugin.js.map +1 -0
  97. package/dist/lib/plugins/app-proxy/index.js +2 -0
  98. package/dist/lib/plugins/app-proxy/index.js.map +1 -0
  99. package/dist/lib/plugins/external-public/external-public-plugin.js +103 -0
  100. package/dist/lib/plugins/external-public/external-public-plugin.js.map +1 -0
  101. package/dist/lib/plugins/external-public/index.js +2 -0
  102. package/dist/lib/plugins/external-public/index.js.map +1 -0
  103. package/dist/lib/utils/assert.js +2 -1
  104. package/dist/lib/utils/assert.js.map +1 -1
  105. package/dist/lib/utils/config.js +5 -0
  106. package/dist/lib/utils/config.js.map +1 -1
  107. package/dist/lib/vite-config.js +4 -4
  108. package/dist/lib/vite-config.js.map +1 -1
  109. package/dist/lib/vite-logger.js +2 -0
  110. package/dist/lib/vite-logger.js.map +1 -1
  111. package/dist/types/bin/build-application.d.ts +4 -3
  112. package/dist/types/bin/create-dev-serve.d.ts +1 -1
  113. package/dist/types/bin/create-export-config.d.ts +3 -3
  114. package/dist/types/bin/create-export-manifest.d.ts +6 -9
  115. package/dist/types/bin/dev-portal/AppLoader.d.ts +7 -0
  116. package/dist/types/bin/dev-portal/ContextSelector/ContextSelector.d.ts +5 -0
  117. package/dist/types/bin/dev-portal/ContextSelector/useContextResolver.d.ts +6 -0
  118. package/dist/types/bin/dev-portal/FusionLogo.d.ts +0 -1
  119. package/dist/types/bin/dev-portal/PersonSideSheet/index.d.ts +4 -0
  120. package/dist/types/bin/dev-portal/PersonSideSheet/sheets/FeatureSheetContent.d.ts +4 -0
  121. package/dist/types/bin/dev-portal/PersonSideSheet/sheets/FeatureTogglerApp.d.ts +3 -0
  122. package/dist/types/bin/dev-portal/PersonSideSheet/sheets/FeatureTogglerPortal.d.ts +3 -0
  123. package/dist/types/bin/dev-portal/PersonSideSheet/sheets/LandingSheetContent.d.ts +3 -0
  124. package/dist/types/bin/dev-portal/PersonSideSheet/sheets/Styled.d.ts +4 -5
  125. package/dist/types/bin/dev-portal/useAppContextNavigation.d.ts +4 -0
  126. package/dist/types/bin/publish-application.d.ts +1 -1
  127. package/dist/types/bin/tag-application.d.ts +1 -1
  128. package/dist/types/bin/upload-application.d.ts +1 -1
  129. package/dist/types/bin/utils/execute-command.d.ts +8 -0
  130. package/dist/types/bin/utils/format.d.ts +0 -2
  131. package/dist/types/bin/utils/getEndpointUrl.d.ts +10 -0
  132. package/dist/types/bin/utils/index.d.ts +14 -0
  133. package/dist/types/bin/utils/isAppRegistered.d.ts +7 -0
  134. package/dist/types/bin/utils/load-app-config.d.ts +1 -1
  135. package/dist/types/bin/utils/load-manifest.d.ts +3 -2
  136. package/dist/types/bin/utils/proxy-request-logger.d.ts +15 -0
  137. package/dist/types/bin/utils/publishAppConfig.d.ts +9 -0
  138. package/dist/types/bin/utils/requireToken.d.ts +4 -0
  139. package/dist/types/bin/utils/spinner.d.ts +1 -0
  140. package/dist/types/bin/utils/tagAppBundle.d.ts +7 -0
  141. package/dist/types/bin/utils/uploadAppBundle.d.ts +7 -0
  142. package/dist/types/lib/app-config.d.ts +1 -1
  143. package/dist/types/lib/app-manifest.d.ts +30 -2
  144. package/dist/types/lib/app-package.d.ts +34 -3
  145. package/dist/types/lib/plugins/app-assets/app-asset-plugin.d.ts +36 -0
  146. package/dist/types/lib/plugins/app-assets/emit-asset.d.ts +18 -0
  147. package/dist/types/lib/plugins/app-assets/extension-filter-pattern.d.ts +14 -0
  148. package/dist/types/lib/plugins/app-assets/index.d.ts +3 -0
  149. package/dist/types/lib/plugins/app-assets/read-asset-content.d.ts +14 -0
  150. package/dist/types/lib/plugins/app-assets/resolve-asset-id.d.ts +16 -0
  151. package/dist/types/lib/plugins/app-assets/static.d.ts +5 -0
  152. package/dist/types/lib/plugins/app-proxy/app-proxy-plugin.d.ts +70 -0
  153. package/dist/types/lib/plugins/app-proxy/index.d.ts +1 -0
  154. package/dist/types/lib/plugins/external-public/external-public-plugin.d.ts +30 -0
  155. package/dist/types/lib/plugins/external-public/index.d.ts +1 -0
  156. package/dist/types/lib/utils/assert.d.ts +2 -2
  157. package/dist/types/lib/utils/config.d.ts +7 -1
  158. package/dist/types/lib/utils/expect.d.ts +1 -1
  159. package/dist/types/lib/vite-config.d.ts +1 -1
  160. package/dist/types/version.d.ts +1 -1
  161. package/dist/version.js +2 -1
  162. package/dist/version.js.map +1 -1
  163. package/package.json +49 -35
  164. package/dist/bin/dev-proxy.js +0 -89
  165. package/dist/bin/dev-proxy.js.map +0 -1
  166. package/dist/bin/public/assets/index-DGTu1kLV.js +0 -3482
  167. package/dist/bin/utils/app-api.js +0 -169
  168. package/dist/bin/utils/app-api.js.map +0 -1
  169. package/dist/bin/utils/execute-commant.js.map +0 -1
  170. package/dist/index.js +0 -12
  171. package/dist/index.js.map +0 -1
  172. package/dist/types/bin/dev-proxy.d.ts +0 -26
  173. package/dist/types/bin/utils/app-api.d.ts +0 -8
  174. package/dist/types/bin/utils/execute-commant.d.ts +0 -8
  175. package/dist/types/index.d.ts +0 -4
@@ -1,3 +1,8 @@
1
1
  import { ContextSearchProps } from '@equinor/fusion-react-context-selector';
2
+ /**
3
+ * See fusion-react-component storybook for available attributes
4
+ * @link https://equinor.github.io/fusion-react-components/?path=/docs/data-contextselector--component
5
+ * @returns JSX element
6
+ */
2
7
  export declare const ContextSelector: (props: ContextSearchProps) => JSX.Element | null;
3
8
  export default ContextSelector;
@@ -1,6 +1,12 @@
1
1
  import { IContextProvider } from '@equinor/fusion-framework-module-context';
2
2
  import '@equinor/fusion-framework-app';
3
3
  import { ContextResult, ContextResolver } from '@equinor/fusion-react-context-selector';
4
+ /**
5
+ * Hook for querying context and setting resolver for ContextSelector component
6
+ * See React Components storybook for info about ContextSelector component and its resolver
7
+ * @link https://equinor.github.io/fusion-react-components/?path=/docs/data-contextselector--component
8
+ * @return Array<ContextResolver, SetContextCallback>
9
+ */
4
10
  export declare const useContextResolver: () => {
5
11
  resolver: ContextResolver | null;
6
12
  provider: IContextProvider | null;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type FusionLogoProps = Omit<React.SVGProps<SVGSVGElement>, 'viewBox'> & {
3
2
  readonly scale?: number;
4
3
  };
@@ -3,5 +3,9 @@ type PersonSideSheetProps = {
3
3
  readonly isOpen: boolean;
4
4
  onClose(): void;
5
5
  };
6
+ /**
7
+ * Add Sidesheet with settings for the current user.
8
+ * @param PersonSideSheetProps
9
+ */
6
10
  export declare const PersonSideSheet: ({ azureId, isOpen, onClose }: PersonSideSheetProps) => import("react/jsx-runtime").JSX.Element;
7
11
  export default PersonSideSheet;
@@ -1,2 +1,6 @@
1
1
  import type { SheetContentProps } from './types';
2
+ /**
3
+ * JSX structure for the content of the PersonSidesheet's Features page.
4
+ * @param SheetContentProps
5
+ */
2
6
  export declare const FeatureSheetContent: ({ navigate }: SheetContentProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,5 @@
1
+ /**
2
+ * JSX structure for Feature toggler tab for app features in the PersonSidesheet's Feature page.
3
+ */
1
4
  export declare const FeatureTogglerApp: () => import("react/jsx-runtime").JSX.Element;
2
5
  export default FeatureTogglerApp;
@@ -1,2 +1,5 @@
1
+ /**
2
+ * Content for Feature toggler tab for portal features in the PersonSidesheet's Feature page.
3
+ */
1
4
  export declare const FeatureTogglerPortal: () => import("react/jsx-runtime").JSX.Element;
2
5
  export default FeatureTogglerPortal;
@@ -1,2 +1,5 @@
1
1
  import type { SheetContentProps } from './types';
2
+ /**
3
+ * Content for the main tab in the PersonSidesheet.
4
+ */
2
5
  export declare const LandingSheetContent: ({ azureId, navigate }: SheetContentProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,6 @@
1
- /// <reference types="react" />
2
1
  export declare const Styled: {
3
- SwitchList: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, never>>;
4
- SwitchListItem: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, never>>;
5
- SwitchLabel: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
6
- Switch: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
2
+ SwitchList: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, never>> & string;
3
+ SwitchListItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, never>> & string;
4
+ SwitchLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
5
+ Switch: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
7
6
  };
@@ -1 +1,5 @@
1
+ /**
2
+ * when current application changes, this hook will observe the application module instances.
3
+ * If the module has Context and Navigation, this hook will navigate when the context changes
4
+ */
1
5
  export declare const useAppContextNavigation: () => void;
@@ -1,4 +1,4 @@
1
- import { type FusionEnv } from './utils/app-api.js';
1
+ import type { FusionEnv } from './utils/index.js';
2
2
  export declare const publishApplication: (options: {
3
3
  tag: string;
4
4
  env: FusionEnv;
@@ -1,4 +1,4 @@
1
- import { type FusionEnv } from './utils/app-api.js';
1
+ import type { FusionEnv } from './utils/index.js';
2
2
  declare enum Tags {
3
3
  preview = "preview",
4
4
  latest = "latest"
@@ -1,4 +1,4 @@
1
- import { type FusionEnv } from './utils/app-api.js';
1
+ import type { FusionEnv } from './utils/index.js';
2
2
  export declare const uploadApplication: (options: {
3
3
  bundle: string;
4
4
  env: FusionEnv;
@@ -0,0 +1,8 @@
1
+ type Commands = {
2
+ app: {
3
+ build: '';
4
+ manifest: '';
5
+ };
6
+ };
7
+ export declare const executeCommand: <TProgram extends keyof Commands>(program: TProgram, command: keyof Commands[TProgram], ...options: any[]) => Promise<unknown>;
8
+ export {};
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- import { relative } from 'node:path';
3
1
  import chalk from 'chalk';
4
2
  export { chalk };
5
3
  export declare const formatPath: (path: string, opt?: {
@@ -0,0 +1,10 @@
1
+ export type FusionEnv = 'ci' | 'fqa' | 'tr' | 'fprd';
2
+ /**
3
+ * Retreive full endpoint URI to env in service-discovery
4
+ * @param endpoint <string> The endpoint to call in+ uri
5
+ * @param fusionEnv <FusionEnv> The Fusion env to get uri for
6
+ * @param service <string> Custom service uri to use insted of Fusion
7
+ * @param version <string> The version of the api to use
8
+ * @returns <string> The uri with endpoint
9
+ */
10
+ export declare const getEndpointUrl: (endpoint: string, fusionEnv: FusionEnv, service: string, version?: string) => Promise<string>;
@@ -0,0 +1,14 @@
1
+ export { getEndpointUrl } from './getEndpointUrl.js';
2
+ export type { FusionEnv } from './getEndpointUrl.js';
3
+ export { requireToken } from './requireToken.js';
4
+ export { isAppRegistered } from './isAppRegistered.js';
5
+ export { loadAppConfig } from './load-app-config.js';
6
+ export { loadAppManifest } from './load-manifest.js';
7
+ export { loadPackage } from './load-package.js';
8
+ export { loadViteConfig } from './load-vite-config.js';
9
+ export { formatPath, formatByteSize } from './format.js';
10
+ export { executeCommand } from './execute-command.js';
11
+ export { publishAppConfig } from './publishAppConfig.js';
12
+ export { tagAppBundle } from './tagAppBundle.js';
13
+ export { uploadAppBundle } from './uploadAppBundle.js';
14
+ export { Spinner } from './spinner.js';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Make sure the app is registerred in the app-service
3
+ * @param endpoint <string> The endpoint to make a call to
4
+ * @param appKey <string> The appkey to check for
5
+ * @returns response object as json
6
+ */
7
+ export declare const isAppRegistered: (endpoint: string, appKey: string) => Promise<any>;
@@ -4,6 +4,6 @@ export declare const loadAppConfig: (env: ConfigExecuterEnv, pkg: ResolvedAppPac
4
4
  file?: string;
5
5
  }) => Promise<{
6
6
  config: import("@equinor/fusion-framework-module-app").AppConfig;
7
- path?: string | undefined;
7
+ path?: string;
8
8
  }>;
9
9
  export default loadAppConfig;
@@ -1,9 +1,10 @@
1
+ import type { AppManifest } from '@equinor/fusion-framework-module-app';
1
2
  import { type ConfigExecuterEnv } from '../../lib/utils/config.js';
2
3
  import { type ResolvedAppPackage } from '../../lib/app-package.js';
3
4
  export declare const loadAppManifest: (env: ConfigExecuterEnv, pkg: ResolvedAppPackage, options?: {
4
5
  file?: string;
5
6
  }) => Promise<{
6
- manifest: import("@equinor/fusion-framework-module-app").AppManifest;
7
- path?: string | undefined;
7
+ manifest: AppManifest;
8
+ path?: string;
8
9
  }>;
9
10
  export default loadAppManifest;
@@ -0,0 +1,15 @@
1
+ import { type ClientRequest } from 'http';
2
+ /**
3
+ * Logs the status of a proxy request using a spinner.
4
+ *
5
+ * @param proxyReq - The proxy request to log.
6
+ *
7
+ * The function attaches event listeners to the proxy request to handle
8
+ * 'response' and 'error' events. It uses a spinner to indicate the status
9
+ * of the request:
10
+ * - On a successful response (status code < 400), the spinner succeeds.
11
+ * - On a response with a status code >= 400, the spinner warns with the status message.
12
+ * - On an error, the spinner fails.
13
+ */
14
+ export declare const proxyRequestLogger: (proxyReq: ClientRequest) => void;
15
+ export default proxyRequestLogger;
@@ -0,0 +1,9 @@
1
+ import type { AppConfig } from '@equinor/fusion-framework-module-app';
2
+ /**
3
+ * Publishes app config to the apps-service endpoint
4
+ * @param endpoint string The endpoint to upload to
5
+ * @param appKey The application key
6
+ * @param config Object with app config
7
+ * @returns HTTP response as json
8
+ */
9
+ export declare const publishAppConfig: (endpoint: string, appKey: string, config: AppConfig) => Promise<any>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Make sure the user has a valid azure token.
3
+ */
4
+ export declare const requireToken: () => void;
@@ -2,6 +2,7 @@ import { Options, type Ora } from 'ora';
2
2
  export declare class Spinner {
3
3
  #private;
4
4
  get ora(): Ora;
5
+ set attachConsole(value: boolean);
5
6
  static Global(options?: Options): Spinner;
6
7
  static Clone(spinner?: Spinner): Spinner;
7
8
  static get Current(): Spinner;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Send request to apps-service to tag a bundle.
3
+ * @param endpoint string The endpoint to send request to.
4
+ * @param version string The version to tag the bundle with.
5
+ * @returns Response object as json.
6
+ */
7
+ export declare const tagAppBundle: (endpoint: string, version: string) => Promise<any>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Function that uploads a zip bundle to the endpoint.
3
+ * @param endpoint string The endpoint to upload to
4
+ * @param bundle string The filename to upload
5
+ * @returns Object
6
+ */
7
+ export declare const uploadAppBundle: (endpoint: string, bundle: string) => Promise<any>;
@@ -6,7 +6,7 @@ type FindAppConfigOptions = FindConfigOptions & {
6
6
  };
7
7
  export type AppConfigFn = (env: ConfigExecuterEnv, args: {
8
8
  base: AppConfig;
9
- }) => AppConfig | Promise<AppConfig>;
9
+ }) => AppConfig | Promise<AppConfig | void> | void;
10
10
  export type AppConfigExport = AppConfig | AppConfigFn;
11
11
  export declare const appConfigFilename = "app.config";
12
12
  export declare function assertAppConfig(value: AppConfig): asserts value;
@@ -1,18 +1,46 @@
1
1
  import { ResolvedAppPackage } from './app-package.js';
2
- import type { AppManifest } from '@equinor/fusion-framework-module-app';
3
2
  import { type FindConfigOptions, type ResolvedConfig, ConfigExecuterEnv } from './utils/config.js';
4
3
  import { RecursivePartial } from './utils/types.js';
4
+ import { AppManifest } from '@equinor/fusion-framework-module-app';
5
5
  export type AppManifestFn = (env: ConfigExecuterEnv, args: {
6
6
  base: AppManifest;
7
- }) => AppManifest | Promise<AppManifest>;
7
+ }) => Partial<AppManifest> | Promise<Partial<AppManifest> | void> | void;
8
8
  type FindManifestOptions = FindConfigOptions & {
9
9
  file?: string;
10
10
  };
11
+ /** base filename for configuration files */
11
12
  export declare const manifestConfigFilename = "app.manifest.config";
13
+ /**
14
+ * Define a manifest for an application
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * export default defineAppManifest(async() => {
19
+ * return {
20
+ * ...AppManifest_properties
21
+ * }
22
+ * })
23
+ * ```
24
+ * @param fnOrObj - defines the manifest as an object or callback
25
+ */
12
26
  export declare const defineAppManifest: (fn: AppManifestFn) => AppManifestFn;
13
27
  export declare function assertAppManifest(value: AppManifest): asserts value;
28
+ /**
29
+ * @example
30
+ * ```ts
31
+ * export default defineAppManifest(base) => mergeManifests(base, {prop: value});
32
+ * ```
33
+ * @param base base manifest to merge with
34
+ * @param overrides target manifest to apply to base
35
+ * @returns deep merged manifest
36
+ */
14
37
  export declare const mergeManifests: (base: RecursivePartial<AppManifest>, overrides: RecursivePartial<AppManifest>) => AppManifest;
38
+ /** loads manifestFn from file */
15
39
  export declare const loadManifest: (filename?: string) => Promise<import("./utils/config.js").ConfigExecuter<AppManifest, import("./utils/config.js").ConfigExecuterArgs>>;
40
+ /**
41
+ * tries to resolve manifest
42
+ * @see {@link resolveConfig | resolving config}
43
+ */
16
44
  export declare const resolveManifest: (options?: FindConfigOptions & {
17
45
  file?: string;
18
46
  }) => Promise<ResolvedConfig<AppManifestFn> | void>;
@@ -16,8 +16,39 @@ export type ResolvedAppPackage = {
16
16
  path: string;
17
17
  };
18
18
  export declare function defineAppPackage(fnOrObject: DefinePackageExporter): DefinePackageExporter;
19
- export declare const resolveEntryPoint: (packageJson: Pick<PackageJson, 'main' | 'module'>) => string;
20
- export declare const resolveAppKey: (packageJson: Pick<PackageJson, 'name'>) => string;
21
- export declare const assertPackage: (_pkg: Partial<AppPackageJson>) => void;
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
+ */
39
+ export declare const resolveAppKey: (packageJson: Pick<PackageJson, "name">) => string;
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;
@@ -0,0 +1,36 @@
1
+ import { type FilterPattern, type Plugin } from 'vite';
2
+ /**
3
+ * A Vite plugin to handle external resources in a library build.
4
+ *
5
+ * @param options - Configuration options for the plugin.
6
+ * @param options.name - Optional name for the emitted assets.
7
+ * @param options.include - Filter pattern to include specific files.
8
+ * @param options.exclude - Filter pattern to exclude specific files.
9
+ * @returns A Vite plugin object.
10
+ *
11
+ * @remarks
12
+ * This plugin is intended to be used only during the Vite library build process.
13
+ * It resolves asset IDs, emits assets, and exports them as URLs.
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * // vite.config.ts
18
+ * import { ExternalAppAssetPlugin } from '@equinor/fusion-framework-cli/plugins/app-assets-plugin';
19
+ *
20
+ * export default {
21
+ * plugins: [
22
+ * ExternalAppAssetPlugin({
23
+ * name: 'my-asset',
24
+ * include: ['svg', 'png'],
25
+ * exclude: 'node_modules/**',
26
+ * }),
27
+ * ],
28
+ * };
29
+ * ```
30
+ */
31
+ export declare const AppAssetExportPlugin: (options?: {
32
+ name?: string;
33
+ include?: FilterPattern;
34
+ exclude?: FilterPattern;
35
+ }) => Plugin;
36
+ export default AppAssetExportPlugin;
@@ -0,0 +1,18 @@
1
+ import { type PluginContext } from 'rollup';
2
+ /**
3
+ * Synchronously emits an asset file based on the provided context and options.
4
+ *
5
+ * @param context - The plugin context used for emitting the file and logging warnings.
6
+ * @param id - The identifier of the asset, which may include a resource query.
7
+ * @param options - Optional parameters for customizing the emitted asset.
8
+ * @param options.name - The name template for the emitted asset file. Defaults to '[name].[ext]'.
9
+ * @param options.outDir - The output directory where the asset will be emitted. Defaults to 'dist'.
10
+ * @param options.assetsDir - The directory within the output directory where assets will be stored. Defaults to 'assets'.
11
+ * @returns The path of the emitted asset relative to the assets directory, or null if the asset content could not be read.
12
+ */
13
+ export declare const emitAssetSync: (context: PluginContext, id: string, options?: {
14
+ name?: string;
15
+ outDir?: string;
16
+ assetsDir?: string;
17
+ }) => string | null;
18
+ export default emitAssetSync;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Creates a regular expression pattern to filter files based on their extensions.
3
+ *
4
+ * @param exts - An array of file extensions to include in the pattern.
5
+ * @returns A RegExp object that matches files with the specified extensions.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * const pattern = createExtensionFilterPattern(['.js', '.ts']);
10
+ * console.log(pattern); // Output: /\.(js|ts)(\?.*)?$/
11
+ * ```
12
+ */
13
+ export declare const createExtensionFilterPattern: (exts: string[]) => RegExp;
14
+ export default createExtensionFilterPattern;
@@ -0,0 +1,3 @@
1
+ export { default, AppAssetExportPlugin } from './app-asset-plugin.js';
2
+ export { createExtensionFilterPattern } from './extension-filter-pattern.js';
3
+ export { ASSET_EXTENSIONS as StandardIncludeAssetExtensions } from './static.js';
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Reads the content of an asset synchronously.
3
+ *
4
+ * @param id - The identifier of the asset, which can include a query string.
5
+ * @returns The content of the asset as a Buffer if it exists, otherwise null.
6
+ *
7
+ * @remarks
8
+ * - If the asset content is already cached, it returns the cached content.
9
+ * - The function extracts the filename from the identifier by removing any query string.
10
+ * - If the file exists, it reads the content, caches it, and then returns it.
11
+ * - If the file does not exist, it logs a warning and returns null.
12
+ */
13
+ export declare const readAssetContentSync: (id: string) => Buffer | null;
14
+ export default readAssetContentSync;
@@ -0,0 +1,16 @@
1
+ import { type PluginContext, type PartialResolvedId } from 'rollup';
2
+ /**
3
+ * Resolves the asset ID based on the provided context, ID, importer, and options.
4
+ *
5
+ * @param context - The plugin context used for resolving the ID.
6
+ * @param id - The asset ID to resolve.
7
+ * @param importer - The path of the module that is importing the asset.
8
+ * @param options - Optional resolution options.
9
+ * @returns A promise that resolves to a `PartialResolvedId` object or `null`.
10
+ *
11
+ * The function handles three cases:
12
+ * 1. If the ID is an absolute path, it returns an object with the ID, marked as external and resolved by the plugin.
13
+ * 2. If the ID is a relative path, it resolves the path relative to the importer and returns an object with the resolved ID, marked as external and resolved by the plugin.
14
+ * 3. For all other cases, it delegates the resolution to the context's resolve method.
15
+ */
16
+ export declare const resolveAssetId: (context: PluginContext, id: string, importer: string, options?: Parameters<PluginContext["resolve"]>[2]) => Promise<PartialResolvedId | null>;
@@ -0,0 +1,5 @@
1
+ export declare const PLUGIN_NAME = "vite:fusion:app-assets";
2
+ /**
3
+ * General asset extensions.
4
+ */
5
+ export declare const ASSET_EXTENSIONS: string[];
@@ -0,0 +1,70 @@
1
+ import { Plugin } from 'vite';
2
+ import { AppConfig, AppManifest } from '@equinor/fusion-framework-app';
3
+ import { ClientRequest, IncomingMessage, ServerResponse } from 'node:http';
4
+ /**
5
+ * Options for configuring the App Proxy Plugin.
6
+ *
7
+ * @remarks
8
+ * When not providing an app configuration, the plugin will only proxy requests to the target.
9
+ */
10
+ export type AppProxyPluginOptions = {
11
+ /** Configuration for the proxy. */
12
+ proxy: {
13
+ /** The path to be proxied. */
14
+ path: string;
15
+ /** The target URL for the proxy. */
16
+ target: string;
17
+ /** Optional callback function to modify the proxy request. */
18
+ onProxyReq?: (proxyReq: ClientRequest, req: IncomingMessage, res: ServerResponse) => void;
19
+ };
20
+ /** Optional configuration for the app. */
21
+ app?: {
22
+ /** application key */
23
+ key: string;
24
+ /** application version */
25
+ version: string;
26
+ /** callback function for generating configuration for the application */
27
+ generateConfig: () => Promise<AppConfig>;
28
+ /** callback function for generating manifest for the application */
29
+ generateManifest: () => Promise<AppManifest>;
30
+ };
31
+ };
32
+ /**
33
+ * The `appProxyPlugin` function creates a Vite plugin that configures a proxy for API and bundle requests
34
+ * to the Fusion apps backend. It also serves the app manifest, config, and local bundles if an app is provided.
35
+ *
36
+ * @param {AppProxyPluginOptions} options - The options for configuring the app proxy plugin.
37
+ *
38
+ * @returns {Plugin} - The configured Vite plugin.
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * const plugin = appProxyPlugin({
43
+ * proxy: {
44
+ * path: '/app-proxy',
45
+ * target: 'https://fusion-s-apps-ci.azurewebsites.net/',
46
+ * onProxyReq: (proxyReq, req, res) => {
47
+ * proxyReq.on('response', (res) => { console.log(res.statusCode) });
48
+ * },
49
+ * },
50
+ * app: {
51
+ * key: 'my-app',
52
+ * version: '1.0.0',
53
+ * generateConfig: async () => ({}),
54
+ * generateManifest: async () => ({}),
55
+ * },
56
+ * });
57
+ *
58
+ * // api calls
59
+ * fetch('/app-proxy/apps/my-app/builds/1.0.0/config'); // will generate app config by provided function
60
+ * fetch('/app-proxy/apps/my-app/builds/0.0.9/config'); // will proxy to the target, since version does not match
61
+ * fetch('/app-proxy/apps/other-app/builds/1.0.0/config'); // will proxy to the target, since app key does not match
62
+ *
63
+ * // asset calls
64
+ * fetch('/app-proxy/bundles/my-app/builds/1.0.0/index.js'); // will generate bundle by provided function
65
+ * fetch('/app-proxy/bundles/my-app/builds/0.0.9/index.js'); // will proxy to the target, since version does not match
66
+ * ```
67
+ *
68
+ */
69
+ export declare const appProxyPlugin: (options: AppProxyPluginOptions) => Plugin;
70
+ export default appProxyPlugin;
@@ -0,0 +1 @@
1
+ export { default, appProxyPlugin, type AppProxyPluginOptions } from './app-proxy-plugin.js';
@@ -0,0 +1,30 @@
1
+ import { type FilterPattern, type Plugin } from 'vite';
2
+ /**
3
+ * Creates a plugin that serves an external public directory.
4
+ *
5
+ * This plugin is useful when you want to serve a static site from a different directory than the one where the Vite server is running.
6
+ * Vite`s built in `mode: 'spa'` will only look for the `index.html` file in the configured `root` directory,
7
+ * so this plugin is necessary to serve the `index.html` file from a different directory.
8
+ *
9
+ * @param path - The path to the external public directory.
10
+ * @param options - Optional filter patterns to include or exclude specific assets.
11
+ * @param options.include - A filter pattern to include specific assets.
12
+ * @param options.exclude - A filter pattern to exclude specific assets.
13
+ * @returns A Vite plugin object.
14
+ *
15
+ * The plugin:
16
+ * - Sets the `path` configuration to the provided path.
17
+ * - Adds a middleware to the server that serves static assets from the specified path.
18
+ * - Adds a middleware to the server that serves the `index.html` file from the specified path.
19
+ *
20
+ * The middleware:
21
+ * - Checks if the request is for a static asset and serves it from the specified path.
22
+ * - Reads the `index.html` file from the specified path.
23
+ * - Transforms the HTML using the server's `transformIndexHtml` method.
24
+ * - Responds with the transformed HTML, setting appropriate headers.
25
+ */
26
+ export declare const externalPublicPlugin: (path: string, options?: {
27
+ include?: FilterPattern;
28
+ exclude?: FilterPattern;
29
+ }) => Plugin;
30
+ export default externalPublicPlugin;
@@ -0,0 +1 @@
1
+ export { default, externalPublicPlugin } from './external-public-plugin.js';
@@ -1,10 +1,10 @@
1
- /// <reference types="node" />
2
1
  import assert, { AssertionError } from 'node:assert';
3
2
  export { assert, AssertionError };
4
3
  export declare function assertNumber(value: unknown, message?: string): asserts value;
5
4
  export declare function assertObject(value: object, message?: string | Error): asserts value;
6
5
  declare function assertObjectEntryValue<P>(value: unknown, prop: P, message?: string): asserts value;
7
- export declare function assertObjectEntries<T extends object, P extends Array<keyof T>>(value: T, options?: {
6
+ export declare function assertObjectEntries<T extends object, P extends Array<keyof T>>(// extends Record<string, unknown> = unknown>(
7
+ value: T, options?: {
8
8
  props?: P;
9
9
  assertion?: typeof assertObjectEntryValue;
10
10
  preMessage?: string;
@@ -8,8 +8,11 @@ export type ResolveConfigOptions = {
8
8
  find?: FindConfigOptions;
9
9
  };
10
10
  export type ConfigExecuterEnv = {
11
+ /** cli command */
11
12
  command: 'serve' | 'build';
13
+ /** cli mode */
12
14
  mode: string;
15
+ /** root of the package */
13
16
  root?: string;
14
17
  };
15
18
  export type ConfigExecuterArgs = [ConfigExecuterEnv, ...any[]];
@@ -19,8 +22,11 @@ export type ResolvedConfig<TType extends ConfigExecuter> = {
19
22
  path: string;
20
23
  config: TType;
21
24
  };
25
+ /**
26
+ * @param filename name if config file without extension
27
+ */
22
28
  export declare const findConfigs: (filename: string, options?: FindConfigOptions) => Promise<string[]>;
23
29
  export declare const resolveConfig: <TType>(filename: string, options?: ResolveConfigOptions) => Promise<ResolvedConfig<ConfigExecuter<TType>> | void>;
24
30
  export declare const loadConfig: <TType>(file: string) => Promise<ConfigExecuter<TType>>;
25
- export declare function initiateConfig<TConfig extends ConfigExecuter>(config: TConfig, ...args: Parameters<TConfig>): Promise<ConfigExecuterType<TConfig>>;
31
+ export declare function initiateConfig<TConfig extends ConfigExecuter>(config: TConfig, ...args: Parameters<TConfig>): Promise<ConfigExecuterType<TConfig> | void>;
26
32
  export default loadConfig;
@@ -1,4 +1,4 @@
1
1
  export declare const expect: <T>(value: T) => {
2
2
  toBe: (expected: T, message: string) => asserts expected;
3
- toBeInstanceOf: (expected: T, message: string) => asserts expected;
3
+ toBeInstanceOf: (expected: typeof value, message: string) => asserts expected;
4
4
  };