@vlynk-studios/nodulus-core 1.1.0 → 1.2.5

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/CHANGELOG.md CHANGED
@@ -5,6 +5,40 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.2.5] - 2026-04-11
9
+
10
+ ### Added
11
+ - **Configurable NITS Registry**: The NITS registry path is now configurable via `nits.registryPath` in `nodulus.config.ts` (defaults to `.nodulus/registry.json`).
12
+ - **Internal Compatibility Layer**: Prepared core structures for upcoming v1.3.0 and v2.0.0 features (Domains, Shared Layouts, and Submodules).
13
+ - **Public Registration Types**: Exported `ModuleRegistration` and `FeatureRegistration` types for enhanced framework integrations and tooling.
14
+ - **NITS Identity Tracking**: Nodulus 1.2.5+ includes the **NITS (Nodulus Integrated Tracking System)**, which assigns a stable, unique ID to every module.
15
+
16
+ ### Changed
17
+ - **Encapsulated Public API**: Refactored `src/index.ts` to use explicit named exports, hiding internal registry logic and internal types from the public surface.
18
+ - **Express v5 Alignment**: Updated `peerDependencies` to require `express >= 5.0.0`, enforcing compatibility with the project's native Express 5 types.
19
+ - **ESM Hook Cleanup**: Removed legacy `__filename` checks in the alias resolver, optimizing for a pure ESM environment.
20
+ - **CI/CD Stability**: Updated root `package.json` scripts (`build`, `test`, `typecheck`) with `--if-present` to prevent build failures when some workspaces lack these scripts.
21
+ - **CLI Robustness**: Centralized CLI error handling in `cli/index.ts`, removing direct `process.exit()` calls to improve testability and reliability.
22
+ - **Type Safety**: Eliminated `any` types in `ast-parser.ts` and `resolver.ts`, transitioning to strict `estree` and `node` types.
23
+ - **Async I/O Migration**: Refactored `sync-tsconfig` and identifier parsers to use asynchronous file operations for non-blocking execution.
24
+ - **ESM Hook Stability**: Implemented a singleton promise pattern in the ESM alias resolver to prevent race conditions during concurrent activations.
25
+
26
+ ### Fixed
27
+ - **Phantom Types Elimination**: Removed the legacy `types/` directory and corrected `tsconfig.json` to prevent re-generation of invalid type definitions.
28
+ - **Alias Resolution Consistency**: Resolved a major discrepancy where `@modules/*` aliases resolved differently in runtime vs `tsconfig.json`. Now both use consistent dual-mapping (index file + directory wildcard).
29
+ - **Custom Alias Precision**: Fixed a bug where wildcard suffixes (`/*`) were incorrectly forced on aliases pointing to single files instead of directories.
30
+ - **Unimplemented Feature Warnings**: Added helpful warnings when detected configuration keys (`domains`, `shared`) that are not yet natively supported in the v1.x branch.
31
+ - **CLI Precision**: Fixed a bug in the global error handler where exit code `0` was shadowed by `1`.
32
+ - **Parsing Resilience**: Resolved a syntax error in the `check` command that caused failures during bulk analysis.
33
+ - **Isolated Alias Logic**: Extracted tsconfig path generation into a pure utility function.
34
+
35
+ ## [1.2.0] - 2026-04-09
36
+
37
+ ### Added
38
+ - **CLI Command `check`**: Added static code analysis to enforce boundaries via fast AST parsing (`acorn`). Uncovers architectural violations before loading.
39
+ - **Rule Detection Mechanisms**: Captures circular dependencies, deep private imports, and undeclared external imports between modules.
40
+ - **CI/CD Integration Tools**: `--strict` mode forcing process exits on rule breakage and `--format json` payload schema reports.
41
+
8
42
  ## [1.1.0] - 2026-04-08
9
43
 
10
44
  ### Changed
package/README.md CHANGED
@@ -104,6 +104,8 @@ createApp(app: Application, options?: CreateAppOptions): Promise<NodulusApp>
104
104
  | Option | Type | Default | Description |
