Skip to content

Commit bbfa6e1

Browse files
chore: wip
1 parent 050c85d commit bbfa6e1

9 files changed

Lines changed: 5261 additions & 16 deletions

File tree

TODO.md

Lines changed: 95 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444

4545
- [x] **Redundant `extractAllImportedItems()` calls** - Called multiple times for the same import. ✅ Already cached via `getImportItemsFromCache()`
4646

47-
- [ ] **String concatenation in hot paths** - `processor.ts` uses string concatenation (`result +=`) extensively. Use array joins for better performance.
47+
- [x] **String concatenation in hot paths** - `processor.ts` uses string concatenation (`result +=`) extensively. Use array joins for better performance. ✅ Refactored to use array `.join()` pattern in builders.ts
4848

49-
- [ ] **Repeated source code parsing** - `extractDeclarations()` creates a new SourceFile for each file. Consider caching parsed ASTs when processing related files.
49+
- [x] **Repeated source code parsing** - `extractDeclarations()` creates a new SourceFile for each file. Consider caching parsed ASTs when processing related files. ✅ AST caching exists in extractor/cache.ts
5050

5151
### P1: Parser Efficiency
5252

@@ -228,11 +228,11 @@
228228
229229
- [ ] **Include patterns** - More granular control over what gets processed.
230230
231-
- [ ] **Source maps** - Generate source maps for debugging.
231+
- [x] **Source maps** - Generate source maps for debugging. ✅ Implemented with VLQ encoding
232232
233233
- [x] **Watch mode** - File watching for incremental regeneration. ✅ Implemented `dtsx watch` command
234234
235-
- [ ] **Incremental builds** - Cache and reuse unchanged declarations.
235+
- [x] **Incremental builds** - Cache and reuse unchanged declarations. ✅ Implemented in `src/cache.ts` with content hashing
236236
237237
### Output Quality
238238
@@ -248,15 +248,15 @@
248248
249249
### Developer Experience
250250
251-
- [ ] **Better error messages** - Include file location and context in errors.
251+
- [x] **Better error messages** - Include file location and context in errors. ✅ Implemented in `src/errors.ts`
252252
253253
- [x] **Progress reporting** - Show progress for large codebases. ✅ Implemented `--progress` CLI option
254254
255255
- [ ] **Diff output** - Show what changed between generations.
256256
257257
- [ ] **Validation mode** - Check generated .d.ts files against TypeScript compiler.
258258
259-
- [ ] **IDE integration** - Language server protocol support.
259+
- [x] **IDE integration** - Language server protocol support. ✅ Implemented `src/lsp.ts` with hover, completion, diagnostics
260260
261261
---
262262
@@ -322,21 +322,21 @@ Based on code analysis, these are the likely bottlenecks:
322322
323323
### v1.1 (Performance)
324324
325-
- Incremental builds
326-
- Watch mode
327-
- Memory optimization
325+
- [x] Incremental builds ✅ Implemented in `src/cache.ts` with content hashing and mtime tracking
326+
- [x] Watch mode ✅ Implemented `dtsx watch` command
327+
- [ ] Memory optimization
328328
329329
### v1.2 (DX)
330330
331-
- Better error messages
332-
- IDE integration
333-
- Prettier integration
331+
- [x] Better error messages ✅ Implemented in `src/errors.ts` with typed errors and context
332+
- [x] IDE integration ✅ Implemented LSP server in `src/lsp.ts`
333+
- [ ] Prettier integration
334334
335335
### v2.0 (Advanced)
336336
337-
- Source maps
338-
- Declaration bundling
339-
- Monorepo support
337+
- [x] Source maps ✅ Implemented with VLQ encoding
338+
- [x] Declaration bundling ✅ Implemented in `src/bundler.ts`
339+
- [x] Monorepo support ✅ Implemented in `src/workspace.ts`
340340
341341
---
342342
@@ -350,6 +350,23 @@ Based on code analysis, these are the likely bottlenecks:
350350
351351
## 🟣 Plugin Ecosystem
352352
353+
### Core Plugin System ✅ NEW
354+
355+
- [x] **Plugin architecture** - Implemented in `src/plugins.ts` with full lifecycle hooks:
356+
- `onStart` - Before generation starts
357+
- `onBeforeFile` - Before processing each file
358+
- `onDeclarations` - Transform declarations
359+
- `onAfterFile` - After generating each .d.ts file
360+
- `onEnd` - After all files processed
361+
- `onError` - Error handling hook
362+
363+
- [x] **Built-in plugins** - Several built-in plugins available:
364+
- `stripInternalPlugin` - Remove @internal declarations
365+
- `createBannerPlugin()` - Add custom header banners
366+
- `createFilterPlugin()` - Filter declarations by name
367+
368+
- [x] **Plugin API** - `definePlugin()` helper for TypeScript support
369+
353370
### Vite Plugin
354371
355372
- [ ] **Implement vite-plugin** - Currently just exports `wip = true`. Needs full implementation:
@@ -547,5 +564,67 @@ Based on test fixtures analysis:
547564
548565
---
549566
550-
*Last updated: November 25, 2025*
567+
---
568+
569+
## ✅ Recently Implemented Features
570+
571+
### Session: November 26, 2025
572+
573+
#### New Modules Created
574+
575+
- **`src/plugins.ts`** - Full plugin system with lifecycle hooks
576+
- **`src/bundler.ts`** - Declaration file bundling with import deduplication
577+
- **`src/cache.ts`** - Incremental build caching with content hashing
578+
- **`src/workspace.ts`** - Multi-project/monorepo support
579+
- **`src/docs.ts`** - API documentation generator from JSDoc
580+
- **`src/optimizer.ts`** - Declaration file optimizer (tree-shaking, minification)
581+
- **`src/lsp.ts`** - Language Server Protocol implementation
582+
- **`src/errors.ts`** - Typed error system with context
583+
- **`test/generator.test.ts`** - Comprehensive generator tests (27 tests)
584+
585+
#### CLI Commands Added
586+
587+
- `dtsx workspace` - Generate declarations for monorepo projects
588+
- `dtsx docs` - Generate API documentation
589+
- `dtsx optimize` - Optimize declaration files
590+
- `dtsx lsp` - Start LSP server for IDE integration
591+
592+
#### Config Enhancements
593+
594+
- `defineConfig()` helper for TypeScript intellisense
595+
- Support for `dtsx.config.ts` configuration files
596+
- New options: `plugins`, `bundle`, `bundleOutput`, `incremental`, `clearCache`
597+
598+
#### Additional Features (November 26, 2025)
599+
600+
- **`src/transformers.ts`** - Custom transformers API for AST-level transformations
601+
- `Transformer` type for declaration-level transforms
602+
- `composeTransformers()` for chaining transformers
603+
- `filterByKind()`, `filterByPredicate()` for conditional transforms
604+
- Built-in transformers: rename, prefix, suffix, remove, JSDoc, type, readonly, required, optional
605+
- `createTransformerPlugin()` to convert transformers to plugins
606+
607+
- **`src/checker.ts`** - TypeScript type checking integration
608+
- `typeCheck()` - Full type checking with diagnostics
609+
- `validateDeclarations()` - Validate generated .d.ts files
610+
- `checkIsolatedDeclarations()` - Check isolatedDeclarations compatibility
611+
- `getTypeAtPosition()`, `getQuickInfo()` - Type information at cursor
612+
- `formatTypeCheckResults()` - Human-readable output
613+
614+
- **`src/formats.ts`** - Additional output formats
615+
- `toJsonSchema()` - Convert to JSON Schema (draft-07, 2019-09, 2020-12)
616+
- `toZod()` - Convert to Zod schemas
617+
- `toValibot()` - Convert to Valibot schemas
618+
- `toIoTs()` - Convert to io-ts codecs
619+
- `toYup()` - Convert to Yup schemas
620+
- `toArkType()` - Convert to ArkType schemas
621+
622+
#### CLI Commands Added
623+
624+
- `dtsx check` - Type check files with isolated declarations support
625+
- `dtsx convert` - Convert TypeScript types to different schema formats
626+
627+
---
628+
629+
*Last updated: November 26, 2025*
551630
*Generated from codebase analysis of dtsx v0.9.9*

0 commit comments

Comments
 (0)