@archie/devtools 0.0.9 → 0.0.11
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/README.md +53 -111
- package/dist/chunk-QZ7TP4HQ.mjs +7 -0
- package/dist/client/client.d.mts +41 -2
- package/dist/client/client.d.ts +41 -2
- package/dist/client/client.js +8545 -5
- package/dist/client/client.mjs +8594 -3
- package/dist/index.d.mts +28 -23
- package/dist/index.d.ts +28 -23
- package/dist/index.js +500 -8
- package/dist/index.mjs +490 -8
- package/package.json +22 -20
- package/dist/chunk-6HHNPJXA.mjs +0 -83
- package/dist/chunk-D5EA6RR5.mjs +0 -47
- package/dist/chunk-EQV632XF.mjs +0 -66
- package/dist/client/inject-inspector/auto.d.mts +0 -2
- package/dist/client/inject-inspector/auto.d.ts +0 -2
- package/dist/client/inject-inspector/auto.js +0 -1271
- package/dist/client/inject-inspector/auto.mjs +0 -7
- package/dist/client/inject-inspector/injectInspector.d.mts +0 -38
- package/dist/client/inject-inspector/injectInspector.d.ts +0 -38
- package/dist/client/inject-inspector/injectInspector.js +0 -1290
- package/dist/client/inject-inspector/injectInspector.mjs +0 -7
- package/dist/client/route-listener/routeListener.d.mts +0 -49
- package/dist/client/route-listener/routeListener.d.ts +0 -49
- package/dist/client/route-listener/routeListener.js +0 -90
- package/dist/client/route-listener/routeListener.mjs +0 -6
- package/dist/constants/archieOrigins.d.mts +0 -48
- package/dist/constants/archieOrigins.d.ts +0 -48
- package/dist/constants/archieOrigins.js +0 -77
- package/dist/constants/archieOrigins.mjs +0 -18
- package/dist/inspector-QDRZLXRP.mjs +0 -1139
package/dist/chunk-D5EA6RR5.mjs
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// src/constants/archieOrigins.ts
|
|
2
|
-
var ARCHIE_HOST_ORIGINS = [
|
|
3
|
-
"https://app.dev.archie-platform.com",
|
|
4
|
-
"https://app.staging.archie-platform.com",
|
|
5
|
-
"https://app.archie.com"
|
|
6
|
-
];
|
|
7
|
-
var ARCHIE_PREVIEW_ORIGIN_SUFFIXES = [
|
|
8
|
-
".staging.archie-platform.com",
|
|
9
|
-
".archie-platform.com",
|
|
10
|
-
".archie.com"
|
|
11
|
-
];
|
|
12
|
-
var PREVIEW_DEPLOY_HOST_SUFFIXES = [
|
|
13
|
-
".previews.staging.archie-platform.com",
|
|
14
|
-
".previews.archie-platform.com",
|
|
15
|
-
".previews.archie.com"
|
|
16
|
-
];
|
|
17
|
-
var LOCAL_DEV_ORIGINS = [
|
|
18
|
-
"http://localhost:3000",
|
|
19
|
-
"http://localhost:3001"
|
|
20
|
-
];
|
|
21
|
-
function getAllowedOrigins(includeLocal = false) {
|
|
22
|
-
const list = [...ARCHIE_HOST_ORIGINS];
|
|
23
|
-
if (includeLocal) list.push(...LOCAL_DEV_ORIGINS);
|
|
24
|
-
return list;
|
|
25
|
-
}
|
|
26
|
-
function getAllowedOriginPatterns() {
|
|
27
|
-
return [...ARCHIE_PREVIEW_ORIGIN_SUFFIXES];
|
|
28
|
-
}
|
|
29
|
-
function isPreviewOrigin(origin) {
|
|
30
|
-
if (!origin || typeof origin !== "string") return false;
|
|
31
|
-
try {
|
|
32
|
-
const host = new URL(origin).host;
|
|
33
|
-
return PREVIEW_DEPLOY_HOST_SUFFIXES.some((suffix) => host.endsWith(suffix));
|
|
34
|
-
} catch {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export {
|
|
40
|
-
ARCHIE_HOST_ORIGINS,
|
|
41
|
-
ARCHIE_PREVIEW_ORIGIN_SUFFIXES,
|
|
42
|
-
PREVIEW_DEPLOY_HOST_SUFFIXES,
|
|
43
|
-
LOCAL_DEV_ORIGINS,
|
|
44
|
-
getAllowedOrigins,
|
|
45
|
-
getAllowedOriginPatterns,
|
|
46
|
-
isPreviewOrigin
|
|
47
|
-
};
|
package/dist/chunk-EQV632XF.mjs
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
// src/client/route-listener/routeListener.ts
|
|
2
|
-
function extractAllRoutes(routes, parentPath = "") {
|
|
3
|
-
const result = [];
|
|
4
|
-
for (const route of routes) {
|
|
5
|
-
const path = route.path ? (parentPath + "/" + route.path).replace(/\/+/g, "/") : parentPath || "/";
|
|
6
|
-
if (route.path !== void 0 || route.index) {
|
|
7
|
-
result.push({
|
|
8
|
-
id: route.id,
|
|
9
|
-
path: route.index ? parentPath || "/" : path,
|
|
10
|
-
hasChildren: !!(route.children && route.children.length > 0)
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
if (route.children) {
|
|
14
|
-
result.push(...extractAllRoutes(route.children, path));
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return result;
|
|
18
|
-
}
|
|
19
|
-
function broadcastRouteState(target, state, allRoutes) {
|
|
20
|
-
try {
|
|
21
|
-
const message = {
|
|
22
|
-
type: "ARCHIE_ROUTE_UPDATE",
|
|
23
|
-
payload: {
|
|
24
|
-
path: state.location.pathname,
|
|
25
|
-
search: state.location.search,
|
|
26
|
-
hash: state.location.hash,
|
|
27
|
-
matches: state.matches.map((m) => ({
|
|
28
|
-
id: m.route.id,
|
|
29
|
-
pathname: m.pathname,
|
|
30
|
-
params: m.params
|
|
31
|
-
})),
|
|
32
|
-
allRoutes,
|
|
33
|
-
timestamp: Date.now()
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
target.postMessage(message, "*");
|
|
37
|
-
} catch {
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function setupArchieRouteListener(router) {
|
|
41
|
-
const target = window.parent !== window ? window.parent : window.opener;
|
|
42
|
-
if (!target) {
|
|
43
|
-
return () => {
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
broadcastRouteState(target, router.state, extractAllRoutes(router.routes));
|
|
47
|
-
const unsubscribe = router.subscribe((state) => {
|
|
48
|
-
const currentRoutes = extractAllRoutes(router.routes);
|
|
49
|
-
broadcastRouteState(target, state, currentRoutes);
|
|
50
|
-
});
|
|
51
|
-
const handleMessage = (event) => {
|
|
52
|
-
if (event.data?.type === "ARCHIE_QUERY_ROUTES") {
|
|
53
|
-
const currentRoutes = extractAllRoutes(router.routes);
|
|
54
|
-
broadcastRouteState(target, router.state, currentRoutes);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
window.addEventListener("message", handleMessage);
|
|
58
|
-
return () => {
|
|
59
|
-
unsubscribe();
|
|
60
|
-
window.removeEventListener("message", handleMessage);
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export {
|
|
65
|
-
setupArchieRouteListener
|
|
66
|
-
};
|