@hkdigital/lib-core 0.5.78 → 0.5.80

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/README.md CHANGED
@@ -309,7 +309,6 @@ The validator automatically reads path aliases from your
309
309
  `svelte.config.js` and applies the same barrel export validation rules
310
310
  to alias imports. This ensures consistent import patterns across:
311
311
  - Internal `$lib/` imports
312
- - Project aliases like `$hklib-core`, `$hklib-pro`, etc.
313
312
  - External `@hkdigital/*` package imports
314
313
 
315
314
  **Validation rules (enforced for `src/lib/` files only):**
@@ -344,14 +343,6 @@ import Button from '$lib/ui/primitives/buttons/Button.svelte';
344
343
  import { ProfileBlocks } from '$lib/ui/components.js';
345
344
  import { Button } from '$lib/ui/primitives.js';
346
345
 
347
- // Project aliases - instead of deep imports:
348
- import { Logger } from '$hklib-core/logging/logger/Logger.js';
349
- import { HttpClient } from '$hklib-core/network/http/HttpClient.js';
350
-
351
- // Use barrel exports:
352
- import { Logger } from '$hklib-core/logging.js';
353
- import { HttpClient } from '$hklib-core/network/http.js';
354
-
355
346
  // External imports - instead of deep imports:
356
347
  import { TextButton } from '@hkdigital/lib-core/ui/primitives/buttons/index.js';
357
348
  import { TextInput } from '@hkdigital/lib-core/ui/primitives/inputs/index.js';
@@ -380,7 +371,6 @@ Validating import paths...
380
371
  Found project aliases:
381
372
  $src → src
382
373
  $examples → src/routes/examples
383
- $hklib-core → src/lib
384
374
 
385
375
  src/lib/ui/panels/Panel.svelte:3
386
376
  from '$src/lib/ui/components.js'
@@ -394,10 +384,6 @@ src/lib/ui/pages/Profile.svelte:8
394
384
  from '$lib/ui/components/profile-blocks/ProfileBlocks.svelte'
395
385
  => from '$lib/ui/components.js' (use barrel export for shorter imports)
396
386
 
397
- src/lib/forms/LoginForm.svelte:4
398
- from '$hklib-core/logging/logger/Logger.js'
399
- => from '$hklib-core/logging.js' (use barrel export)
400
-
401
387
  src/lib/forms/LoginForm.svelte:6
402
388
  from '@hkdigital/lib-core/ui/primitives/buttons/index.js'
403
389
  => from '@hkdigital/lib-core/ui/primitives.js' (use barrel export)
@@ -409,8 +395,8 @@ src/routes/explorer/[...path]/+page.svelte:4
409
395
 
410
396
  **What gets checked for barrel export suggestions:**
411
397
 
412
- The validator only suggests barrel exports (for `$lib/`, project aliases,
413
- and external `@hkdigital/*` packages) for:
398
+ The validator only suggests barrel exports (for `$lib/` and external
399
+ `@hkdigital/*` packages) for:
414
400
  - Explicit `index.js` imports
415
401
  - Component files (`.svelte`)
416
402
  - Class files (capitalized `.js` files)
@@ -418,20 +404,6 @@ and external `@hkdigital/*` packages) for:
418
404
  Intentional imports like `helpers.js`, `config.js`, or other lowercase
419
405
  utility files are assumed to be the public API and won't be flagged.
420
406
 
421
- **Alias configuration:**
422
-
423
- The validator automatically detects aliases in your `svelte.config.js`.
424
- For example, if your config has:
425
- ```js
426
- alias: {
427
- $src: 'src',
428
- $hklib-core: 'node_modules/@hkdigital/lib-core/dist'
429
- }
430
- ```
431
-
432
- The validator will apply the same barrel export rules to these aliases
433
- as it does to `$lib/` and `@hkdigital/*` imports.
434
-
435
407
  ### Import Patterns and Export Structure
436
408
 
437
409
  **Public exports use domain-specific files matching folder names:**
