GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — opencode/packages/plugin/src/source.node.ts at dev · yusha/opencode Expand file tree/ Copy pathsource.node.tsMore file actions 52 lines (50 loc) · 2.01 KB / Copy pathsource.node.tsFile metadata and controls52 lines (50 loc) · 2.01 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 import { registerHooks } from "node:module" import path from "node:path" import { fileURLToPath } from "node:url" import { localSource } from "./source.js" import { missingPackageTarget } from "./source.package.js" import { Host } from "./host.js" let generation = Date.now() export async function prepareSource(entrypoint: string, track: (file: string, directory?: boolean) => void) { const version = String(++generation) const fresh = (specifier: string) => { const url = new URL(specifier) url.searchParams.set("__opencode_reload", version) return url.href } const hook = registerHooks({ resolve(specifier, context, nextResolve) { if (!context.parentURL || new URL(context.parentURL).searchParams.get("__opencode_reload") !== version) return nextResolve(specifier, context) const local = specifier.startsWith("./") || specifier.startsWith("../") ? new URL(specifier, context.parentURL) : localSource(specifier, path.dirname(fileURLToPath(context.parentURL))) if (!local) { try { return nextResolve(specifier, context) } catch (error) { const target = missingPackageTarget(specifier, fileURLToPath(context.parentURL)) if (target) track(target, true) throw error } } if (fileURLToPath(local).split(path.sep).includes("node_modules")) return nextResolve(specifier, context) const resolved = (() => { try { return nextResolve(specifier, context) } catch (error) { track(path.dirname(fileURLToPath(local)), true) throw error } })() if (!resolved.url.startsWith("file:")) return resolved const file = fileURLToPath(resolved.url) if (file.split(path.sep).includes("node_modules")) return resolved track(file) return { ...resolved, url: fresh(resolved.url) } }, }) const specifier = fresh(entrypoint) return { version: specifier, load: () => Host.load(specifier), dispose: () => hook.deregister() } } |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |