Skip to content

Conversation

@jaypatrick
Copy link
Owner

Overview

Integrates the new JSR-based @jk-com/adblock-compiler@^0.6.0\ package as the primary compiler for the TypeScript rules compiler, with automatic fallback to the npm-based @adguard/hostlist-compiler.

Changes

Compiler Integration

  • ✅ Added @jk-com/adblock-compiler@^0.6.0\ from JSR as primary dependency
  • ✅ Kept @adguard/hostlist-compiler\ as fallback
  • ✅ Created \compiler-adapter.ts\ for automatic fallback logic
  • ✅ Updated \compiler.ts\ to use new adapter

New Features

  • Automatic Fallback: Tries JSR first, falls back to npm if unavailable
  • Runtime Logging: Shows which compiler is being used at startup
  • Zero Breaking Changes: 100% backward compatible with existing code
  • Compiler Info API: New \getCompilerInfo()\ function to check active compiler

Documentation

  • ✅ Added comprehensive \COMPILER_INTEGRATION.md\ guide
  • ✅ Usage examples and migration notes
  • ✅ Troubleshooting guide

Benefits of JSR Package

The new @jk-com/adblock-compiler\ includes:

SOLID Principles: Refactored with Single Responsibility, Open/Closed, etc.
Dependency Injection: All components use DI for testability
Modern TypeScript: Full type safety and modern patterns
Comprehensive Error Handling: Descriptive errors with context
Performance Optimizations: Improved pattern matching
Better Documentation: Full JSDoc coverage
Trace Logging: Additional debug level for troubleshooting

Backward Compatibility

  • ✅ Same \IConfiguration\ interface
  • ✅ Same \compile()\ function signature
  • ✅ No breaking changes to existing code
  • ✅ Works with existing configurations

Testing

\\�ash
cd src/rules-compiler-typescript
deno task compile
\\

Look for log output:
\
[Compiler] Using JSR package: @jk-com/adblock-compiler@^0.6.0
\\

Links

Related

  • Implements Phase 1 SOLID refactoring from hostlistcompiler project
  • Published to JSR as version 0.6.0
  • No changes required to existing compilation workflows

No breaking changes - existing code continues to work with improved architecture under the hood.

jaypatrick and others added 2 commits December 31, 2025 23:24
- Add JSR package @jk-com/adblock-compiler@^0.6.0 as primary dependency
- Keep @adguard/hostlist-compiler as fallback
- Create compiler-adapter.ts for automatic fallback handling
- Update compiler.ts to use new adapter
- Logs which compiler is being used at runtime

Co-Authored-By: Warp <agent@warp.dev>
@jaypatrick
Copy link
Owner Author

@claude fix these workflow issues

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR integrates a new JSR-based compiler package (@jk-com/adblock-compiler@^0.6.0) as the primary compiler for the TypeScript rules compiler with automatic fallback to the existing npm package (@adguard/hostlist-compiler). Additionally, it includes C# code refactoring that extracts enums and helper classes into separate files and removes unused project references.