@@ -87,8 +87,8 @@ const STROKE_WIDTH_SIZES = {
87
87
  *
88
88
  * @example Usage with generateTailwindThemeExtensions
89
89
  * ```javascript
90
- * import { generateTailwindThemeExtensions } from '@hkdigital/lib-core/design/index.js';
91
- * import { designTokens } from '@hkdigital/lib-core/design/config/design-tokens.js';
90
+ * import { generateTailwindThemeExtensions } from '../index.js';
91
+ * import { designTokens } from './design-tokens.js';
92
92
  *
93
93
  * const themeExtensions = generateTailwindThemeExtensions(designTokens);
94
94
  * ```
@@ -27,8 +27,8 @@
27
27
  * // ... other exports
28
28
  *
29
29
  * // your-project/tailwind.config.js
30
- * import { generateTailwindThemeExtensions } from '@hkdigital/lib-core/design/index.js';
31
- * import { customUtilitiesPlugin } from '@hkdigital/lib-core/design/index.js';
30
+ * import { generateTailwindThemeExtensions } from '../index.js';
31
+ * import { customUtilitiesPlugin } from '../index.js';
32
32
  * import * as designConfig from './src/lib/design/design-config.js';
33
33
  *
34
34
  * export default {
@@ -27,8 +27,8 @@
27
27
  * // ... other exports
28
28
  *
29
29
  * // your-project/tailwind.config.js
30
- * import { generateTailwindThemeExtensions } from '@hkdigital/lib-core/design/index.js';
31
- * import { customUtilitiesPlugin } from '@hkdigital/lib-core/design/index.js';
30
+ * import { generateTailwindThemeExtensions } from '../index.js';
31
+ * import { customUtilitiesPlugin } from '../index.js';
32
32
  * import * as designConfig from './src/lib/design/design-config.js';
33
33
  *
34
34
  * export default {
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * @example Basic usage with default tokens
9
9
  * ```javascript
10
- * import { generateTailwindThemeExtensions, designTokens, customUtilitiesPlugin } from '@hkdigital/lib-core/design/index.js';
10
+ * import { generateTailwindThemeExtensions, designTokens, customUtilitiesPlugin } from './index.js';
11
11
  *
12
12
  * const themeExtensions = generateTailwindThemeExtensions(designTokens);
13
13
  *
@@ -21,7 +21,7 @@
21
21
  *
22
22
  * @example Custom design tokens
23
23
  * ```javascript
24
- * import { generateTailwindThemeExtensions } from '@hkdigital/lib-core/design/index.js';
24
+ * import { generateTailwindThemeExtensions } from './index.js';
25
25
  *
26
26
  * const myTokens = {
27
27
  * TEXT_POINT_SIZES: [4, 8, 12, 16, 24],
@@ -25,7 +25,7 @@
25
25
  * @example
26
26
  * // +layout.svelte
27
27
  * <script>
28
- * import { designTokens, designTokensToRootCssVars } from '@hkdigital/lib-core/design/index.js';
28
+ * import { designTokens, designTokensToRootCssVars } from '../index.js';
29
29
  * </script>
30
30
  *
31
31
  * <svelte:head>
@@ -114,7 +114,7 @@ function setRootCssVar(varName, value) {
114
114
  * @example
115
115
  * // +layout.svelte
116
116
  * <script>
117
- * import { designTokens, designTokensToRootCssVars } from '@hkdigital/lib-core/design/index.js';
117
+ * import { designTokens, designTokensToRootCssVars } from '../index.js';
118
118
  * </script>
119
119
  *
120
120
  * <svelte:head>
@@ -188,7 +188,7 @@ When integrating with a service management system, you can set up global
188
188
  error handling and forward service logs to the main logger:
189
189
 
190
190
  ```javascript
191
- import { ServiceManager } from '$hklib-core/services/index.js';
191
+ import { ServiceManager } from '@hkdigital/lib-core/services/index.js';
192
192
  import { initClientLogger } from '$lib/logging/client.js';
193
193
 
194
194
  /** @type {ServiceManager} */
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * @example
10
10
  * // Basic usage
11
- * import { Logger, LOG, INFO, DEBUG } from '@hkdigital/lib-core/logger/index.js';
11
+ * import { Logger, LOG, INFO, DEBUG } from '../../../logger/index.js';
12
12
  *
13
13
  * const logger = new Logger('myService', INFO);
14
14
  *
@@ -163,7 +163,7 @@ Manages multiple services with dependency resolution and coordinated lifecycle o
163
163
  ### Usage
164
164
 
165
165
  ```javascript
166
- import { ServiceManager } from '$hklib-core/services/index.js';
166
+ import { ServiceManager } from '@hkdigital/lib-core/services/index.js';
167
167
 
168
168
  import DatabaseService from './services/DatabaseService.js';
169
169
  import AuthService from './services/AuthService.js';
@@ -211,7 +211,7 @@ class AuthService extends ServiceBase {
211
211
  /** @type {(<T>(serviceName: string) => T)} */
212
212
  #getService;
213
213
 
214
- /** @type {() => import('$hklib-core/services/index.js').ServiceManager} */
214
+ /** @type {() => import('@hkdigital/lib-core/services/index.js').ServiceManager} */
215
215
  #getManager;
216
216
 
217
217
  constructor(serviceName, options) {
@@ -257,7 +257,7 @@ export default class PlayerService extends ServiceBase {
257
257
 
258
258
  /**
259
259
  * @param {string} serviceName
260
- * @param {import('$hklib-core/services/typedef.js').ServiceOptions} [options]
260
+ * @param {import('@hkdigital/lib-core/services/typedef.js').ServiceOptions} [options]
261
261
  */
262
262
  constructor(serviceName, options) {
263
263
  super(serviceName, options);
@@ -7,7 +7,7 @@
7
7
  } from './gamebox.util.js';
8
8
 
9
9
  import { enableContainerScaling } from '../../../../design/index.js';
10
- // import { enableContainerScaling } from '@hkdigital/lib-core/design/index.js';
10
+ // import { enableContainerScaling } from '../../../../design/index.js';
11
11
 
12
12
  /**
13
13
  * @typedef {{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hkdigital/lib-core",
3
- "version": "0.5.78",
3
+ "version": "0.5.80",
4
4
  "author": {
5
5
  "name": "HKdigital",
6
6
  "url": "https://hkdigital.nl"
@@ -86,36 +86,35 @@ function detectUnsafeAliases() {
86
86
  const resolvedPath = isAbsolute(target) ?
87
87
  target : join(PROJECT_ROOT, target);
88
88
 
89
- // Normalize both paths for comparison (resolve symlinks, etc.)
90
- const normalizedResolved = resolve(resolvedPath);
91
- const normalizedRoot = resolve(PROJECT_ROOT);
92
-
93
- // Check if resolved path is inside the project folder
94
- const isInsideProject = normalizedResolved.startsWith(normalizedRoot);
95
-
96
- if (!isInsideProject) {
97
- // Path is outside project - check if it's in node_modules
98
- if (resolvedPath.includes('/node_modules/')) {
99
- const packageName = extractPackageNameFromPath(resolvedPath);
100
- if (packageName) {
101
- suggestion = packageName;
102
- }
103
- } else {
104
- // Outside project but not node_modules
105
- suggestion = '(path outside project - use direct imports)';
89
+ // Check if path points to node_modules (breaks in libraries)
90
+ if (resolvedPath.includes('/node_modules/')) {
91
+ const packageName = extractPackageNameFromPath(resolvedPath);
92
+ if (packageName) {
93
+ suggestion = packageName;
106
94
  }
95
+ } else {
96
+ // Not node_modules - check if it's outside the project
97
+ const normalizedResolved = resolve(resolvedPath);
98
+ const normalizedRoot = resolve(PROJECT_ROOT);
107
99
 
108
- if (suggestion) {
109
- UNSAFE_ALIASES.set(alias, suggestion);
100
+ const isInsideProject = normalizedResolved.startsWith(normalizedRoot);
101
+
102
+ if (!isInsideProject) {
103
+ // Outside project and not node_modules
104
+ suggestion = '(path outside project - use direct imports)';
110
105
  }
111
106
  }
107
+
108
+ if (suggestion) {
109
+ UNSAFE_ALIASES.set(alias, suggestion);
110
+ }
112
111
  }
113
112
  }
114
113
 
115
114
  /**
116
115
  * Resolve an alias path to its filesystem location
117
116
  *
118
- * @param {string} aliasPath - Import path using alias (e.g., $hklib-core/...)
117
+ * @param {string} aliasPath - Import path using alias (e.g., $examples/...)
119
118
  *
120
119
  * @returns {string|null} Resolved filesystem path or null
121
120
  */
@@ -444,9 +443,9 @@ async function findExternalBarrelExport(importPath, targetName) {
444
443
  /**
445
444
  * Find highest-level barrel export in alias path
446
445
  *
447
- * For $hklib-core/ui/primitives/buttons/index.js:
448
- * - Check $hklib-core/ui/primitives.js
449
- * - Check $hklib-core/ui.js
446
+ * For $components/ui/primitives/buttons/index.js:
447
+ * - Check $components/ui/primitives.js
448
+ * - Check $components/ui.js
450
449
  *
451
450
  * @param {string} importPath - Alias import path
452
451
  * @param {string} targetName - Name of export to find