diff --git a/package-lock.json b/package-lock.json index 31a3ea9..364ae8e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@knighted/module", - "version": "1.4.0-rc.1", + "version": "1.4.0-rc.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@knighted/module", - "version": "1.4.0-rc.1", + "version": "1.4.0-rc.2", "license": "MIT", "dependencies": { "glob": "^13.0.0", diff --git a/package.json b/package.json index 1b7056e..7e1e942 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@knighted/module", - "version": "1.4.0-rc.1", + "version": "1.4.0-rc.2", "description": "Bidirectional transform for ES modules and CommonJS.", "type": "module", "main": "dist/module.js", diff --git a/src/format.ts b/src/format.ts index 0802f42..976ed98 100644 --- a/src/format.ts +++ b/src/format.ts @@ -348,11 +348,12 @@ const dualPackageHazardDiagnostics = async (params: { const diagFile = origin?.filePath ?? filePath if (hasImport && hasRequire) { - const importSpecs = usage.imports.map(u => - u.subpath ? `${pkg}/${u.subpath}` : pkg, + const uniq = (items: T[]) => [...new Set(items)] + const importSpecs = uniq( + usage.imports.map(u => (u.subpath ? `${pkg}/${u.subpath}` : pkg)), ) - const requireSpecs = usage.requires.map(u => - u.subpath ? `${pkg}/${u.subpath}` : pkg, + const requireSpecs = uniq( + usage.requires.map(u => (u.subpath ? `${pkg}/${u.subpath}` : pkg)), ) diags.push({