@archie/devtools 0.0.7 → 0.0.10
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/dist/{chunk-DLRODACA.mjs → chunk-D5EA6RR5.mjs} +8 -1
- package/dist/{chunk-JPNYFFBN.mjs → chunk-REJDPYAO.mjs} +20 -2
- package/dist/client/inject-inspector/auto.js +26 -1158
- package/dist/client/inject-inspector/auto.mjs +3 -3
- package/dist/client/inject-inspector/injectInspector.d.mts +20 -1
- package/dist/client/inject-inspector/injectInspector.d.ts +20 -1
- package/dist/client/inject-inspector/injectInspector.js +27 -1151
- package/dist/client/inject-inspector/injectInspector.mjs +4 -2
- package/dist/constants/archieOrigins.d.mts +14 -5
- package/dist/constants/archieOrigins.d.ts +14 -5
- package/dist/constants/archieOrigins.js +9 -1
- package/dist/constants/archieOrigins.mjs +3 -1
- package/package.json +2 -1
- package/dist/inspector-QDRZLXRP.mjs +0 -1139
|
@@ -5,9 +5,15 @@ var ARCHIE_HOST_ORIGINS = [
|
|
|
5
5
|
"https://app.archie.com"
|
|
6
6
|
];
|
|
7
7
|
var ARCHIE_PREVIEW_ORIGIN_SUFFIXES = [
|
|
8
|
+
".staging.archie-platform.com",
|
|
8
9
|
".archie-platform.com",
|
|
9
10
|
".archie.com"
|
|
10
11
|
];
|
|
12
|
+
var PREVIEW_DEPLOY_HOST_SUFFIXES = [
|
|
13
|
+
".previews.staging.archie-platform.com",
|
|
14
|
+
".previews.archie-platform.com",
|
|
15
|
+
".previews.archie.com"
|
|
16
|
+
];
|
|
11
17
|
var LOCAL_DEV_ORIGINS = [
|
|
12
18
|
"http://localhost:3000",
|
|
13
19
|
"http://localhost:3001"
|
|
@@ -24,7 +30,7 @@ function isPreviewOrigin(origin) {
|
|
|
24
30
|
if (!origin || typeof origin !== "string") return false;
|
|
25
31
|
try {
|
|
26
32
|
const host = new URL(origin).host;
|
|
27
|
-
return
|
|
33
|
+
return PREVIEW_DEPLOY_HOST_SUFFIXES.some((suffix) => host.endsWith(suffix));
|
|
28
34
|
} catch {
|
|
29
35
|
return false;
|
|
30
36
|
}
|
|
@@ -33,6 +39,7 @@ function isPreviewOrigin(origin) {
|
|
|
33
39
|
export {
|
|
34
40
|
ARCHIE_HOST_ORIGINS,
|
|
35
41
|
ARCHIE_PREVIEW_ORIGIN_SUFFIXES,
|
|
42
|
+
PREVIEW_DEPLOY_HOST_SUFFIXES,
|
|
36
43
|
LOCAL_DEV_ORIGINS,
|
|
37
44
|
getAllowedOrigins,
|
|
38
45
|
getAllowedOriginPatterns,
|
|
@@ -2,10 +2,15 @@ import {
|
|
|
2
2
|
getAllowedOriginPatterns,
|
|
3
3
|
getAllowedOrigins,
|
|
4
4
|
isPreviewOrigin
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-D5EA6RR5.mjs";
|
|
6
6
|
|
|
7
7
|
// src/client/inject-inspector/injectInspector.ts
|
|
8
8
|
var DEFAULT_SCRIPT_ID = "archie-inspector-script";
|
|
9
|
+
var REMOTE_INSPECTOR_SCRIPT_URL = "https://pub-bf238c278d9644b39ec34ecaca1d315c.r2.dev/inspector.standalone.js";
|
|
10
|
+
function getInspectorScriptUrl(base, cacheBust = true) {
|
|
11
|
+
const separator = base.includes("?") ? "&" : "?";
|
|
12
|
+
return cacheBust ? `${base}${separator}h=${Date.now()}` : base;
|
|
13
|
+
}
|
|
9
14
|
function isLocalDev(referrer) {
|
|
10
15
|
if (!referrer) return true;
|
|
11
16
|
try {
|
|
@@ -57,7 +62,19 @@ function injectInspector(opts = {}) {
|
|
|
57
62
|
win["__ARCHIE_INSPECTOR_TARGET_ORIGIN__"] = target;
|
|
58
63
|
}
|
|
59
64
|
}
|
|
60
|
-
|
|
65
|
+
const useRemote = opts.scriptSource !== "local";
|
|
66
|
+
if (useRemote) {
|
|
67
|
+
const script = document.createElement("script");
|
|
68
|
+
script.id = id;
|
|
69
|
+
script.src = getInspectorScriptUrl(opts.scriptUrl ?? REMOTE_INSPECTOR_SCRIPT_URL, true);
|
|
70
|
+
document.head.appendChild(script);
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
const localInspectorModulePath = "./inspector.js";
|
|
74
|
+
return import(
|
|
75
|
+
/* @vite-ignore */
|
|
76
|
+
localInspectorModulePath
|
|
77
|
+
).then((m) => {
|
|
61
78
|
try {
|
|
62
79
|
m.default();
|
|
63
80
|
} catch (err) {
|
|
@@ -79,5 +96,6 @@ function injectInspector(opts = {}) {
|
|
|
79
96
|
}
|
|
80
97
|
|
|
81
98
|
export {
|
|
99
|
+
REMOTE_INSPECTOR_SCRIPT_URL,
|
|
82
100
|
injectInspector
|
|
83
101
|
};
|