@arcote.tech/platform 0.7.28 → 0.7.29
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/package.json +5 -5
- package/src/index.ts +1 -0
- package/src/registry.ts +21 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcote.tech/platform",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.29",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Przemysław Krasiński [arcote.tech]",
|
|
7
7
|
"description": "Arc Platform — module system, router, layout, theme, i18n, platform app shell",
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"type-check": "tsc --noEmit"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@arcote.tech/arc-ds": "^0.7.
|
|
18
|
-
"@arcote.tech/arc-react": "^0.7.
|
|
17
|
+
"@arcote.tech/arc-ds": "^0.7.29",
|
|
18
|
+
"@arcote.tech/arc-react": "^0.7.29"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@arcote.tech/arc": "^0.7.
|
|
22
|
-
"@arcote.tech/arc-otel": "^0.7.
|
|
21
|
+
"@arcote.tech/arc": "^0.7.29",
|
|
22
|
+
"@arcote.tech/arc-otel": "^0.7.29",
|
|
23
23
|
"@lingui/core": "^5.0.0",
|
|
24
24
|
"@lingui/react": "^5.0.0",
|
|
25
25
|
"framer-motion": "^12.0.0",
|
package/src/index.ts
CHANGED
package/src/registry.ts
CHANGED
|
@@ -59,6 +59,27 @@ export function unregisterModule(moduleId: string): void {
|
|
|
59
59
|
notify();
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Czy ścieżka należy do strony zadeklarowanej w `.public({...})` któregokolwiek
|
|
64
|
+
* zarejestrowanego modułu. Źródłem prawdy jest rejestr — wrappery ochronne
|
|
65
|
+
* (np. ProtectedRoute aplikacji) NIE muszą hardcodować listy publicznych
|
|
66
|
+
* ścieżek. Dopasowanie: dokładne lub prefiks segmentowy
|
|
67
|
+
* (`/checkout` pokrywa `/checkout/success`); query/hash ignorowane.
|
|
68
|
+
*/
|
|
69
|
+
export function isPublicPagePath(path: string): boolean {
|
|
70
|
+
const clean = path.split("?")[0].split("#")[0] || "/";
|
|
71
|
+
for (const mod of modules.values()) {
|
|
72
|
+
for (const fragment of mod.publicFragments ?? []) {
|
|
73
|
+
if (!fragment?.is?.("page")) continue;
|
|
74
|
+
const pagePath = (fragment as PageFragment).path;
|
|
75
|
+
if (!pagePath) continue;
|
|
76
|
+
if (clean === pagePath) return true;
|
|
77
|
+
if (pagePath !== "/" && clean.startsWith(`${pagePath}/`)) return true;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
|
|
62
83
|
export function getModule(moduleId: string): ArcModule | undefined {
|
|
63
84
|
return modules.get(moduleId);
|
|
64
85
|
}
|