From 2622fcc568265038bd5fe55ef1c3d06b3577d27c Mon Sep 17 00:00:00 2001 From: Shrey Jain <“shreyjain5132@email.com> Date: Tue, 21 Jul 2026 12:31:46 +0530 Subject: [PATCH 1/2] Fix plugin directory resolving external plugins to a hardcoded .js entry generateManifest() hardcoded "index.js" as every external plugin's web resolution path in the published directory.json. The stepper plugin's build (wrap.mjs) emits "index.mjs", so the live directory.json has pointed at a 404 since the stepper package was added - silently breaking dynamic loading of the stepper web plugin (frontend's resolveWebPluginUrl gets a URL back, import() 404s, the error is caught and only console.warn'd, so the host plugin never registers its tab and the Stepper side panel is stuck on "Loading the stepper..."). Derive the entry filename from the plugin's own package.json (main/module) instead of assuming an extension. --- lib/build.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/build.ts b/lib/build.ts index 6d31a5e..472e9a8 100644 --- a/lib/build.ts +++ b/lib/build.ts @@ -48,8 +48,14 @@ async function generateManifest() { description: packageJSONFile.description, resolutions: {}, }; + // Use the plugin's own declared entry point rather than assuming ".js": external + // plugins can emit ".mjs" (e.g. the stepper's wrap.mjs produces real ESM for native + // `import()`), and a mismatch here silently 404s for anyone resolving the plugin. + const entryFile = pathlib.basename( + packageJSONFile.main ?? packageJSONFile.module ?? "index.js", + ); pluginDirectory[folderName].resolutions[pluginType] = - "./" + pluginType + "/" + folderName + "/index.js"; + "./" + pluginType + "/" + folderName + "/" + entryFile; } } globalManifest[pluginType] = manifest; From 4fda85a998959740789a26b60cb4ec4b39c48b3b Mon Sep 17 00:00:00 2001 From: Shrey Jain <“shreyjain5132@email.com> Date: Tue, 21 Jul 2026 12:45:53 +0530 Subject: [PATCH 2/2] Guard main/module against non-string types before pathlib.basename package.json is untyped JSON, so a malformed or unusually-shaped main/module field could otherwise throw a TypeError and crash the build. Addresses Gemini Code Assist review feedback on #59. --- lib/build.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/build.ts b/lib/build.ts index 472e9a8..aeeb305 100644 --- a/lib/build.ts +++ b/lib/build.ts @@ -51,9 +51,13 @@ async function generateManifest() { // Use the plugin's own declared entry point rather than assuming ".js": external // plugins can emit ".mjs" (e.g. the stepper's wrap.mjs produces real ESM for native // `import()`), and a mismatch here silently 404s for anyone resolving the plugin. - const entryFile = pathlib.basename( - packageJSONFile.main ?? packageJSONFile.module ?? "index.js", - ); + // package.json is untyped JSON, so guard against main/module being non-string (e.g. an + // object, from a more complex export config) before handing them to pathlib.basename. + const mainEntry = + typeof packageJSONFile.main === "string" ? packageJSONFile.main : undefined; + const moduleEntry = + typeof packageJSONFile.module === "string" ? packageJSONFile.module : undefined; + const entryFile = pathlib.basename(mainEntry ?? moduleEntry ?? "index.js"); pluginDirectory[folderName].resolutions[pluginType] = "./" + pluginType + "/" + folderName + "/" + entryFile; }