@equinor/fusion-framework-react-module 4.0.0 → 4.0.2

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 CHANGED
@@ -1,5 +1,43 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 80c3e4a: Internal: align source filenames with their exports (`context.ts` → `module-context.ts`, `ModuleProvider.tsx` → `create-module-provider.tsx`) while preserving existing public entrypoints; no public API changes.
8
+ - 80c3e4a: Internal: split multi-export files into one export per file and convert pure interop re-exports to `export { X } from 'y'` syntax, per `fusion-lint`'s `single-export-per-file` rule. Also removed `modules/event/src/EventProvider.tsx`, a fully dead duplicate of `eventContext.ts`/`useEventProvider.ts`/`useModulesEventProvider.ts` with no remaining consumers. No behavior changes.
9
+
10
+ ## 4.0.1
11
+
12
+ ### Patch Changes
13
+
14
+ - b7b1d9a: Add `registerPlugin` to `IModulesConfigurator` and `ModulesConfigurator` for application-level side effects that run after modules are initialized and before application render.
15
+
16
+ Plugins receive the initialized module map through `FrameworkPluginArgs` and may return a teardown callback that runs during `dispose`. Plugin-related types and the `createPlugin(name, callback)` helper are available from the dedicated `@equinor/fusion-framework-module/plugins` entrypoint. Plugin registration and teardown failures are isolated so one failing plugin does not block other plugins or module disposal. `ModuleConfiguratorEventName` and `ModuleConfiguratorEventBaseName` are available from the `@equinor/fusion-framework-module/configurator` entrypoint for filtering `ModuleConfigurator.{name}.{state}` lifecycle events without hard-coded strings.
17
+
18
+ ```typescript
19
+ import { createPlugin } from "@equinor/fusion-framework-module/plugins";
20
+
21
+ const contextTelemetryPlugin = createPlugin<[EventModule, TelemetryModule]>(
22
+ "contextTelemetry",
23
+ (modules) =>
24
+ modules.event.addEventListener("context:changed", (event) => {
25
+ modules.telemetry.track("context.changed", event.detail);
26
+ }),
27
+ );
28
+
29
+ configurator.registerPlugin(contextTelemetryPlugin);
30
+ ```
31
+
32
+ Align `createModuleProvider` configurator typing with the module configurator reference type so React module package builds against the new plugin callback contract.
33
+
34
+ Fixes: https://github.com/equinor/fusion-core-tasks/issues/1259
35
+
36
+ - Updated dependencies [b7b1d9a]
37
+ - Updated dependencies [b7b1d9a]
38
+ - Updated dependencies [b7b1d9a]
39
+ - @equinor/fusion-framework-module@6.1.0
40
+
3
41
  ## 4.0.0
4
42
 
5
43
  ### Major Changes
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  /* eslint-disable @typescript-eslint/no-explicit-any */
3
3
  import { lazy, useEffect, } from 'react';
4
4
  import { initializeModules, } from '@equinor/fusion-framework-module';
5
- import moduleContext from './context.js';
5
+ import { ModuleProvider } from './module-provider.js';
6
6
  /**
7
7
  * Function for creating a `ModuleProvider` component.
8
8
  *
@@ -12,25 +12,25 @@ import moduleContext from './context.js';
12
12
  * ```ts
13
13
  * import http, { HttpModule } from '@equinor/fusion-framework-module-http';
14
14
  * import msal, { MsalModule } from '@equinor/fusion-framework-module-msal';
15
+ * import { ModulesConfigurator } from '@equinor/fusion-framework-module';
15
16
  * import { createModuleProvider } from '@equinor/fusion-framework-react-module';
16
17
  *
17
- * export default createModuleProvider(
18
- * (config) => {
19
- * config.auth.configureDefault({
20
- * tenantId: 'MY_TENANT_ID',
21
- * clientId: 'MY_CLIENT_ID',
22
- * redirectUri: '/authentication/login-callback',
23
- * });
24
- * config.http.configureClient('foo', {
25
- * baseUri: 'https://foo.bar',
26
- * defaultScopes: ['FOO_CLIENT_ID/.default'],
27
- * });
28
- * },
29
- * [http, msal]
30
- *);
18
+ * const configurator = new ModulesConfigurator([http, msal]);
19
+ * configurator.onConfigured((config) => {
20
+ * config.auth.configureDefault({
21
+ * tenantId: 'MY_TENANT_ID',
22
+ * clientId: 'MY_CLIENT_ID',
23
+ * redirectUri: '/authentication/login-callback',
24
+ * });
25
+ * config.http.configureClient('foo', {
26
+ * baseUri: 'https://foo.bar',
27
+ * defaultScopes: ['FOO_CLIENT_ID/.default'],
28
+ * });
29
+ * });
30
+ *
31
+ * export default createModuleProvider(configurator);
31
32
  * ```
32
- * @param configurator callback for configuring provided modules
33
- * @param modules modules which should be initiated
33
+ * @param configurator configurator for the modules that should be initialized
34
34
  * @param ref optional parent module instance
35
35
  * @returns Suspensive `ModuleProvider`
36
36
  */
@@ -47,6 +47,4 @@ export const createModuleProvider = async (configurator, ref) => {
47
47
  });
48
48
  return Component;
49
49
  };