Key changes:

  • Added compiler adapter with automatic JSR-to-npm fallback mechanism
  • Created comprehensive integration documentation
  • Refactored C# DataAccess layer by extracting enums and classes into dedicated files for better code organization

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/rules-compiler-typescript/src/lib/compiler-adapter.ts New adapter implementing JSR package loading with npm fallback logic
src/rules-compiler-typescript/src/compiler.ts Updated to import from the new compiler adapter instead of directly from npm package
src/rules-compiler-typescript/deno.json Added JSR package dependency while keeping npm package as fallback
src/rules-compiler-typescript/COMPILER_INTEGRATION.md New documentation explaining integration, usage, and troubleshooting
src/adguard-api-dotnet/src/AdGuard.DataAccess/Extensions/DatabaseProvider.cs Extracted DatabaseProvider enum into dedicated file
src/adguard-api-dotnet/src/AdGuard.DataAccess/Extensions/DataAccessOptions.cs Removed inline DatabaseProvider enum definition
src/adguard-api-dotnet/src/AdGuard.DataAccess/Entities/UserSettingsEntity.cs Removed inline SettingsValueType enum definition
src/adguard-api-dotnet/src/AdGuard.DataAccess/Entities/StatisticsGranularity.cs Extracted StatisticsGranularity enum into dedicated file
src/adguard-api-dotnet/src/AdGuard.DataAccess/Entities/StatisticsEntity.cs Removed inline StatisticsGranularity enum definition
src/adguard-api-dotnet/src/AdGuard.DataAccess/Entities/SettingsValueType.cs Extracted SettingsValueType enum into dedicated file
src/adguard-api-dotnet/src/AdGuard.DataAccess/Entities/AuditOperationType.cs Extracted AuditOperationType enum into dedicated file
src/adguard-api-dotnet/src/AdGuard.DataAccess/Entities/AuditLogEntity.cs Removed inline AuditOperationType enum definition
src/adguard-api-dotnet/src/AdGuard.DataAccess/DateTimeUtcConverter.cs Extracted DateTimeUtcConverter class into dedicated file
src/adguard-api-dotnet/src/AdGuard.DataAccess/AdGuardDbContext.cs Removed inline DateTimeUtcConverter class definition
src/adguard-api-dotnet/src/AdGuard.DataAccess/AdGuard.DataAccess.csproj Removed unused project references to ApiClient and Repositories
src/adguard-api-dotnet/src/AdGuard.DataAccess/Abstractions/StatisticsTotals.cs Extracted StatisticsTotals record into dedicated file
src/adguard-api-dotnet/src/AdGuard.DataAccess/Abstractions/IStatisticsLocalRepository.cs Removed inline StatisticsTotals record definition
src/adguard-api-dotnet/src/AdGuard.DataAccess/Abstractions/ICompilationHistoryLocalRepository.cs Removed inline CompilationStatistics record definition
src/adguard-api-dotnet/src/AdGuard.DataAccess/Abstractions/CompilationStatistics.cs Extracted CompilationStatistics record into dedicated file
src/adguard-api-dotnet/src/AdGuard.ApiClient.Benchmarks/AdGuard.ApiClient.Benchmarks.csproj Removed unused project reference to ConsoleUI

@jaypatrick
Copy link
Owner Author

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Contributor

Copilot AI commented Jan 1, 2026

@jaypatrick I've opened a new pull request, #214, to work on those changes. Once the pull request is ready, I'll request review from you.

@jaypatrick
Copy link
Owner Author

@copilot look through documentation and ensure npm/deno/jsr packages are not referencing adguardteam. I forked my version, and will not be submitting changes back to them, at least not for now. All package references should reference the jk-com/adblock-compiler namespace/package.

Copy link
Contributor

Copilot AI commented Jan 1, 2026

@jaypatrick I've opened a new pull request, #215, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits December 31, 2025 23:40
* Initial plan

* refactor: Remove any types and top-level await from compiler-adapter

Co-authored-by: jaypatrick <1800595+jaypatrick@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jaypatrick <1800595+jaypatrick@users.noreply.github.com>
#215)

* Initial plan

* docs: remove all adguardteam references, use jk-com/adblock-compiler exclusively

Co-authored-by: jaypatrick <1800595+jaypatrick@users.noreply.github.com>

* fix: update TypeScript source imports to use jk-com/adblock-compiler

Co-authored-by: jaypatrick <1800595+jaypatrick@users.noreply.github.com>

* docs: update remaining documentation references to jk-com/adblock-compiler

Co-authored-by: jaypatrick <1800595+jaypatrick@users.noreply.github.com>

* docs: remove adguard references from compiler READMEs

Co-authored-by: jaypatrick <1800595+jaypatrick@users.noreply.github.com>

---------

Signed-off-by: Jayson Knight <jayson.knight@jaysonknight.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jaypatrick <1800595+jaypatrick@users.noreply.github.com>
Co-authored-by: Jayson Knight <jayson.knight@jaysonknight.com>
@jaypatrick jaypatrick merged commit a98230e into main Jan 1, 2026
11 of 16 checks passed
@jaypatrick jaypatrick deleted the refactoring-project branch January 1, 2026 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants