feat: Integrate JSR @jk-com/adblock-compiler with fallback#213
feat: Integrate JSR @jk-com/adblock-compiler with fallback#213jaypatrick merged 4 commits intomainfrom
Conversation
- 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>
|
@claude fix these workflow issues |
There was a problem hiding this comment.
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 |
|
@copilot open a new pull request to apply changes based on the comments in this thread |
|
@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. |
|
@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. |
|
@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. |
* 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>
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
New Features
Documentation
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
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
No breaking changes - existing code continues to work with improved architecture under the hood.