From 485c5e5d246235238fb5194a43d6f98c04f7c2b9 Mon Sep 17 00:00:00 2001 From: Alexander O'Mara Date: Sun, 15 Dec 2024 15:34:08 -0500 Subject: [PATCH] Improved npm build script --- scripts/npm.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/npm.ts b/scripts/npm.ts index 049d4ab..999509a 100644 --- a/scripts/npm.ts +++ b/scripts/npm.ts @@ -20,7 +20,7 @@ const keywords = readme.map((s) => s.match(/^\!\[(.*)\]\((.*)\)$/)) const entryPoints = []; let types: string | undefined; -const typed: { [s: string]: string[] } = {}; +let typed: { [s: string]: string[] } | null = null; for (const [name, path] of Object.entries(denoJson.exports)) { const d = path.replace(/^(\.\/)?(.*)(\.[^.]+)$/i, './esm/$2.d$3'); if (name === '.') { @@ -28,7 +28,7 @@ for (const [name, path] of Object.entries(denoJson.exports)) { types = d; } else { entryPoints.push({ name, path }); - typed[name.replace(/^\.\//, '')] = [d]; + (typed ??= {})[name.replace(/^\.\//, '')] = [d]; } }