@quanta-intellect/vessel-browser 0.1.127 → 0.1.128

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.
@@ -2123,6 +2123,43 @@ function generateStableSelector(el) {
2123
2123
  }
2124
2124
  return uniqueSelector(document2, parts.join(" > ")) || parts.join(" > ");
2125
2125
  }
2126
+ function getEnvFlag(name) {
2127
+ const globalProcess = typeof globalThis === "object" && "process" in globalThis ? globalThis.process : void 0;
2128
+ return globalProcess?.env?.[name];
2129
+ }
2130
+ function isDebugEnabled() {
2131
+ const value = getEnvFlag("VESSEL_DEBUG")?.trim().toLowerCase();
2132
+ return value === "1" || value === "true" || value === "yes" || value === "on";
2133
+ }
2134
+ function writeLog(level, scope, args) {
2135
+ if (level === "debug" && !isDebugEnabled()) {
2136
+ return;
2137
+ }
2138
+ const prefix = `[Vessel ${scope}]`;
2139
+ switch (level) {
2140
+ case "debug":
2141
+ console.debug(prefix, ...args);
2142
+ return;
2143
+ case "info":
2144
+ console.info(prefix, ...args);
2145
+ return;
2146
+ case "warn":
2147
+ console.warn(prefix, ...args);
2148
+ return;
2149
+ case "error":
2150
+ console.error(prefix, ...args);
2151
+ return;
2152
+ }
2153
+ }
2154
+ function createLogger(scope) {
2155
+ return {
2156
+ debug: (...args) => writeLog("debug", scope, args),
2157
+ info: (...args) => writeLog("info", scope, args),
2158
+ warn: (...args) => writeLog("warn", scope, args),
2159
+ error: (...args) => writeLog("error", scope, args)
2160
+ };
2161
+ }
2162
+ const logger = createLogger("ContentScript");
2126
2163
  function looksLikeCorrectOption(value) {
2127
2164
  const text = getTrimmedText(value);
2128
2165
  if (!text) return void 0;
@@ -2140,7 +2177,7 @@ function looksLikeCorrectOption(value) {
2140
2177
  }
2141
2178
  let elementIndex = 0;
2142
2179
  const elementSelectors = {};
2143
- let indexedElements = /* @__PURE__ */ new WeakMap();
2180
+ const indexedElements = /* @__PURE__ */ new WeakMap();
2144
2181
  const indexedElementRefs = {};
2145
2182
  let activeOverlays = [];
2146
2183
  let pageDiffMutationTimer = null;
@@ -3325,7 +3362,7 @@ function vesselExtractContent() {
3325
3362
  const article = reader.parse();
3326
3363
  return extractStructuredContent(article || void 0);
3327
3364
  } catch (error) {
3328
- console.error("Vessel content extraction error:", error);
3365
+ logger.error("Vessel content extraction error:", error);
3329
3366
  return extractStructuredContent();
3330
3367
  }
3331
3368
  }