@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 +38 -0
- package/dist/esm/{ModuleProvider.js → create-module-provider.js} +18 -20
- package/dist/esm/create-module-provider.js.map +1 -0
- package/dist/esm/index.js +4 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/{context.js → module-context.js} +1 -1
- package/dist/esm/module-context.js.map +1 -0
- package/dist/esm/module-provider.js +4 -0
- package/dist/esm/module-provider.js.map +1 -0
- package/dist/esm/useModule.js +26 -0
- package/dist/esm/useModule.js.map +1 -0
- package/dist/esm/useModules.js +1 -25
- package/dist/esm/useModules.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/{ModuleProvider.d.ts → create-module-provider.d.ts} +18 -19
- package/dist/types/index.d.ts +4 -2
- package/dist/types/module-provider.d.ts +2 -0
- package/dist/types/useModule.d.ts +22 -0
- package/dist/types/useModules.d.ts +1 -22
- package/dist/types/version.d.ts +1 -1
- package/package.json +3 -3
- package/src/{ModuleProvider.tsx → create-module-provider.tsx} +19 -24
- package/src/index.ts +4 -2
- package/src/module-provider.ts +5 -0
- package/src/useModule.ts +35 -0
- package/src/useModules.ts +2 -40
- package/src/version.ts +1 -1
- package/dist/esm/ModuleProvider.js.map +0 -1
- package/dist/esm/context.js.map +0 -1
- /package/dist/types/{context.d.ts → module-context.d.ts} +0 -0
- /package/src/{context.ts → module-context.ts} +0 -0
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
|
|
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
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
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
|
|
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
|
-
|
|
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 {
|
|
2
|
-
export {
|
|
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
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,
|
|
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"}
|
|
@@ -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 @@
|
|
|
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"}
|
package/dist/esm/useModules.js
CHANGED
|
@@ -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":"
|
|
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"}
|
package/dist/esm/version.js
CHANGED