105
105
  |---|---|---|---|
106
106
  | `modules` | `string` | `'src/modules/*'` | Glob pointing to module folders |
107
+ | `domains` | `string` | `undefined` | Glob pointing to domain folders (v2.0.0+) |
108
+ | `shared` | `string` | `undefined` | Glob pointing to shared global folders (v2.0.0+) |
107
109
  | `prefix` | `string` | `''` | Global route prefix (e.g. `'/api/v1'`) |
108
110
  | `aliases` | `Record<string, string>` | `{}` | Folder aliases beyond the auto-generated `@modules/*` |
109
111
  | `strict` | `boolean` | `true` in dev | Enables circular-dependency detection and undeclared-import errors |
@@ -299,6 +301,9 @@ const config: NodulusConfig = {
299
301
  '@middleware': './src/middleware',
300
302
  '@shared': './src/shared',
301
303
  },
304
+ nits: {
305
+ registryPath: './.nodulus/registry.json'
306
+ }
302
307
  }
303
308
 
304
309
  export default config
@@ -356,6 +361,51 @@ Added paths:
356
361
 
357
362
  Run this command initially, and whenever you create, rename, or drop modules in the project. It behaves idempotently and automatically purges references to modules that were deleted.
358
363
 
364
+ ### `nodulus check`
365
+
366
+ Performs static code architecture analysis by inspecting raw Abstract Syntax Trees (AST) across your module structures without mutating or evaluating your application code.
367
+
368
+ ```bash
369
+ npx nodulus check
370
+ ```
371
+
372
+ ```text
373
+ Nodulus Architecture Analysis
374
+
375
+ ✔ orders — OK
376
+ ✗ payments — 2 problem(s)
377
+ WARN Private import detected: module "payments" directly imports internal path from "@modules/users/users.repository.js". (payments.service.ts:3)
378
+ Suggestion: Import only the public index: "@modules/users".
379
+ ✔ users — OK
380
+
381
+ 2 problem(s) found.
382
+ ```
383
+
384
+ | Option | Description |
385
+ |------------------------|------------------------------------------------------------------------------------------|
386
+ | `--strict` | Gracefully halts pipelines (`exit 1`) if architectural violations are mapped. Ideal for CI/CD gates. |
387
+ | `--module <name>` | Narrow the analysis exclusively to a specific module scope within your system. |
388
+ | `--format <json,text>` | Exposes structural violations as digestible JSON payloads for external pipelines. |
389
+ | `--no-circular` | Disables heavy Depth-First Search cycle logic detections (`A → B → A`). |
390
+
391
+ ---
392
+
393
+ ### NITS Identity Tracking
394
+
395
+ Nodulus 1.2.5+ includes the **NITS (Nodulus Integrated Tracking System)**, which assigns a stable, unique ID to every module.
396
+ This allows the framework to track modules even when they are renamed or moved across the filesystem, preventing identity loss during refactors.
397
+
398
+ NITS maintains a state file at `.nodulus/registry.json` in your project root. **This file should be committed to version control.**
399
+
400
+ #### Resolving Merge Conflicts
401
+
402
+ Because `registry.json` tracks project-level state, parallel branches might occasionally result in Git merge conflicts. To resolve them:
403
+
404
+ 1. **Accept either side** (or both) of the conflict to make the JSON valid again.
405
+ 2. Run `npx nodulus check`.
406
+ 3. The NITS reconciler will automatically detect duplicate IDs or path shifts, "heal" the registry, and save the corrected state.
407
+ 4. Commit the updated `.nodulus/registry.json`.
408
+
359
409
  ---
360
410
 
361
411
  ## Logging
@@ -516,6 +566,8 @@ import type {
516
566
  RegisteredModule,
517
567
  MountedRoute,
518
568
  GetAliasesOptions,
569
+ ModuleRegistration,
570
+ FeatureRegistration,
519
571
  LogLevel,
520
572
  LogHandler,
521
573
  } from '@vlynk-studios/nodulus-core'