50
- export const ModuleProvider = moduleContext.Provider;
51
- export default ModuleProvider;
52
- //# sourceMappingURL=ModuleProvider.js.map
50
+ //# sourceMappingURL=create-module-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-module-provider.js","sourceRoot":"","sources":["../../src/create-module-provider.tsx"],"names":[],"mappings":";AAAA,uDAAuD;AACvD,OAAO,EACL,IAAI,EACJ,SAAS,GAIV,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,iBAAiB,GAIlB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAWtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA0B,KAAK,EAK9D,YAAiD,EACjD,GAAU,EACuC,EAAE;IACnD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE;QAChC,MAAM,EAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,GAAG,MAAM,iBAAiB,CAAiB,YAAY,EAAE,GAAG,CAAC,CAAC;QAC5F,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,QAAQ,EAA4B,EAAE,EAAE;gBAClD,wGAAwG;gBACxG,SAAS,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACrC,OAAO,KAAC,cAAc,IAAC,KAAK,EAAE,QAAQ,YAAG,QAAQ,GAAkB,CAAC;YACtE,CAAC;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
package/dist/esm/index.js CHANGED
@@ -1,3 +1,5 @@
1
- export { ModuleProvider, createModuleProvider } from './ModuleProvider.js';
2
- export { useModules, useModule } from './useModules.js';
1
+ export { createModuleProvider } from './create-module-provider.js';
2
+ export { ModuleProvider } from './module-provider.js';
3
+ export { useModules } from './useModules.js';
4
+ export { useModule } from './useModule.js';
3
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import { createContext } from 'react';
2
2
  export const moduleContext = createContext({});
3
3
  export default moduleContext;
4
- //# sourceMappingURL=context.js.map
4
+ //# sourceMappingURL=module-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-context.js","sourceRoot":"","sources":["../../src/module-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAA0B,EAAE,CAAC,CAAC;AAExE,eAAe,aAAa,CAAC"}
@@ -0,0 +1,4 @@
1
+ import moduleContext from './module-context.js';
2
+ export const ModuleProvider = moduleContext.Provider;
3
+ export default ModuleProvider;
4
+ //# sourceMappingURL=module-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-provider.js","sourceRoot":"","sources":["../../src/module-provider.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAEhD,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC,QAAQ,CAAC;AAErD,eAAe,cAAc,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { useModules } from './useModules.js';
2
+ /**
3
+ * Hook for accessing a single module instance from the current context scope.
4
+ *
5
+ * Convenience hook that retrieves a single module by its key/name. This is useful
6
+ * when you only need one module and want to avoid destructuring from `useModules`.
7
+ *
8
+ * @template T - The type of the module to retrieve. Defaults to any module from the available `Modules`.
9
+ * @template TKey - The string key/name of the module. Automatically inferred from `T` when possible.
10
+ * @param key - The name/key of the module to retrieve from the context.
11
+ * @returns The initialized instance of the requested module, with proper type inference.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * // Get a specific module by name
16
+ * const navigation = useModule('navigation');
17
+ *
18
+ * // With explicit type
19
+ * const navigation = useModule<NavigationModule>('navigation');
20
+ * ```
21
+ */
22
+ export const useModule = (key) => {
23
+ const modules = useModules();
24
+ return modules[key];
25
+ };
26
+ //# sourceMappingURL=useModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useModule.js","sourceRoot":"","sources":["../../src/useModule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAIvB,GAAS,EACmD,EAAE;IAC9D,MAAM,OAAO,GAAG,UAAU,EAA6B,CAAC;IACxD,OAAQ,OAAmC,CAAC,GAAG,CAE9C,CAAC;AACJ,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { useContext } from 'react';
2
- import { moduleContext } from './context.js';
2
+ import { moduleContext } from './module-context.js';
3
3
  /**
4
4
  * Hook for accessing module instances from the current context scope.
5
5
  *
@@ -20,29 +20,5 @@ import { moduleContext } from './context.js';
20
20
  * ```
21
21
  */
22
22
  export const useModules = () => useContext(moduleContext);
23
- /**
24
- * Hook for accessing a single module instance from the current context scope.
25
- *
26
- * Convenience hook that retrieves a single module by its key/name. This is useful
27
- * when you only need one module and want to avoid destructuring from `useModules`.
28
- *
29
- * @template T - The type of the module to retrieve. Defaults to any module from the available `Modules`.
30
- * @template TKey - The string key/name of the module. Automatically inferred from `T` when possible.
31
- * @param key - The name/key of the module to retrieve from the context.
32
- * @returns The initialized instance of the requested module, with proper type inference.
33
- *
34
- * @example
35
- * ```ts
36
- * // Get a specific module by name
37
- * const navigation = useModule('navigation');
38
- *
39
- * // With explicit type
40
- * const navigation = useModule<NavigationModule>('navigation');
41
- * ```
42
- */
43
- export const useModule = (key) => {
44
- const modules = useModules();
45
- return modules[key];
46
- };
47
23
  export default useModules;
48
24
  //# sourceMappingURL=useModules.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useModules.js","sourceRoot":"","sources":["../../src/useModules.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAES,EAAE,CAAC,UAAU,CAAC,aAAa,CAAkC,CAAC;AAEjG;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAIvB,GAAS,EACmD,EAAE;IAC9D,MAAM,OAAO,GAAG,UAAU,EAA6B,CAAC;IACxD,OAAQ,OAAmC,CAAC,GAAG,CAE9C,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"useModules.js","sourceRoot":"","sources":["../../src/useModules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAES,EAAE,CAAC,UAAU,CAAC,aAAa,CAAkC,CAAC;AAEjG,eAAe,UAAU,CAAC"}
@@ -1,3 +1,3 @@
1
1
  // Generated by genversion.
2
- export const version = '4.0.0';
2
+ export const version = '4.0.2';
3
3
  //# sourceMappingURL=version.js.map