@archie/devtools 0.0.9 → 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.
@@ -6,6 +6,11 @@ import {
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
- return import("./inspector-QDRZLXRP.mjs").then((m) => {
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
  };