@knighted/module 1.4.0-rc.1 → 1.4.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -232,8 +232,9 @@ const dualPackageHazardDiagnostics = async params => {
232
232
  const origin = usage.imports[0] ?? usage.requires[0];
233
233
  const diagFile = origin?.filePath ?? filePath;
234
234
  if (hasImport && hasRequire) {
235
- const importSpecs = usage.imports.map(u => u.subpath ? `${pkg}/${u.subpath}` : pkg);
236
- const requireSpecs = usage.requires.map(u => u.subpath ? `${pkg}/${u.subpath}` : pkg);
235
+ const uniq = items => [...new Set(items)];
236
+ const importSpecs = uniq(usage.imports.map(u => u.subpath ? `${pkg}/${u.subpath}` : pkg));
237
+ const requireSpecs = uniq(usage.requires.map(u => u.subpath ? `${pkg}/${u.subpath}` : pkg));
237
238
  diags.push({
238
239
  level: hazardLevel,
239
240
  code: 'dual-package-mixed-specifiers',
package/dist/format.js CHANGED
@@ -224,8 +224,9 @@ const dualPackageHazardDiagnostics = async params => {
224
224
  const origin = usage.imports[0] ?? usage.requires[0];
225
225
  const diagFile = origin?.filePath ?? filePath;
226
226
  if (hasImport && hasRequire) {
227
- const importSpecs = usage.imports.map(u => u.subpath ? `${pkg}/${u.subpath}` : pkg);
228
- const requireSpecs = usage.requires.map(u => u.subpath ? `${pkg}/${u.subpath}` : pkg);
227
+ const uniq = items => [...new Set(items)];
228
+ const importSpecs = uniq(usage.imports.map(u => u.subpath ? `${pkg}/${u.subpath}` : pkg));
229
+ const requireSpecs = uniq(usage.requires.map(u => u.subpath ? `${pkg}/${u.subpath}` : pkg));
229
230
  diags.push({
230
231
  level: hazardLevel,
231
232
  code: 'dual-package-mixed-specifiers',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knighted/module",
3
- "version": "1.4.0-rc.1",
3
+ "version": "1.4.0-rc.2",
4
4
  "description": "Bidirectional transform for ES modules and CommonJS.",
5
5
  "type": "module",
6
6
  "main": "dist/module.js",