diff --git a/packages/pluggable-widgets-tools/CHANGELOG.md b/packages/pluggable-widgets-tools/CHANGELOG.md index b84531e2..2a6848ca 100644 --- a/packages/pluggable-widgets-tools/CHANGELOG.md +++ b/packages/pluggable-widgets-tools/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +### Changed + +- We now enforce the same validation for the `widgetName` in the widget bundler as we do in the generator. + ## [11.3.0] - 2025-11-12 ### Changed diff --git a/packages/pluggable-widgets-tools/configs/shared.mjs b/packages/pluggable-widgets-tools/configs/shared.mjs index 80098b07..e689ea95 100644 --- a/packages/pluggable-widgets-tools/configs/shared.mjs +++ b/packages/pluggable-widgets-tools/configs/shared.mjs @@ -24,6 +24,13 @@ export const widgetVersion = widgetPackageJson.version; if (!widgetName || !widgetPackageJson) { throw new Error("Widget does not define widgetName in its package.json"); } +if (!/^[a-zA-Z]+$/.test(widgetName)) { + const illegalChars = (widgetName.match(/[^a-zA-Z]/g) ?? []) + .reduce((unique, c) => unique.includes(c) ? unique : [...unique, c], []) + .map(c => `"${c}"`) + .join(", "); + throw new Error(`Widget contains unexpected character ${illegalChars} in its widgetName in package.json. Only lowercase and uppercase letters ([a-zA-Z]) are allowed.`); +} const widgetSrcFiles = readdirSync(join(sourcePath, "src")).map(file => join(sourcePath, "src", file)); export const widgetEntry = widgetSrcFiles.filter(file => diff --git a/packages/pluggable-widgets-tools/package.json b/packages/pluggable-widgets-tools/package.json index 40efb0cf..6cab7627 100644 --- a/packages/pluggable-widgets-tools/package.json +++ b/packages/pluggable-widgets-tools/package.json @@ -1,6 +1,6 @@ { "name": "@mendix/pluggable-widgets-tools", - "version": "11.3.0", + "version": "11.3.1", "description": "Mendix Pluggable Widgets Tools", "engines": { "node": ">=20"