From 2939dc9024510a1d99a55c04068f687a1748cf29 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Thu, 15 Feb 2024 14:57:32 -0700 Subject: [PATCH] warn if resource in setupModules of jetty block cannot be resolved --- lib/jetty-block.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/jetty-block.js b/lib/jetty-block.js index 5e35cf9..379d389 100644 --- a/lib/jetty-block.js +++ b/lib/jetty-block.js @@ -41,9 +41,12 @@ function createExtensionGroup (context) { const jettyModulesDir = ospath.join(jettyBase, 'modules') fs.mkdirSync(jettyModulesDir, { recursive: true }) setupModules - .map((ref) => contentCatalog.resolveResource(ref.trim(), inSrc)) - .forEach((jettyModuleFile) => { - if (!jettyModuleFile) return + .map((ref) => [contentCatalog.resolveResource(ref, inSrc), ref]) + .filter(([resolved, ref]) => { + if (resolved) return true + log(doc, 'error', `resource in setupModules of jetty block could not be resolved: ${ref}`, cursor) + }) + .forEach(([jettyModuleFile]) => { const jettyModulePath = ospath.join(jettyModulesDir, jettyModuleFile.src.basename) fs.writeFileSync(jettyModulePath, jettyModuleFile.contents, 'utf-8') })