@hkdigital/lib-core 0.5.74 → 0.5.75

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hkdigital/lib-core",
3
- "version": "0.5.74",
3
+ "version": "0.5.75",
4
4
  "author": {
5
5
  "name": "HKdigital",
6
6
  "url": "https://hkdigital.nl"
@@ -550,6 +550,34 @@ async function validateFile(filePath) {
550
550
  }
551
551
  }
552
552
 
553
+ // Check if alias import is missing file extension
554
+ // Allow any extension (not just .js/.svelte) to support assets
555
+ const hasExtension = importPath.match(/\.[^/]+$/);
556
+
557
+ if (!hasExtension) {
558
+ // Extract path after alias to check if it's not just the alias
559
+ let pathAfterAlias = null;
560
+ for (const alias of Object.keys(PROJECT_ALIASES)) {
561
+ if (importPath === alias || importPath.startsWith(alias + '/')) {
562
+ pathAfterAlias = importPath.slice(alias.length);
563
+ if (pathAfterAlias.startsWith('/')) {
564
+ pathAfterAlias = pathAfterAlias.slice(1);
565
+ }
566
+ break;
567
+ }
568
+ }
569
+
570
+ // Only error if there's a path after the alias
571
+ if (pathAfterAlias && pathAfterAlias.length > 0) {
572
+ errors.push(
573
+ `${relativePath}:${lineNum}\n` +
574
+ ` from '${importPath}'\n` +
575
+ ` => Missing file extension (add .js, .svelte, ` +
576
+ `or .svelte.js)`
577
+ );
578
+ }
579
+ }
580
+
553
581
  // Skip further validation for alias imports
554
582
  continue;
555
583
  }
@@ -585,6 +613,27 @@ async function validateFile(filePath) {
585
613
  break; // Only report once per line
586
614
  }
587
615
  }
616
+
617
+ // Check if external import is missing file extension
618
+ // Allow any extension (not just .js/.svelte) to support assets
619
+ const hasExtension = importPath.match(/\.[^/]+$/);
620
+
621
+ if (!hasExtension) {
622
+ // Extract package name and check if there's a path
623
+ const pkgName = importPath.startsWith('@') ?
624
+ `${parts[0]}/${parts[1]}` : parts[0];
625
+ const pathInPackage = importPath.slice(pkgName.length);
626
+
627
+ // Only error if there's a path in the package (not just pkg name)
628
+ if (pathInPackage && pathInPackage.length > 1) {
629
+ errors.push(
630
+ `${relativePath}:${lineNum}\n` +
631
+ ` from '${importPath}'\n` +
632
+ ` => Missing file extension (add .js, .svelte, ` +
633
+ `or .svelte.js)`
634
+ );
635
+ }
636
+ }
588
637
  }
589
638
 
590
639
  // Skip further validation for external packages