From 588dd67a09869c1c62545ef85a98c25bf8e391fa Mon Sep 17 00:00:00 2001 From: Nikhil Saraf Date: Tue, 26 Dec 2023 15:56:07 +0530 Subject: [PATCH] doc --- packages/vinxi-doc/doc.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/vinxi-doc/doc.js b/packages/vinxi-doc/doc.js index 110a75b4..d7df2879 100644 --- a/packages/vinxi-doc/doc.js +++ b/packages/vinxi-doc/doc.js @@ -3,6 +3,11 @@ import { createRequire } from "node:module"; import path from "node:path"; import { fileURLToPath, pathToFileURL } from "node:url"; +/** + * + * @param {string} src + * @returns {Promise} + */ export async function doc(src) { const require = createRequire(import.meta.url); const mod = require("@vinxi/deno-doc"); @@ -66,6 +71,12 @@ export async function doc(src) { function resolvePackage(specifier, referrer) { try { + // console.log("resolvePackage", specifier, referrer); + + if (specifier.startsWith("node:")) { + return new URL("./empty.d.ts", import.meta.url).toString(); + } + const resolved = resolve.sync(specifier, { preserveSymlinks: false, basedir: path.dirname(new URL(referrer).pathname), @@ -80,7 +91,7 @@ export async function doc(src) { return "file://" + resolved; } catch (e) { console.error(e); - return null; + return new URL("./empty.d.ts", import.meta.url).toString(); } }