Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Java/Openclaw/src/infra/   (Openclaw AI Version 22©)  Datei vom 26.3.2026 mit Größe 8 kB image not shown  

Quelle  import-url.ts

  Sprache: JAVA
 

/**
 * Build an import URL for a hook handler module.
 *
 * Bundled hooks (shipped in dist/) are immutable between installs, so they
 * can be imported without a cache-busting suffix  letting V8 reuse its
 * module cache across gateway restarts.
 *
 * Workspace, managed, and plugin hooks may be edited by the user between
 * restarts. For those we append `?t=<mtime>&s=<size>` so the module key
 * reflects on-disk changes while staying stable for unchanged files.
 */


import fs from "node:fs";
import { pathToFileURL } from "node:url";
import type { HookSource } from "./types.js";

/**
 * Sources whose handler files never change between `npm install` runs.
 * Imports from these sources skip cache busting entirely.
 */

const IMMUTABLE_SOURCES: ReadonlySet<HookSource> = new Set(["openclaw-bundled"]);

export function buildImportUrl(handlerPath: string, source: HookSource): string {
  const base = pathToFileURL(handlerPath).href;

  if (IMMUTABLE_SOURCES.has(source)) {
    return base;
  }

  // Use file metadata so the cache key only changes when the file changes
  try {
    const { mtimeMs, size } = fs.statSync(handlerPath);
    return `${base}?t=${mtimeMs}&s=${size}`;
  } catch {
    // If stat fails (unlikely), fall back to Date.now() to guarantee freshness
    return `${base}?t=${Date.now()}`;
  }
}

Messung V0.5 in Prozent
C=98 H=98 G=97

¤ Dauer der Verarbeitung: 0.14 Sekunden  (vorverarbeitet am  2026-06-10) ¤

*© Formatika GbR, Deutschland






Versionsinformation zu Columbo

Bemerkung:

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Anfrage:

Dauer der Verarbeitung:

Sekunden

sprechenden Kalenders