@granite-js/micro-frontend 2.0.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/GraniteMicroFrontendRuntime.podspec +40 -0
- package/LICENSE +202 -0
- package/LICENSE.react-native-teleport +21 -0
- package/NOTICE +17 -0
- package/README.md +508 -0
- package/android/CMakeLists.txt +34 -0
- package/android/build.gradle +74 -0
- package/android/gradle.properties +4 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/cpp/BundleEvaluator.cpp +64 -0
- package/android/src/main/cpp/BundleEvaluator.h +20 -0
- package/android/src/main/cpp/FileReader.cpp +92 -0
- package/android/src/main/cpp/FileReader.h +27 -0
- package/android/src/main/cpp/onLoad.cpp +9 -0
- package/android/src/main/java/com/teleport/extensions/Float.kt +12 -0
- package/android/src/main/java/com/teleport/extensions/View.kt +10 -0
- package/android/src/main/java/com/teleport/global/PortalRegistry.kt +117 -0
- package/android/src/main/java/com/teleport/host/PortalHostView.kt +97 -0
- package/android/src/main/java/com/teleport/host/PortalHostViewManager.kt +41 -0
- package/android/src/main/java/com/teleport/host/PortalReactRootView.kt +116 -0
- package/android/src/main/java/com/teleport/managers/TeleportViewManager.kt +27 -0
- package/android/src/main/java/com/teleport/portal/PortalLayoutStateController.kt +107 -0
- package/android/src/main/java/com/teleport/portal/PortalView.kt +309 -0
- package/android/src/main/java/com/teleport/portal/PortalViewManager.kt +51 -0
- package/android/src/main/java/run/granite/microfrontend/ActivitySessionBinding.kt +87 -0
- package/android/src/main/java/run/granite/microfrontend/BundleEvaluator.kt +46 -0
- package/android/src/main/java/run/granite/microfrontend/GraniteMicroFrontendEvent.kt +62 -0
- package/android/src/main/java/run/granite/microfrontend/GraniteMicroFrontendRuntimeEventRouter.kt +186 -0
- package/android/src/main/java/run/granite/microfrontend/GraniteMicroFrontendRuntimeHost.kt +42 -0
- package/android/src/main/java/run/granite/microfrontend/GraniteMicroFrontendRuntimeModule.kt +56 -0
- package/android/src/main/java/run/granite/microfrontend/GraniteMicroFrontendRuntimePackage.kt +35 -0
- package/android/src/main/java/run/granite/microfrontend/GraniteMicroFrontendSessionStore.kt +116 -0
- package/android/src/main/jni/CMakeLists.txt +64 -0
- package/android/src/test/cpp/CMakeLists.txt +35 -0
- package/android/src/test/cpp/FileReaderTest.cpp +44 -0
- package/android/src/test/java/com/teleport/host/PortalReactRootViewContractTest.kt +76 -0
- package/android/src/test/java/run/granite/microfrontend/GraniteMicroFrontendRuntimeEventRouterTest.kt +216 -0
- package/android/src/test/java/run/granite/microfrontend/GraniteMicroFrontendSessionStoreTest.kt +190 -0
- package/android/test-cpp.sh +12 -0
- package/common/cpp/react/renderer/components/GraniteMicroFrontendRuntimeSpec/ComponentDescriptors.h +24 -0
- package/common/cpp/react/renderer/components/GraniteMicroFrontendRuntimeSpec/PortalShadowRegistry.cpp +31 -0
- package/common/cpp/react/renderer/components/GraniteMicroFrontendRuntimeSpec/PortalShadowRegistry.h +29 -0
- package/common/cpp/react/renderer/components/GraniteMicroFrontendRuntimeSpec/RNTPortalHostViewComponentDescriptor.h +22 -0
- package/common/cpp/react/renderer/components/GraniteMicroFrontendRuntimeSpec/RNTPortalHostViewShadowNode.cpp +7 -0
- package/common/cpp/react/renderer/components/GraniteMicroFrontendRuntimeSpec/RNTPortalHostViewShadowNode.h +43 -0
- package/common/cpp/react/renderer/components/GraniteMicroFrontendRuntimeSpec/RNTPortalHostViewState.h +21 -0
- package/common/cpp/react/renderer/components/GraniteMicroFrontendRuntimeSpec/RNTPortalViewComponentDescriptor.h +54 -0
- package/common/cpp/react/renderer/components/GraniteMicroFrontendRuntimeSpec/RNTPortalViewShadowNode.cpp +7 -0
- package/common/cpp/react/renderer/components/GraniteMicroFrontendRuntimeSpec/RNTPortalViewShadowNode.h +51 -0
- package/common/cpp/react/renderer/components/GraniteMicroFrontendRuntimeSpec/RNTPortalViewState.h +43 -0
- package/dist/module/createMicroFrontendRuntime.js +18 -0
- package/dist/module/createMicroFrontendRuntime.js.map +1 -0
- package/dist/module/createRoute.js +43 -0
- package/dist/module/createRoute.js.map +1 -0
- package/dist/module/host/PendingHostComponent.js +70 -0
- package/dist/module/host/PendingHostComponent.js.map +1 -0
- package/dist/module/host/index.js +6 -0
- package/dist/module/host/index.js.map +1 -0
- package/dist/module/host/pendingHostComponentStore.js +164 -0
- package/dist/module/host/pendingHostComponentStore.js.map +1 -0
- package/dist/module/host/resolveParams.js +60 -0
- package/dist/module/host/resolveParams.js.map +1 -0
- package/dist/module/host/routeMatcher.js +92 -0
- package/dist/module/host/routeMatcher.js.map +1 -0
- package/dist/module/host/types.js +4 -0
- package/dist/module/host/types.js.map +1 -0
- package/dist/module/index.js +12 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/package.json +1 -0
- package/dist/module/plugin/index.js +4 -0
- package/dist/module/plugin/index.js.map +1 -0
- package/dist/module/plugin/intoShared.js +32 -0
- package/dist/module/plugin/intoShared.js.map +1 -0
- package/dist/module/plugin/microFrontendPlugin.js +58 -0
- package/dist/module/plugin/microFrontendPlugin.js.map +1 -0
- package/dist/module/plugin/prelude.js +23 -0
- package/dist/module/plugin/prelude.js.map +1 -0
- package/dist/module/plugin/resolver.js +25 -0
- package/dist/module/plugin/resolver.js.map +1 -0
- package/dist/module/plugin/types.js +4 -0
- package/dist/module/plugin/types.js.map +1 -0
- package/dist/module/runtime/createMicroFrontendRuntime.js +79 -0
- package/dist/module/runtime/createMicroFrontendRuntime.js.map +1 -0
- package/dist/module/runtime/errors.js +63 -0
- package/dist/module/runtime/errors.js.map +1 -0
- package/dist/module/runtime/parseAppRequest.js +16 -0
- package/dist/module/runtime/parseAppRequest.js.map +1 -0
- package/dist/module/runtime/parseNativeRuntimeEvent.js +54 -0
- package/dist/module/runtime/parseNativeRuntimeEvent.js.map +1 -0
- package/dist/module/runtime/registry.js +87 -0
- package/dist/module/runtime/registry.js.map +1 -0
- package/dist/module/session/MicroFrontendSessionContext.js +32 -0
- package/dist/module/session/MicroFrontendSessionContext.js.map +1 -0
- package/dist/module/session/useMicroFrontendSessions.js +47 -0
- package/dist/module/session/useMicroFrontendSessions.js.map +1 -0
- package/dist/module/specs/NativeGraniteMicroFrontendRuntime.js +21 -0
- package/dist/module/specs/NativeGraniteMicroFrontendRuntime.js.map +1 -0
- package/dist/module/specs/PortalHostViewNativeComponent.ts +9 -0
- package/dist/module/specs/PortalViewNativeComponent.ts +9 -0
- package/dist/module/types.js +2 -0
- package/dist/module/types.js.map +1 -0
- package/dist/typescript/createMicroFrontendRuntime.d.ts +6 -0
- package/dist/typescript/createRoute.d.ts +23 -0
- package/dist/typescript/host/PendingHostComponent.d.ts +14 -0
- package/dist/typescript/host/index.d.ts +5 -0
- package/dist/typescript/host/pendingHostComponentStore.d.ts +11 -0
- package/dist/typescript/host/resolveParams.d.ts +10 -0
- package/dist/typescript/host/routeMatcher.d.ts +7 -0
- package/dist/typescript/host/types.d.ts +32 -0
- package/dist/typescript/index.d.ts +16 -0
- package/dist/typescript/plugin/index.d.ts +2 -0
- package/dist/typescript/plugin/intoShared.d.ts +3 -0
- package/dist/typescript/plugin/microFrontendPlugin.d.ts +3 -0
- package/dist/typescript/plugin/prelude.d.ts +6 -0
- package/dist/typescript/plugin/resolver.d.ts +3 -0
- package/dist/typescript/plugin/types.d.ts +5 -0
- package/dist/typescript/runtime/createMicroFrontendRuntime.d.ts +31 -0
- package/dist/typescript/runtime/errors.d.ts +35 -0
- package/dist/typescript/runtime/parseAppRequest.d.ts +6 -0
- package/dist/typescript/runtime/parseNativeRuntimeEvent.d.ts +3 -0
- package/dist/typescript/runtime/registry.d.ts +35 -0
- package/dist/typescript/session/MicroFrontendSessionContext.d.ts +13 -0
- package/dist/typescript/session/useMicroFrontendSessions.d.ts +8 -0
- package/dist/typescript/specs/NativeGraniteMicroFrontendRuntime.d.ts +21 -0
- package/dist/typescript/specs/PortalHostViewNativeComponent.d.ts +6 -0
- package/dist/typescript/specs/PortalViewNativeComponent.d.ts +6 -0
- package/dist/typescript/types.d.ts +49 -0
- package/ios/GraniteMicroFrontendRuntimeHost+Internal.h +18 -0
- package/ios/GraniteMicroFrontendRuntimeHost.h +34 -0
- package/ios/GraniteMicroFrontendRuntimeHost.mm +485 -0
- package/ios/GraniteMicroFrontendRuntimeModule.h +6 -0
- package/ios/GraniteMicroFrontendRuntimeModule.mm +138 -0
- package/ios/PortalHostContainerView.h +56 -0
- package/ios/PortalHostContainerView.mm +133 -0
- package/ios/PortalHostView.h +39 -0
- package/ios/PortalHostView.mm +153 -0
- package/ios/PortalRegistry.h +38 -0
- package/ios/PortalRegistry.mm +228 -0
- package/ios/PortalView.h +32 -0
- package/ios/PortalView.mm +426 -0
- package/package.json +113 -0
- package/react-native.config.js +13 -0
- package/src/createMicroFrontendRuntime.ts +22 -0
- package/src/createRoute.ts +84 -0
- package/src/host/PendingHostComponent.tsx +92 -0
- package/src/host/index.ts +26 -0
- package/src/host/pendingHostComponentStore.ts +241 -0
- package/src/host/resolveParams.ts +70 -0
- package/src/host/routeMatcher.ts +117 -0
- package/src/host/types.ts +45 -0
- package/src/index.ts +57 -0
- package/src/plugin/index.ts +2 -0
- package/src/plugin/intoShared.ts +50 -0
- package/src/plugin/microFrontendPlugin.ts +57 -0
- package/src/plugin/prelude.ts +73 -0
- package/src/plugin/resolver.ts +73 -0
- package/src/plugin/types.ts +6 -0
- package/src/runtime/createMicroFrontendRuntime.ts +115 -0
- package/src/runtime/errors.ts +86 -0
- package/src/runtime/parseAppRequest.ts +22 -0
- package/src/runtime/parseNativeRuntimeEvent.ts +54 -0
- package/src/runtime/registry.ts +131 -0
- package/src/session/MicroFrontendSessionContext.tsx +45 -0
- package/src/session/useMicroFrontendSessions.ts +73 -0
- package/src/specs/NativeGraniteMicroFrontendRuntime.ts +44 -0
- package/src/specs/PortalHostViewNativeComponent.ts +9 -0
- package/src/specs/PortalViewNativeComponent.ts +9 -0
- package/src/types.ts +55 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "RNTPortalViewState.h"
|
|
4
|
+
#include "PortalShadowRegistry.h"
|
|
5
|
+
|
|
6
|
+
#include <react/renderer/components/GraniteMicroFrontendRuntimeSpec/EventEmitters.h>
|
|
7
|
+
#include <react/renderer/components/GraniteMicroFrontendRuntimeSpec/Props.h>
|
|
8
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
9
|
+
#include <react/renderer/graphics/Transform.h>
|
|
10
|
+
#include <jsi/jsi.h>
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
JSI_EXPORT extern const char PortalViewComponentName[];
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
* `ShadowNode` for <PortalView> component.
|
|
18
|
+
*/
|
|
19
|
+
class PortalViewShadowNode : public ConcreteViewShadowNode<
|
|
20
|
+
PortalViewComponentName,
|
|
21
|
+
PortalViewProps,
|
|
22
|
+
PortalViewEventEmitter,
|
|
23
|
+
PortalViewState> {
|
|
24
|
+
public:
|
|
25
|
+
using ConcreteViewShadowNode::ConcreteViewShadowNode;
|
|
26
|
+
|
|
27
|
+
// Helper method to conditionally set dimensions from host
|
|
28
|
+
void setDimensionsFromHost(HostSize hostSize) const {
|
|
29
|
+
// printf("HostSize:: width - %f height - %f\n", hostSize.width, hostSize.height);
|
|
30
|
+
|
|
31
|
+
if (hostSize.width != 0 && hostSize.height != 0) {
|
|
32
|
+
setSize(Size(hostSize.width, hostSize.height));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
Transform getTransform() const override {
|
|
37
|
+
auto transform = ConcreteViewShadowNode::getTransform();
|
|
38
|
+
auto &props = static_cast<const PortalViewProps &>(*getProps());
|
|
39
|
+
if (props.hostName.empty()) {
|
|
40
|
+
return transform;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const auto &stateData =
|
|
44
|
+
static_cast<const PortalViewShadowNode::ConcreteState &>(*getState())
|
|
45
|
+
.getData();
|
|
46
|
+
|
|
47
|
+
return transform * Transform::Translate(stateData.offsetX, stateData.offsetY, 0);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
} // namespace facebook::react
|
package/common/cpp/react/renderer/components/GraniteMicroFrontendRuntimeSpec/RNTPortalViewState.h
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <react/renderer/graphics/Float.h>
|
|
4
|
+
|
|
5
|
+
#ifdef ANDROID
|
|
6
|
+
#include <folly/dynamic.h>
|
|
7
|
+
#endif
|
|
8
|
+
|
|
9
|
+
namespace facebook::react {
|
|
10
|
+
|
|
11
|
+
class PortalViewState {
|
|
12
|
+
public:
|
|
13
|
+
PortalViewState() = default;
|
|
14
|
+
PortalViewState(
|
|
15
|
+
Float hostWidth_,
|
|
16
|
+
Float hostHeight_,
|
|
17
|
+
Float offsetX_,
|
|
18
|
+
Float offsetY_)
|
|
19
|
+
: hostWidth(hostWidth_),
|
|
20
|
+
hostHeight(hostHeight_),
|
|
21
|
+
offsetX(offsetX_),
|
|
22
|
+
offsetY(offsetY_) {}
|
|
23
|
+
|
|
24
|
+
#ifdef ANDROID
|
|
25
|
+
PortalViewState(PortalViewState const &previousState, folly::dynamic data)
|
|
26
|
+
: hostWidth((Float)data["hostWidth"].getDouble()),
|
|
27
|
+
hostHeight((Float)data["hostHeight"].getDouble()),
|
|
28
|
+
offsetX((Float)data["offsetX"].getDouble()),
|
|
29
|
+
offsetY((Float)data["offsetY"].getDouble()) {}
|
|
30
|
+
|
|
31
|
+
folly::dynamic getDynamic() const {
|
|
32
|
+
return folly::dynamic::object("hostWidth", hostWidth)(
|
|
33
|
+
"hostHeight", hostHeight)("offsetX", offsetX)("offsetY", offsetY);
|
|
34
|
+
}
|
|
35
|
+
#endif
|
|
36
|
+
|
|
37
|
+
Float hostWidth{0};
|
|
38
|
+
Float hostHeight{0};
|
|
39
|
+
Float offsetX{0};
|
|
40
|
+
Float offsetY{0};
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { removePendingHostComponentRoutes } from "./host/pendingHostComponentStore.js";
|
|
4
|
+
import { createMicroFrontendRuntimeWithDependencies } from "./runtime/createMicroFrontendRuntime.js";
|
|
5
|
+
import { parseNativeRuntimeEvent } from "./runtime/parseNativeRuntimeEvent.js";
|
|
6
|
+
import { microFrontendModuleRegistry } from "./runtime/registry.js";
|
|
7
|
+
import NativeGraniteMicroFrontendRuntime from "./specs/NativeGraniteMicroFrontendRuntime.js";
|
|
8
|
+
export function createMicroFrontendRuntime(options) {
|
|
9
|
+
return createMicroFrontendRuntimeWithDependencies({
|
|
10
|
+
adapter: options.adapter,
|
|
11
|
+
nativeRuntime: NativeGraniteMicroFrontendRuntime,
|
|
12
|
+
onPreloadError: options.onPreloadError ?? (() => undefined),
|
|
13
|
+
parseEvent: parseNativeRuntimeEvent,
|
|
14
|
+
registry: microFrontendModuleRegistry,
|
|
15
|
+
removePendingHostComponentRoutes
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=createMicroFrontendRuntime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["removePendingHostComponentRoutes","createMicroFrontendRuntimeWithDependencies","parseNativeRuntimeEvent","microFrontendModuleRegistry","NativeGraniteMicroFrontendRuntime","createMicroFrontendRuntime","options","adapter","nativeRuntime","onPreloadError","undefined","parseEvent","registry"],"sourceRoot":"../../src","sources":["createMicroFrontendRuntime.ts"],"mappings":";;AAAA,SAASA,gCAAgC,QAAQ,qCAAkC;AACnF,SAASC,0CAA0C,QAAQ,yCAAsC;AACjG,SAASC,uBAAuB,QAAQ,sCAAmC;AAC3E,SAASC,2BAA2B,QAAQ,uBAAoB;AAChE,OAAOC,iCAAiC,MAAM,8CAA2C;AAQzF,OAAO,SAASC,0BAA0BA,CAACC,OAA0C,EAA2B;EAC9G,OAAOL,0CAA0C,CAAC;IAChDM,OAAO,EAAED,OAAO,CAACC,OAAO;IACxBC,aAAa,EAAEJ,iCAAiC;IAChDK,cAAc,EAAEH,OAAO,CAACG,cAAc,KAAK,MAAMC,SAAS,CAAC;IAC3DC,UAAU,EAAET,uBAAuB;IACnCU,QAAQ,EAAET,2BAA2B;IACrCH;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createRoute as createGraniteRoute, getSchemeUri } from '@granite-js/react-native';
|
|
4
|
+
import { registerPendingHostComponentRoute } from "./host/pendingHostComponentStore.js";
|
|
5
|
+
export function createRoute(path, options) {
|
|
6
|
+
const {
|
|
7
|
+
hostPendingComponent,
|
|
8
|
+
...routeOptions
|
|
9
|
+
} = options;
|
|
10
|
+
if (hostPendingComponent != null) {
|
|
11
|
+
const app = getCurrentGraniteApp();
|
|
12
|
+
if (app != null) {
|
|
13
|
+
registerPendingHostComponentRoute(String(path), {
|
|
14
|
+
app,
|
|
15
|
+
component: hostPendingComponent,
|
|
16
|
+
parserParams: routeOptions.parserParams,
|
|
17
|
+
validateParams: routeOptions.validateParams
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return createGraniteRoute(path, routeOptions);
|
|
22
|
+
}
|
|
23
|
+
function getCurrentGraniteApp() {
|
|
24
|
+
const granite = Reflect.get(globalThis, '__granite');
|
|
25
|
+
if (!isPropertyMap(granite) || !isPropertyMap(granite['app'])) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
const host = granite['app']['host'];
|
|
29
|
+
const name = granite['app']['name'];
|
|
30
|
+
if (typeof host !== 'string' || typeof name !== 'string') {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
const scheme = new URL(getSchemeUri()).protocol.replace(/:$/g, '');
|
|
34
|
+
return {
|
|
35
|
+
name,
|
|
36
|
+
scheme,
|
|
37
|
+
host
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function isPropertyMap(value) {
|
|
41
|
+
return typeof value === 'object' && value !== null;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=createRoute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createRoute","createGraniteRoute","getSchemeUri","registerPendingHostComponentRoute","path","options","hostPendingComponent","routeOptions","app","getCurrentGraniteApp","String","component","parserParams","validateParams","granite","Reflect","get","globalThis","isPropertyMap","host","name","scheme","URL","protocol","replace","value"],"sourceRoot":"../../src","sources":["createRoute.ts"],"mappings":";;AAAA,SACEA,WAAW,IAAIC,kBAAkB,EACjCC,YAAY,QAIP,0BAA0B;AAEjC,SAASC,iCAAiC,QAAQ,qCAAkC;AA+BpF,OAAO,SAASH,WAAWA,CACzBI,IAA+B,EAC/BC,OAA2C,EAC3C;EACA,MAAM;IAAEC,oBAAoB;IAAE,GAAGC;EAAa,CAAC,GAAGF,OAAO;EAEzD,IAAIC,oBAAoB,IAAI,IAAI,EAAE;IAChC,MAAME,GAAG,GAAGC,oBAAoB,CAAC,CAAC;IAClC,IAAID,GAAG,IAAI,IAAI,EAAE;MACfL,iCAAiC,CAACO,MAAM,CAACN,IAAI,CAAC,EAAE;QAC9CI,GAAG;QACHG,SAAS,EAAEL,oBAAoB;QAC/BM,YAAY,EAAEL,YAAY,CAACK,YAAY;QACvCC,cAAc,EAAEN,YAAY,CAACM;MAC/B,CAAC,CAAC;IACJ;EACF;EAEA,OAAOZ,kBAAkB,CAACG,IAAI,EAAEG,YAAY,CAAC;AAC/C;AAEA,SAASE,oBAAoBA,CAAA,EAAyC;EACpE,MAAMK,OAAgB,GAAGC,OAAO,CAACC,GAAG,CAACC,UAAU,EAAE,WAAW,CAAC;EAC7D,IAAI,CAACC,aAAa,CAACJ,OAAO,CAAC,IAAI,CAACI,aAAa,CAACJ,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE;IAC7D,OAAO,IAAI;EACb;EAEA,MAAMK,IAAI,GAAGL,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;EACnC,MAAMM,IAAI,GAAGN,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;EACnC,IAAI,OAAOK,IAAI,KAAK,QAAQ,IAAI,OAAOC,IAAI,KAAK,QAAQ,EAAE;IACxD,OAAO,IAAI;EACb;EAEA,MAAMC,MAAM,GAAG,IAAIC,GAAG,CAACpB,YAAY,CAAC,CAAC,CAAC,CAACqB,QAAQ,CAACC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;EAElE,OAAO;IACLJ,IAAI;IACJC,MAAM;IACNF;EACF,CAAC;AACH;AAEA,SAASD,aAAaA,CAACO,KAAc,EAAmD;EACtF,OAAO,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,IAAI;AACpD","ignoreList":[]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useState, useSyncExternalStore } from 'react';
|
|
4
|
+
import { StyleSheet, View } from 'react-native';
|
|
5
|
+
import { getPendingHostComponentStoreVersion, getIsPendingHostComponentHidden, resetPendingHostComponent, resolvePendingHostComponent, subscribePendingHostComponentStore } from "./pendingHostComponentStore.js";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
export function useIsPendingHostComponentHidden() {
|
|
8
|
+
return useSyncExternalStore(subscribePendingHostComponentStore, getIsPendingHostComponentHidden, getIsPendingHostComponentHidden);
|
|
9
|
+
}
|
|
10
|
+
function usePendingHostComponentStoreVersion() {
|
|
11
|
+
return useSyncExternalStore(subscribePendingHostComponentStore, getPendingHostComponentStoreVersion, getPendingHostComponentStoreVersion);
|
|
12
|
+
}
|
|
13
|
+
export function useResolvedPendingHostComponent(url) {
|
|
14
|
+
usePendingHostComponentStoreVersion();
|
|
15
|
+
if (url == null) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return resolvePendingHostComponent(url);
|
|
19
|
+
}
|
|
20
|
+
export function PendingHostComponent({
|
|
21
|
+
url
|
|
22
|
+
}) {
|
|
23
|
+
const resolvedPendingHostComponent = useResolvedPendingHostComponent(url);
|
|
24
|
+
const isHidden = useIsPendingHostComponentHidden();
|
|
25
|
+
if (resolvedPendingHostComponent == null || isHidden) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
const Component = resolvedPendingHostComponent.component;
|
|
29
|
+
return /*#__PURE__*/_jsx(View, {
|
|
30
|
+
accessibilityElementsHidden: true,
|
|
31
|
+
importantForAccessibility: "no-hide-descendants",
|
|
32
|
+
pointerEvents: "none",
|
|
33
|
+
style: styles.root,
|
|
34
|
+
children: /*#__PURE__*/_jsx(Component, {
|
|
35
|
+
...resolvedPendingHostComponent.params
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
export function usePendingHostComponentController() {
|
|
40
|
+
const [url, setUrl] = useState(null);
|
|
41
|
+
const [isPresent, setIsPresent] = useState(false);
|
|
42
|
+
const isHidden = useIsPendingHostComponentHidden();
|
|
43
|
+
const present = useCallback(nextUrl => {
|
|
44
|
+
setIsPresent(wasPresent => {
|
|
45
|
+
if (wasPresent) {
|
|
46
|
+
resetPendingHostComponent();
|
|
47
|
+
}
|
|
48
|
+
return true;
|
|
49
|
+
});
|
|
50
|
+
setUrl(nextUrl);
|
|
51
|
+
}, []);
|
|
52
|
+
const dismiss = useCallback(() => {
|
|
53
|
+
resetPendingHostComponent();
|
|
54
|
+
setUrl(null);
|
|
55
|
+
setIsPresent(false);
|
|
56
|
+
}, []);
|
|
57
|
+
return {
|
|
58
|
+
url,
|
|
59
|
+
isPresent,
|
|
60
|
+
isHidden,
|
|
61
|
+
present,
|
|
62
|
+
dismiss
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const styles = StyleSheet.create({
|
|
66
|
+
root: {
|
|
67
|
+
...StyleSheet.absoluteFillObject
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=PendingHostComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useState","useSyncExternalStore","StyleSheet","View","getPendingHostComponentStoreVersion","getIsPendingHostComponentHidden","resetPendingHostComponent","resolvePendingHostComponent","subscribePendingHostComponentStore","jsx","_jsx","useIsPendingHostComponentHidden","usePendingHostComponentStoreVersion","useResolvedPendingHostComponent","url","PendingHostComponent","resolvedPendingHostComponent","isHidden","Component","component","accessibilityElementsHidden","importantForAccessibility","pointerEvents","style","styles","root","children","params","usePendingHostComponentController","setUrl","isPresent","setIsPresent","present","nextUrl","wasPresent","dismiss","create","absoluteFillObject"],"sourceRoot":"../../../src","sources":["host/PendingHostComponent.tsx"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,QAAQ,EAAEC,oBAAoB,QAAQ,OAAO;AACnE,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/C,SACEC,mCAAmC,EACnCC,+BAA+B,EAC/BC,yBAAyB,EACzBC,2BAA2B,EAC3BC,kCAAkC,QAC7B,gCAA6B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAcrC,OAAO,SAASC,+BAA+BA,CAAA,EAAG;EAChD,OAAOV,oBAAoB,CAACO,kCAAkC,EAAEH,+BAA+B,EAAEA,+BAA+B,CAAC;AACnI;AAEA,SAASO,mCAAmCA,CAAA,EAAG;EAC7C,OAAOX,oBAAoB,CAACO,kCAAkC,EAAEJ,mCAAmC,EAAEA,mCAAmC,CAAC;AAC3I;AAEA,OAAO,SAASS,+BAA+BA,CAACC,GAA8B,EAAE;EAC9EF,mCAAmC,CAAC,CAAC;EAErC,IAAIE,GAAG,IAAI,IAAI,EAAE;IACf,OAAO,IAAI;EACb;EAEA,OAAOP,2BAA2B,CAACO,GAAG,CAAC;AACzC;AAEA,OAAO,SAASC,oBAAoBA,CAAC;EAAED;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;IAAEG;EAAQ,CAAC;AACvD;AAEA,MAAMX,MAAM,GAAGtB,UAAU,CAACkC,MAAM,CAAC;EAC/BX,IAAI,EAAE;IACJ,GAAGvB,UAAU,CAACmC;EAChB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export { PendingHostComponent, usePendingHostComponentController, useIsPendingHostComponentHidden, useResolvedPendingHostComponent } from "./PendingHostComponent.js";
|
|
4
|
+
export { createPendingHostComponentRoutePrefix, normalizeRoutePath } from "./routeMatcher.js";
|
|
5
|
+
export { hidePendingHostComponent, installPendingHostComponentBridge, registerPendingHostComponentRoute, resetPendingHostComponent, resolvePendingHostComponent } from "./pendingHostComponentStore.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["PendingHostComponent","usePendingHostComponentController","useIsPendingHostComponentHidden","useResolvedPendingHostComponent","createPendingHostComponentRoutePrefix","normalizeRoutePath","hidePendingHostComponent","installPendingHostComponentBridge","registerPendingHostComponentRoute","resetPendingHostComponent","resolvePendingHostComponent"],"sourceRoot":"../../../src","sources":["host/index.ts"],"mappings":";;AACA,SACEA,oBAAoB,EACpBC,iCAAiC,EACjCC,+BAA+B,EAC/BC,+BAA+B,QAC1B,2BAAwB;AAS/B,SACEC,qCAAqC,EACrCC,kBAAkB,QACb,mBAAgB;AACvB,SACEC,wBAAwB,EACxBC,iCAAiC,EACjCC,iCAAiC,EACjCC,yBAAyB,EACzBC,2BAA2B,QACtB,gCAA6B","ignoreList":[]}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { resolvePendingHostComponentParams } from "./resolveParams.js";
|
|
4
|
+
import { createPendingHostComponentRoutePrefix, getQueryParamsFromUrl, getRoutePathFromUrl, matchRoutePath, normalizePendingHostComponentAppName, normalizeRoutePath } from "./routeMatcher.js";
|
|
5
|
+
function getGlobalObject() {
|
|
6
|
+
return globalThis;
|
|
7
|
+
}
|
|
8
|
+
function getPendingHostComponentStore() {
|
|
9
|
+
const globalObject = getGlobalObject();
|
|
10
|
+
if (globalObject.__graniteMicroFrontendPendingHostComponentStore == null) {
|
|
11
|
+
globalObject.__graniteMicroFrontendPendingHostComponentStore = {
|
|
12
|
+
entries: [],
|
|
13
|
+
hidden: false,
|
|
14
|
+
listeners: new Set(),
|
|
15
|
+
version: 0
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return globalObject.__graniteMicroFrontendPendingHostComponentStore;
|
|
19
|
+
}
|
|
20
|
+
function emitPendingHostComponentStoreChange() {
|
|
21
|
+
const store = getPendingHostComponentStore();
|
|
22
|
+
store.version += 1;
|
|
23
|
+
store.listeners.forEach(listener => listener());
|
|
24
|
+
}
|
|
25
|
+
export function subscribePendingHostComponentStore(listener) {
|
|
26
|
+
const store = getPendingHostComponentStore();
|
|
27
|
+
store.listeners.add(listener);
|
|
28
|
+
return () => store.listeners.delete(listener);
|
|
29
|
+
}
|
|
30
|
+
export function getPendingHostComponentStoreVersion() {
|
|
31
|
+
return getPendingHostComponentStore().version;
|
|
32
|
+
}
|
|
33
|
+
export function getIsPendingHostComponentHidden() {
|
|
34
|
+
return getPendingHostComponentStore().hidden;
|
|
35
|
+
}
|
|
36
|
+
function setPendingHostComponentHidden(hidden) {
|
|
37
|
+
const store = getPendingHostComponentStore();
|
|
38
|
+
if (store.hidden === hidden) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
store.hidden = hidden;
|
|
42
|
+
emitPendingHostComponentStoreChange();
|
|
43
|
+
}
|
|
44
|
+
export function hidePendingHostComponent() {
|
|
45
|
+
setPendingHostComponentHidden(true);
|
|
46
|
+
const hideSharedPendingHostComponent = getGlobalObject().hideSharedPendingHostComponent;
|
|
47
|
+
if (typeof hideSharedPendingHostComponent === 'function' && hideSharedPendingHostComponent !== hidePendingHostComponent) {
|
|
48
|
+
hideSharedPendingHostComponent();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export function resetPendingHostComponent() {
|
|
52
|
+
setPendingHostComponentHidden(false);
|
|
53
|
+
}
|
|
54
|
+
export function installPendingHostComponentBridge() {
|
|
55
|
+
getGlobalObject().hideSharedPendingHostComponent = hidePendingHostComponent;
|
|
56
|
+
}
|
|
57
|
+
export function registerPendingHostComponentRoute(routePath, options) {
|
|
58
|
+
const store = getPendingHostComponentStore();
|
|
59
|
+
const normalizedRoutePath = normalizeRoutePath(routePath);
|
|
60
|
+
const appName = normalizePendingHostComponentAppName(options.app.name);
|
|
61
|
+
const routePrefix = createPendingHostComponentRoutePrefix(options.app);
|
|
62
|
+
const id = `${routePrefix}:${normalizedRoutePath}`;
|
|
63
|
+
const entry = {
|
|
64
|
+
id,
|
|
65
|
+
routePath: normalizedRoutePath,
|
|
66
|
+
routePrefix,
|
|
67
|
+
appName,
|
|
68
|
+
component: options.component,
|
|
69
|
+
parserParams: options.parserParams,
|
|
70
|
+
validateParams: options.validateParams
|
|
71
|
+
};
|
|
72
|
+
const existingIndex = store.entries.findIndex(item => item.id === id);
|
|
73
|
+
if (existingIndex >= 0) {
|
|
74
|
+
store.entries[existingIndex] = entry;
|
|
75
|
+
} else {
|
|
76
|
+
store.entries.push(entry);
|
|
77
|
+
}
|
|
78
|
+
emitPendingHostComponentStoreChange();
|
|
79
|
+
}
|
|
80
|
+
export function removePendingHostComponentRoutes(appName) {
|
|
81
|
+
const store = getPendingHostComponentStore();
|
|
82
|
+
const normalizedAppName = normalizePendingHostComponentAppName(appName);
|
|
83
|
+
const remainingEntries = store.entries.filter(entry => entry.appName !== normalizedAppName);
|
|
84
|
+
if (remainingEntries.length === store.entries.length) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
store.entries = remainingEntries;
|
|
88
|
+
emitPendingHostComponentStoreChange();
|
|
89
|
+
}
|
|
90
|
+
export function resolvePendingHostComponent(request) {
|
|
91
|
+
const matched = typeof request === 'string' ? findRouteByUrl(request) : findRouteByRequest(request);
|
|
92
|
+
return resolveMatchedPendingHostComponent(matched);
|
|
93
|
+
}
|
|
94
|
+
function resolveMatchedPendingHostComponent(matched) {
|
|
95
|
+
if (matched == null) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
const params = resolvePendingHostComponentParams({
|
|
99
|
+
...matched.pathParams,
|
|
100
|
+
...matched.params
|
|
101
|
+
}, matched.entry.parserParams, matched.entry.validateParams);
|
|
102
|
+
if (params.status === 'invalid') {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
component: matched.entry.component,
|
|
107
|
+
params: params.value,
|
|
108
|
+
url: matched.url,
|
|
109
|
+
routePath: matched.routePath,
|
|
110
|
+
appName: matched.entry.appName
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function findRouteByUrl(url) {
|
|
114
|
+
const entries = getPendingHostComponentStore().entries;
|
|
115
|
+
for (let index = entries.length - 1; index >= 0; index -= 1) {
|
|
116
|
+
const entry = entries[index];
|
|
117
|
+
if (entry == null) {
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
const routePath = getRoutePathFromUrl(url, entry.routePrefix);
|
|
121
|
+
const pathParams = routePath == null ? null : matchRoutePath(entry.routePath, routePath);
|
|
122
|
+
if (routePath == null || pathParams == null) {
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
entry,
|
|
127
|
+
pathParams,
|
|
128
|
+
params: getQueryParamsFromUrl(url),
|
|
129
|
+
routePath,
|
|
130
|
+
url
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
function findRouteByRequest(request) {
|
|
136
|
+
const appName = normalizePendingHostComponentAppName(request.appName);
|
|
137
|
+
for (let index = getPendingHostComponentStore().entries.length - 1; index >= 0; index -= 1) {
|
|
138
|
+
const entry = getPendingHostComponentStore().entries[index];
|
|
139
|
+
if (entry == null || entry.appName !== appName) {
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
const routePath = normalizeRoutePath(request.routePath);
|
|
143
|
+
const pathParams = matchRoutePath(entry.routePath, routePath);
|
|
144
|
+
if (pathParams == null) {
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
return {
|
|
148
|
+
entry,
|
|
149
|
+
pathParams,
|
|
150
|
+
params: request.params ?? {},
|
|
151
|
+
routePath,
|
|
152
|
+
url: request.url ?? null
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
export function resetPendingHostComponentStoreForTest() {
|
|
158
|
+
const store = getPendingHostComponentStore();
|
|
159
|
+
store.entries = [];
|
|
160
|
+
store.hidden = false;
|
|
161
|
+
store.version = 0;
|
|
162
|
+
emitPendingHostComponentStoreChange();
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=pendingHostComponentStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["resolvePendingHostComponentParams","createPendingHostComponentRoutePrefix","getQueryParamsFromUrl","getRoutePathFromUrl","matchRoutePath","normalizePendingHostComponentAppName","normalizeRoutePath","getGlobalObject","globalThis","getPendingHostComponentStore","globalObject","__graniteMicroFrontendPendingHostComponentStore","entries","hidden","listeners","Set","version","emitPendingHostComponentStoreChange","store","forEach","listener","subscribePendingHostComponentStore","add","delete","getPendingHostComponentStoreVersion","getIsPendingHostComponentHidden","setPendingHostComponentHidden","hidePendingHostComponent","hideSharedPendingHostComponent","resetPendingHostComponent","installPendingHostComponentBridge","registerPendingHostComponentRoute","routePath","options","normalizedRoutePath","appName","app","name","routePrefix","id","entry","component","parserParams","validateParams","existingIndex","findIndex","item","push","removePendingHostComponentRoutes","normalizedAppName","remainingEntries","filter","length","resolvePendingHostComponent","request","matched","findRouteByUrl","findRouteByRequest","resolveMatchedPendingHostComponent","params","pathParams","status","value","url","index","resetPendingH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G9B,oCAAoC,CAACiD,OAAO,CAACnB,OAAO,CAAC;EAErE,KAAK,IAAI6B,KAAK,GAAGvD,4BAA4B,CAAC,CAAC,CAACG,OAAO,CAACwC,MAAM,GAAG,CAAC,EAAEY,KAAK,IAAI,CAAC,EAAEA,KAAK,IAAI,CAAC,EAAE;IAC1F,MAAMxB,KAAK,GAAG/B,4BAA4B,CAAC,CAAC,CAACG,OAAO,CAACoD,KAAK,CAAC;IAC3D,IAAIxB,KAAK,IAAI,IAAI,IAAIA,KAAK,CAACL,OAAO,KAAKA,OAAO,EAAE;MAC9C;IACF;IAEA,MAAMH,SAAS,GAAG1B,kBAAkB,CAACgD,OAAO,CAACtB,SAAS,CAAC;IACvD,MAAM4B,UAAU,GAAGxD,cAAc,CAACoC,KAAK,CAACR,SAAS,EAAEA,SAAS,CAAC;IAC7D,IAAI4B,UAAU,IAAI,IAAI,EAAE;MACtB;IACF;IAEA,OAAO;MACLpB,KAAK;MACLoB,UAAU;MACVD,MAAM,EAAEL,OAAO,CAACK,MAAM,IAAI,CAAC,CAAC;MAC5B3B,SAAS;MACT+B,GAAG,EAAET,OAAO,CAACS,GAAG,IAAI;IACtB,CAAC;EACH;EAEA,OAAO,IAAI;AACb;AAEA,OAAO,SAASE,qCAAqCA,CAAA,EAAG;EACtD,MAAM/C,KAAK,GAAGT,4BAA4B,CAAC,CAAC;EAC5CS,KAAK,CAACN,OAAO,GAAG,EAAE;EAClBM,KAAK,CAACL,MAAM,GAAG,KAAK;EACpBK,KAAK,CAACF,OAAO,GAAG,CAAC;EACjBC,mCAAmC,CAAC,CAAC;AACvC","ignoreList":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export function resolvePendingHostComponentParams(rawParams, parserParams, validateParams) {
|
|
4
|
+
const parsedParams = (parserParams ?? defaultParserParams)(rawParams);
|
|
5
|
+
if (validateParams == null) {
|
|
6
|
+
return {
|
|
7
|
+
status: 'resolved',
|
|
8
|
+
value: parsedParams
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
try {
|
|
12
|
+
if (isStandardSchema(validateParams)) {
|
|
13
|
+
const result = validateParams['~standard'].validate(parsedParams);
|
|
14
|
+
if (result instanceof Promise) {
|
|
15
|
+
return {
|
|
16
|
+
status: 'invalid',
|
|
17
|
+
cause: new Error('Async pending host component validation is not supported')
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
if (result.issues != null) {
|
|
21
|
+
return {
|
|
22
|
+
status: 'invalid',
|
|
23
|
+
cause: new Error(result.issues.map(issue => issue.message).join(', '))
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
status: 'resolved',
|
|
28
|
+
value: result.value ?? {}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
status: 'resolved',
|
|
33
|
+
value: validateParams(parsedParams) ?? {}
|
|
34
|
+
};
|
|
35
|
+
} catch (error) {
|
|
36
|
+
return {
|
|
37
|
+
status: 'invalid',
|
|
38
|
+
cause: error instanceof Error ? error : new Error(String(error))
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function defaultParserParams(params) {
|
|
43
|
+
return Object.fromEntries(Object.entries(params).map(([key, value]) => {
|
|
44
|
+
if (typeof value !== 'string') {
|
|
45
|
+
return [key, value];
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
return [key, JSON.parse(value)];
|
|
49
|
+
} catch (error) {
|
|
50
|
+
if (!(error instanceof SyntaxError)) {
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
return [key, value];
|
|
54
|
+
}
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
function isStandardSchema(value) {
|
|
58
|
+
return typeof value === 'object' && value !== null && '~standard' in value;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=resolveParams.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["resolvePendingHostComponentParams","rawParams","parserParams","validateParams","parsedParams","defaultParserParams","status","value","isStandardSchema","result","validate","Promise","cause","Error","issues","map","issue","message","join","error","String","params","Object","fromEntries","entries","key","JSON","parse","SyntaxError"],"sourceRoot":"../../../src","sources":["host/resolveParams.ts"],"mappings":";;AAOA,OAAO,SAASA,iCAAiCA,CAC/CC,SAAkC,EAClCC,YAAsC,EACtCC,cAAwE,EACxD;EAChB,MAAMC,YAAY,GAAG,CAACF,YAAY,IAAIG,mBAAmB,EAAEJ,SAAS,CAAC;EAErE,IAAIE,cAAc,IAAI,IAAI,EAAE;IAC1B,OAAO;MAAEG,MAAM,EAAE,UAAU;MAAEC,KAAK,EAAEH;IAAa,CAAC;EACpD;EAEA,IAAI;IACF,IAAII,gBAAgB,CAACL,cAAc,CAAC,EAAE;MACpC,MAAMM,MAAM,GAAGN,cAAc,CAAC,WAAW,CAAC,CAACO,QAAQ,CAACN,YAAY,CAAC;MAEjE,IAAIK,MAAM,YAAYE,OAAO,EAAE;QAC7B,OAAO;UAAEL,MAAM,EAAE,SAAS;UAAEM,KAAK,EAAE,IAAIC,KAAK,CAAC,0DAA0D;QAAE,CAAC;MAC5G;MAEA,IAAIJ,MAAM,CAACK,MAAM,IAAI,IAAI,EAAE;QACzB,OAAO;UACLR,MAAM,EAAE,SAAS;UACjBM,KAAK,EAAE,IAAIC,KAAK,CAACJ,MAAM,CAACK,MAAM,CAACC,GAAG,CAACC,KAAK,IAAIA,KAAK,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;QACvE,CAAC;MACH;MAEA,OAAO;QAAEZ,MAAM,EAAE,UAAU;QAAEC,KAAK,EAAEE,MAAM,CAACF,KAAK,IAAI,CAAC;MAAE,CAAC;IAC1D;IAEA,OAAO;MAAED,MAAM,EAAE,UAAU;MAAEC,KAAK,EAAEJ,cAAc,CAACC,YAAY,CAAC,IAAI,CAAC;IAAE,CAAC;EAC1E,CAAC,CAAC,OAAOe,KAAK,EAAE;IACd,OAAO;MACLb,MAAM,EAAE,SAAS;MACjBM,KAAK,EAAEO,KAAK,YAAYN,KAAK,GAAGM,KAAK,GAAG,IAAIN,KAAK,CAACO,MAAM,CAACD,KAAK,CAAC;IACjE,CAAC;EACH;AACF;AAEA,SAASd,mBAAmBA,CAACgB,MAA+B,EAA2B;EACrF,OAAOC,MAAM,CAACC,WAAW,CACvBD,MAAM,CAACE,OAAO,CAACH,MAAM,CAAC,CAACN,GAAG,CAAC,CAAC,CAACU,GAAG,EAAElB,KAAK,CAAC,KAAK;IAC3C,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MAC7B,OAAO,CAACkB,GAAG,EAAElB,KAAK,CAAC;IACrB;IAEA,IAAI;MACF,OAAO,CAACkB,GAAG,EAAEC,IAAI,CAACC,KAAK,CAACpB,KAAK,CAAC,CAAC;IACjC,CAAC,CAAC,OAAOY,KAAK,EAAE;MACd,IAAI,EAAEA,KAAK,YAAYS,WAAW,CAAC,EAAE;QACnC,MAAMT,KAAK;MACb;MAEA,OAAO,CAACM,GAAG,EAAElB,KAAK,CAAC;IACrB;EACF,CAAC,CACH,CAAC;AACH;AAEA,SAASC,gBAAgBA,CACvBD,KAA8B,EACe;EAC7C,OAAO,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,IAAI,IAAI,WAAW,IAAIA,KAAK;AAC5E","ignoreList":[]}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export function normalizeRoutePath(routePath) {
|
|
4
|
+
const pathname = routePath.split('#')[0]?.split('?')[0] ?? '/';
|
|
5
|
+
const pathWithLeadingSlash = pathname.startsWith('/') ? pathname : `/${pathname}`;
|
|
6
|
+
const normalizedPathname = pathWithLeadingSlash.replace(/\/+/g, '/');
|
|
7
|
+
return normalizedPathname === '/' ? '/' : normalizedPathname.replace(/\/+$/g, '');
|
|
8
|
+
}
|
|
9
|
+
export function createPendingHostComponentRoutePrefix(app) {
|
|
10
|
+
const scheme = app.scheme.replace(/:$/g, '');
|
|
11
|
+
const appName = normalizePendingHostComponentAppName(app.name);
|
|
12
|
+
const host = app.host == null ? '' : app.host.replace(/^\/+|\/+$/g, '');
|
|
13
|
+
return host.length > 0 ? `${scheme}://${host}/${appName}` : `${scheme}://${appName}`;
|
|
14
|
+
}
|
|
15
|
+
export function getRoutePathFromUrl(url, routePrefix) {
|
|
16
|
+
const normalizedPrefix = trimTrailingSlash(routePrefix);
|
|
17
|
+
const urlWithoutSearch = trimTrailingSlash(stripSearchAndHash(url));
|
|
18
|
+
if (urlWithoutSearch === normalizedPrefix) {
|
|
19
|
+
return '/';
|
|
20
|
+
}
|
|
21
|
+
if (!urlWithoutSearch.startsWith(`${normalizedPrefix}/`)) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return normalizeRoutePath(urlWithoutSearch.slice(normalizedPrefix.length));
|
|
25
|
+
}
|
|
26
|
+
export function getQueryParamsFromUrl(url) {
|
|
27
|
+
try {
|
|
28
|
+
return Object.fromEntries(new URL(url).searchParams.entries());
|
|
29
|
+
} catch (error) {
|
|
30
|
+
if (!(error instanceof TypeError)) {
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
const questionMarkIndex = url.indexOf('?');
|
|
34
|
+
if (questionMarkIndex === -1) {
|
|
35
|
+
return {};
|
|
36
|
+
}
|
|
37
|
+
const fragmentIndex = url.indexOf('#', questionMarkIndex + 1);
|
|
38
|
+
const queryEndIndex = fragmentIndex === -1 ? url.length : fragmentIndex;
|
|
39
|
+
return Object.fromEntries(new URLSearchParams(url.slice(questionMarkIndex + 1, queryEndIndex)).entries());
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export function matchRoutePath(pattern, routePath) {
|
|
43
|
+
const patternSegments = splitRoutePath(pattern);
|
|
44
|
+
const routeSegments = splitRoutePath(routePath);
|
|
45
|
+
if (patternSegments.length !== routeSegments.length) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
const params = {};
|
|
49
|
+
for (let index = 0; index < patternSegments.length; index += 1) {
|
|
50
|
+
const patternSegment = patternSegments[index];
|
|
51
|
+
const routeSegment = routeSegments[index];
|
|
52
|
+
if (patternSegment == null || routeSegment == null) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
if (patternSegment.startsWith(':')) {
|
|
56
|
+
const paramName = patternSegment.slice(1);
|
|
57
|
+
if (paramName.length === 0) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
params[paramName] = decodeRouteSegment(routeSegment);
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (patternSegment !== routeSegment) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return params;
|
|
68
|
+
}
|
|
69
|
+
export function normalizePendingHostComponentAppName(appName) {
|
|
70
|
+
return appName.replace(/^\/+|\/+$/g, '');
|
|
71
|
+
}
|
|
72
|
+
function splitRoutePath(routePath) {
|
|
73
|
+
const normalizedRoutePath = normalizeRoutePath(routePath);
|
|
74
|
+
return normalizedRoutePath === '/' ? [] : normalizedRoutePath.slice(1).split('/');
|
|
75
|
+
}
|
|
76
|
+
function stripSearchAndHash(url) {
|
|
77
|
+
return url.split('#')[0]?.split('?')[0] ?? url;
|
|
78
|
+
}
|
|
79
|
+
function trimTrailingSlash(value) {
|
|
80
|
+
return value.length > 1 ? value.replace(/\/+$/g, '') : value;
|
|
81
|
+
}
|
|
82
|
+
function decodeRouteSegment(value) {
|
|
83
|
+
try {
|
|
84
|
+
return decodeURIComponent(value);
|
|
85
|
+
} catch (error) {
|
|
86
|
+
if (!(error instanceof URIError)) {
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
return value;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=routeMatcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["normalizeRoutePath","routePath","pathname","split","pathWithLeadingSlash","startsWith","normalizedPathname","replace","createPendingHostComponentRoutePrefix","app","scheme","appName","normalizePendingHostComponentAppName","name","host","length","getRoutePathFromUrl","url","routePrefix","normalizedPrefix","trimTrailingSlash","urlWithoutSearch","stripSearchAndHash","slice","getQueryParamsFromUrl","Object","fromEntries","URL","searchParams","entries","error","TypeError","questionMarkIndex","indexOf","fragmentIndex","queryEndIndex","URLSearchParams","matchRoutePath","pattern","patternSegments","splitRoutePath","routeSegments","params","index","patternSegment","routeSegment","paramName","decodeRouteSegment","normalizedRoutePath","value","decodeURIComponent","URIError"],"sourceRoot":"../../../src","sources":["host/routeMatcher.ts"],"mappings":";;AAEA,OAAO,SAASA,kBAAkBA,CAACC,SAAiB,EAAE;EACpD,MAAMC,QAAQ,GAAGD,SAAS,CAACE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAEA,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG;EAC9D,MAAMC,oBAAoB,GAAGF,QAAQ,CAACG,UAAU,CAAC,GAAG,CAAC,GAAGH,QAAQ,GAAG,IAAIA,QAAQ,EAAE;EACjF,MAAMI,kBAAkB,GAAGF,oBAAoB,CAACG,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;EAEpE,OAAOD,kBAAkB,KAAK,GAAG,GAAG,GAAG,GAAGA,kBAAkB,CAACC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;AACnF;AAEA,OAAO,SAASC,qCAAqCA,CAACC,GAAkC,EAAE;EACxF,MAAMC,MAAM,GAAGD,GAAG,CAACC,MAAM,CAACH,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;EAC5C,MAAMI,OAAO,GAAGC,oCAAoC,CAACH,GAAG,CAACI,IAAI,CAAC;EAC9D,MAAMC,IAAI,GAAGL,GAAG,CAACK,IAAI,IAAI,IAAI,GAAG,EAAE,GAAGL,GAAG,CAACK,IAAI,CAACP,OAAO,CAAC,YAAY,EAAE,EAAE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EA,SAASiC,cAAcA,CAACvC,SAAiB,EAAE;EACzC,MAAM+C,mBAAmB,GAAGhD,kBAAkB,CAACC,SAAS,CAAC;EACzD,OAAO+C,mBAAmB,KAAK,GAAG,GAAG,EAAE,GAAGA,mBAAmB,CAACzB,KAAK,CAAC,CAAC,CAAC,CAACpB,KAAK,CAAC,GAAG,CAAC;AACnF;AAEA,SAASmB,kBAAkBA,CAACL,GAAW,EAAE;EACvC,OAAOA,GAAG,CAACd,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAEA,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAIc,GAAG;AAChD;AAEA,SAASG,iBAAiBA,CAAC6B,KAAa,EAAE;EACxC,OAAOA,KAAK,CAAClC,MAAM,GAAG,CAAC,GAAGkC,KAAK,CAAC1C,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG0C,KAAK;AAC9D;AAEA,SAASF,kBAAkBA,CAACE,KAAa,EAAE;EACzC,IAAI;IACF,OAAOC,kBAAkB,CAACD,KAAK,CAAC;EAClC,CAAC,CAAC,OAAOnB,KAAK,EAAE;IACd,IAAI,EAAEA,KAAK,YAAYqB,QAAQ,CAAC,EAAE;MAChC,MAAMrB,KAAK;IACb;IAEA,OAAOmB,KAAK;EACd;AACF","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["host/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export { createMicroFrontendRuntime } from "./createMicroFrontendRuntime.js";
|
|
4
|
+
export { createRoute } from "./createRoute.js";
|
|
5
|
+
export { PendingHostComponent, usePendingHostComponentController, useIsPendingHostComponentHidden, useResolvedPendingHostComponent } from "./host/PendingHostComponent.js";
|
|
6
|
+
export { createPendingHostComponentRoutePrefix, normalizeRoutePath } from "./host/routeMatcher.js";
|
|
7
|
+
export { hidePendingHostComponent, installPendingHostComponentBridge, registerPendingHostComponentRoute, resetPendingHostComponent, resolvePendingHostComponent } from "./host/pendingHostComponentStore.js";
|
|
8
|
+
export { MicroFrontendSessionProvider, MissingMicroFrontendSessionError, useMicroFrontendSession } from "./session/MicroFrontendSessionContext.js";
|
|
9
|
+
export { useMicroFrontendSessions } from "./session/useMicroFrontendSessions.js";
|
|
10
|
+
export { default as Portal } from './specs/PortalViewNativeComponent';
|
|
11
|
+
export { AppContainerNotFoundError, ExposedModuleNotFoundError, InvalidAppNameError, InvalidAppRequestError, InvalidNativeRuntimeEventError } from "./runtime/errors.js";
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createMicroFrontendRuntime","createRoute","PendingHostComponent","usePendingHostComponentController","useIsPendingHostComponentHidden","useResolvedPendingHostComponent","createPendingHostComponentRoutePrefix","normalizeRoutePath","hidePendingHostComponent","installPendingHostComponentBridge","registerPendingHostComponentRoute","resetPendingHostComponent","resolvePendingHostComponent","MicroFrontendSessionProvider","MissingMicroFrontendSessionError","useMicroFrontendSession","useMicroFrontendSessions","default","Portal","AppContainerNotFoundError","ExposedModuleNotFoundError","InvalidAppNameError","InvalidAppRequestError","InvalidNativeRuntimeEventError"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,0BAA0B,QAAQ,iCAA8B;AAEzE,SAASC,WAAW,QAAQ,kBAAe;AAG3C,SACEC,oBAAoB,EACpBC,iCAAiC,EACjCC,+BAA+B,EAC/BC,+BAA+B,QAC1B,gCAA6B;AASpC,SACEC,qCAAqC,EACrCC,kBAAkB,QACb,wBAAqB;AAC5B,SACEC,wBAAwB,EACxBC,iCAAiC,EACjCC,iCAAiC,EACjCC,yBAAyB,EACzBC,2BAA2B,QACtB,qCAAkC;AACzC,SACEC,4BAA4B,EAC5BC,gCAAgC,EAChCC,uBAAuB,QAClB,0CAAuC;AAE9C,SAASC,wBAAwB,QAAQ,uCAAoC;AAE7E,SAASC,OAAO,IAAIC,MAAM,QAAQ,mCAAmC;AAYrE,SACEC,yBAAyB,EACzBC,0BAA0B,EAC1BC,mBAAmB,EACnBC,sBAAsB,EACtBC,8BAA8B,QACzB,qBAAkB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["microFrontend"],"sourceRoot":"../../../src","sources":["plugin/index.ts"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,0BAAuB","ignoreList":[]}
|