Skip to content

Commit b74c0e5

Browse files
committed
chore: wip
chore: wip chore: wip chore: wip chore: wip chore: wip chore: wip chore: wip chore: wip
1 parent 190aaba commit b74c0e5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+1875
-346
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ jobs:
8585

8686
publish-commit:
8787
runs-on: ubuntu-latest
88+
8889
steps:
8990
- uses: actions/checkout@v4
9091

@@ -106,4 +107,4 @@ jobs:
106107
run: bun run build
107108

108109
- name: Publish Commit
109-
run: bunx pkg-pr-new publish
110+
run: bunx pkg-pr-new publish './packages/dtsx' './packages/bun-plugin' './packages/vite-plugin'

.github/workflows/release.yml

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,30 @@
1-
name: CI
1+
name: Releaser
22

33
on:
44
push:
55
tags:
66
- 'v*'
77

8+
permissions:
9+
contents: write
10+
packages: write
11+
id-token: write
12+
813
jobs:
9-
release:
10-
name: release
14+
npm:
1115
runs-on: ubuntu-latest
12-
16+
outputs:
17+
version: ${{ env.VERSION }}
1318
steps:
14-
- uses: actions/checkout@v4
19+
- name: Checkout Code
20+
uses: actions/checkout@v4
1521
with:
1622
fetch-depth: 0
1723

18-
- name: Install Bun
24+
- name: Setup Bun
1925
uses: oven-sh/setup-bun@v2
2026

21-
- name: Use cached node_modules
27+
- name: Use Cached node_modules
2228
uses: actions/cache@v4
2329
with:
2430
path: node_modules
@@ -29,24 +35,33 @@ jobs:
2935
- name: Install Dependencies
3036
run: bun install
3137

38+
- name: Extract tag version
39+
id: get_version
40+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
41+
3242
- name: Publish to npm
3343
run: bun publish --access public
3444
env:
3545
BUN_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
3646

37-
- name: Create GitHub release
38-
run: bunx changelogithub
39-
env:
40-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
41-
42-
- name: Attach Binaries
47+
- name: Create GitHub Release
48+
id: create_release
4349
uses: stacksjs/[email protected]
4450
with:
4551
files: |
46-
bin/dtsx-linux-x64.zip
47-
bin/dtsx-linux-arm64.zip
48-
bin/dtsx-windows-x64.zip
49-
bin/dtsx-darwin-x64.zip
50-
bin/dtsx-darwin-arm64.zip
52+
./packages/dtsx/bin/dtsx-linux-x64.zip
53+
./packages/dtsx/bin/dtsx-linux-arm64.zip
54+
./packages/dtsx/bin/dtsx-windows-x64.zip
55+
./packages/dtsx/bin/dtsx-darwin-x64.zip
56+
./packages/dtsx/bin/dtsx-darwin-arm64.zip
57+
# --- Homebrew tap update support ---
58+
# Path to your Homebrew formula template (update this path as needed)
59+
# homebrewFormula: .github/homebrew-formula.rb
60+
# The owner/repo of your Homebrew tap (update this value as needed)
61+
# homebrewRepo: stacksjs/homebrew-tap
62+
# Optionally uncomment and set these if you need custom values:
63+
# homebrewBranch: main
64+
# homebrewPath: Formula
65+
# homebrewCommitFormat: "update: {{ formula }} to {{ version }}"
5166
env:
5267
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ temp
1313
docs/.vitepress/cache
1414
storage
1515
fixtures/generated
16-
bin/dtsx*
16+
**/bin/dtsx*
1717
/test/temp-output
1818
test/debug
1919
/test/fixtures/generated

bun.lock

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,39 @@
1111
"@stacksjs/gitlint": "^0.1.5",
1212
"@types/bun": "^1.2.14",
1313
"bun-git-hooks": "^0.2.16",
14-
"bun-plugin-dtsx": "^0.21.12",
14+
"bun-plugin-dtsx": "workspace:*",
15+
"unocss": "^66.1.2",
16+
},
17+
},
18+
"packages/bun-plugin": {
19+
"name": "bun-plugin-dtsx",
20+
"version": "0.8.3",
21+
"bin": {
22+
"dtsx": "./dist/bin/cli.js",
23+
},
24+
"devDependencies": {
25+
"@stacksjs/dtsx": "workspace:*",
26+
},
27+
},
28+
"packages/dtsx": {
29+
"name": "@stacksjs/dtsx",
30+
"version": "0.8.3",
31+
"bin": {
32+
"dtsx": "./dist/bin/cli.js",
33+
},
34+
"devDependencies": {
1535
"bunfig": "^0.10.0",
1636
"tinyglobby": "^0.2.13",
17-
"unocss": "^66.1.2",
37+
},
38+
},
39+
"packages/vite-plugin": {
40+
"name": "vite-plugin-dtsx",
41+
"version": "0.8.3",
42+
"bin": {
43+
"dtsx": "./dist/bin/cli.js",
44+
},
45+
"devDependencies": {
46+
"@stacksjs/dtsx": "workspace:*",
1847
},
1948
},
2049
},
@@ -494,7 +523,7 @@
494523

495524
"@stacksjs/docs": ["@stacksjs/[email protected]", "", { "dependencies": { "@iconify-json/carbon": "^1.2.8", "@shikijs/vitepress-twoslash": "^3.2.1", "@vite-pwa/assets-generator": "^1.0.0", "@vite-pwa/vitepress": "^1.0.0", "unocss": "^66.0.0", "unplugin-icons": "^22.1.0", "unplugin-vue-components": "^28.4.1", "vite-plugin-pwa": "^1.0.0", "vitepress": "1.6.3" } }, "sha512-kRk/aza/wQAAgF0fhUhG8bUHhqk3RnjBkZyoRW0fvYs3dLaAArJYX/uVquZixlQnqgizGeGZT986tEFjs5Ly+A=="],
496525

497-
"@stacksjs/dtsx": ["@stacksjs/dtsx@0.8.3", "", { "bin": { "dtsx": "dist/cli.js" } }, "sha512-+u/PEp478qHM8s7xT0AOZowd93mZ/5ptHFyiz0B/gcxmdrdNdM6bLIK5si5Uzy1cR5TOVN4oAB3+WMKDnJ3n1w=="],
526+
"@stacksjs/dtsx": ["@stacksjs/dtsx@workspace:packages/dtsx"],
498527

499528
"@stacksjs/error-handling": ["@stacksjs/[email protected]", "", {}, "sha512-rQcgyum8eZnVjaF+eb6ip/IHK4GuOidwy1GcbAOqXeDwbc7oUxWFlpT7pKMeYbYa+DWZjV1WdolLxSL/orQeCw=="],
500529

@@ -766,7 +795,7 @@
766795

767796
"bun-git-hooks": ["[email protected]", "", { "bin": { "git-hooks": "dist/bin/cli.js", "bun-git-hooks": "dist/bin/cli.js" } }, "sha512-xMqVjRKnhgFJIRfGPHzhGGWMOekqWvo36VlP7v+aUMGg4Qjgk2YsdVIItpx94P5/IwKyWvwAdngXJDmhcxTz/Q=="],
768797

769-
"bun-plugin-dtsx": ["bun-plugin-dtsx@0.21.12", "", { "dependencies": { "@stacksjs/dtsx": "^0.8.1" } }, "sha512-VqGDRoTKEnkD508k9jRlcwFoEEJXtjqLMGN+brRP4/3vH0wfLZkZiWG5jc490roZOmphrQlo5NgfFB/j71+Qtg=="],
798+
"bun-plugin-dtsx": ["bun-plugin-dtsx@workspace:packages/bun-plugin"],
770799

771800
"bun-types": ["[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-Kuh4Ub28ucMRWeiUUWMHsT9Wcbr4H3kLIO72RZZElSDxSu7vpetRvxIUDUaW6QtaIeixIpm7OXtNnZPf82EzwA=="],
772801

@@ -1686,6 +1715,8 @@
16861715

16871716
"vite": ["[email protected]", "", { "dependencies": { "esbuild": "^0.21.3", "postcss": "^8.4.43", "rollup": "^4.20.0" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^18.0.0 || >=20.0.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.4.0" }, "optionalPeers": ["@types/node", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser"], "bin": { "vite": "bin/vite.js" } }, "sha512-qO3aKv3HoQC8QKiNSTuUM1l9o/XX3+c+VTgLHbJWHZGeTPVAg2XwazI9UWzoxjIJCGCV2zU60uqMzjeLZuULqA=="],
16881717

1718+
"vite-plugin-dtsx": ["vite-plugin-dtsx@workspace:packages/vite-plugin"],
1719+
16891720
"vite-plugin-pwa": ["[email protected]", "", { "dependencies": { "debug": "^4.3.6", "pretty-bytes": "^6.1.1", "tinyglobby": "^0.2.10", "workbox-build": "^7.3.0", "workbox-window": "^7.3.0" }, "peerDependencies": { "@vite-pwa/assets-generator": "^1.0.0", "vite": "^3.1.0 || ^4.0.0 || ^5.0.0 || ^6.0.0" }, "optionalPeers": ["@vite-pwa/assets-generator"] }, "sha512-X77jo0AOd5OcxmWj3WnVti8n7Kw2tBgV1c8MCXFclrSlDV23ePzv2eTDIALXI2Qo6nJ5pZJeZAuX0AawvRfoeA=="],
16901721

16911722
"vitepress": ["[email protected]", "", { "dependencies": { "@docsearch/css": "3.8.2", "@docsearch/js": "3.8.2", "@iconify-json/simple-icons": "^1.2.21", "@shikijs/core": "^2.1.0", "@shikijs/transformers": "^2.1.0", "@shikijs/types": "^2.1.0", "@types/markdown-it": "^14.1.2", "@vitejs/plugin-vue": "^5.2.1", "@vue/devtools-api": "^7.7.0", "@vue/shared": "^3.5.13", "@vueuse/core": "^12.4.0", "@vueuse/integrations": "^12.4.0", "focus-trap": "^7.6.4", "mark.js": "8.11.1", "minisearch": "^7.1.1", "shiki": "^2.1.0", "vite": "^5.4.14", "vue": "^3.5.13" }, "peerDependencies": { "markdown-it-mathjax3": "^4", "postcss": "^8" }, "optionalPeers": ["markdown-it-mathjax3", "postcss"], "bin": { "vitepress": "bin/vitepress.js" } }, "sha512-fCkfdOk8yRZT8GD9BFqusW3+GggWYZ/rYncOfmgcDtP3ualNHCAg+Robxp2/6xfH1WwPHtGpPwv7mbA3qomtBw=="],
@@ -1826,6 +1857,8 @@
18261857

18271858
"@shikijs/twoslash/@shikijs/types": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" } }, "sha512-zHC1l7L+eQlDXLnxvM9R91Efh2V4+rN3oMVS2swCBssbj2U/FBwybD1eeLaq8yl/iwT+zih8iUbTBCgGZOYlVg=="],
18281859

1860+
"@stacksjs/development/bun-plugin-dtsx": ["[email protected]", "", { "dependencies": { "@stacksjs/dtsx": "^0.8.1" } }, "sha512-VqGDRoTKEnkD508k9jRlcwFoEEJXtjqLMGN+brRP4/3vH0wfLZkZiWG5jc490roZOmphrQlo5NgfFB/j71+Qtg=="],
1861+
18291862
"@stacksjs/eslint-config/@stacksjs/logging": ["@stacksjs/[email protected]", "", {}, "sha512-rm/XGj7z+one5mQqwrgxRq/ulusyz2eWVe3QUP3/V9kKkDtEhI9tnmx4PLvVQZbxJgsVzcZeuyJ12OfxfpKFdg=="],
18301863

18311864
"@stacksjs/eslint-plugin/@stacksjs/eslint-config": ["@stacksjs/[email protected]", "", { "dependencies": { "@antfu/install-pkg": "^1.0.0", "@clack/prompts": "^0.10.0", "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1", "@eslint/markdown": "^6.3.0", "@stacksjs/eslint-plugin": "^0.2.4", "@stylistic/eslint-plugin": "^4.2.0", "@typescript-eslint/eslint-plugin": "^8.27.0", "@typescript-eslint/parser": "^8.27.0", "@vitest/eslint-plugin": "^1.1.38", "eslint-config-flat-gitignore": "^2.1.0", "eslint-flat-config-utils": "^2.0.1", "eslint-merge-processors": "^2.0.0", "eslint-plugin-antfu": "^3.1.1", "eslint-plugin-command": "^3.2.0", "eslint-plugin-import-x": "^4.9.1", "eslint-plugin-jsdoc": "^50.6.8", "eslint-plugin-jsonc": "^2.19.1", "eslint-plugin-n": "^17.16.2", "eslint-plugin-no-only-tests": "^3.3.0", "eslint-plugin-perfectionist": "^4.10.1", "eslint-plugin-pnpm": "^0.3.1", "eslint-plugin-regexp": "^2.7.0", "eslint-plugin-toml": "^0.12.0", "eslint-plugin-unicorn": "^57.0.0", "eslint-plugin-unused-imports": "^4.1.4", "eslint-plugin-vue": "^10.0.0", "eslint-plugin-yml": "^1.17.0", "eslint-processor-vue-blocks": "^2.0.0", "globals": "^16.0.0", "jsonc-eslint-parser": "^2.4.0", "local-pkg": "^1.1.1", "parse-gitignore": "^2.0.0", "toml-eslint-parser": "^0.10.0", "vue-eslint-parser": "^10.1.1", "yaml-eslint-parser": "^1.3.0" } }, "sha512-Jnz6z/tGjfKUToZXgCF8XRBqZlEXlkLTymJgD2O2CzYfG58uUV/7cqtn2ABPs+SJ5t8O4qYwbC6WDOMQjP+M2Q=="],
@@ -1926,6 +1959,8 @@
19261959

19271960
"@shikijs/core/@shikijs/engine-javascript/oniguruma-to-es": ["[email protected]", "", { "dependencies": { "emoji-regex-xs": "^1.0.0", "regex": "^6.0.1", "regex-recursion": "^6.0.2" } }, "sha512-bUH8SDvPkH3ho3dvwJwfonjlQ4R80vjyvrU8YpxuROddv55vAEJrTuCuCVUhhsHbtlD9tGGbaNApGQckXhS8iQ=="],
19281961

1962+
"@stacksjs/development/bun-plugin-dtsx/@stacksjs/dtsx": ["@stacksjs/[email protected]", "", { "bin": { "dtsx": "dist/cli.js" } }, "sha512-+u/PEp478qHM8s7xT0AOZowd93mZ/5ptHFyiz0B/gcxmdrdNdM6bLIK5si5Uzy1cR5TOVN4oAB3+WMKDnJ3n1w=="],
1963+
19291964
"eslint-plugin-vuejs-accessibility/vue-eslint-parser/eslint-scope": ["[email protected]", "", { "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" } }, "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg=="],
19301965

19311966
"eslint-plugin-vuejs-accessibility/vue-eslint-parser/eslint-visitor-keys": ["[email protected]", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],

docs/advanced/index.md

Lines changed: 139 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,150 @@
11
# Advanced Topics
22

3-
This section covers advanced topics and techniques for using dtsx effectively.
3+
This section covers advanced topics and techniques for using dtsx effectively in complex scenarios.
44

5-
## Advanced Type Processing
5+
## Type Processing
66

7-
- **Complex Type Inference**: Handling nested and recursive types
8-
- **Type Relationship Tracking**: Maintaining type relationships across files
9-
- **Custom Type Transformations**: Advanced type manipulation techniques
10-
- **Type Augmentation**: Extending existing type definitions
7+
Learn about dtsx's advanced type processing capabilities:
118

12-
## Performance Optimization
9+
- **[Type Processing](./type-processing.md)**: Deep dive into how dtsx processes TypeScript types
10+
- **Complex Type Inference**: Handling nested, recursive, and conditional types
11+
- **Type Relationship Tracking**: Maintaining type dependencies across files
12+
- **Declaration Extraction**: Understanding the AST-based extraction process
13+
- **Comment Preservation**: Advanced comment handling and formatting
1314

14-
- **Import Optimization Strategies**: Advanced techniques for optimizing imports
15-
- **Memory Management**: Handling large codebases efficiently
16-
- **Parallel Processing**: Optimizing multi-file processing
17-
- **Caching Strategies**: Improving build times with caching
15+
## Performance & Optimization
1816

19-
## Integration Patterns
17+
Optimize dtsx for large codebases and complex projects:
2018

21-
- **Build System Integration**: Integrating with various build tools
22-
- **CI/CD Integration**: Setting up automated declaration generation
23-
- **Custom Transformers**: Creating custom type transformers
24-
- **Plugin System**: Extending dtsx functionality
19+
- **[Performance](./performance.md)**: Performance optimization strategies and best practices
20+
- **Import Optimization**: Advanced techniques for optimizing import statements
21+
- **Memory Management**: Handling large codebases efficiently with Bun's runtime
22+
- **File Processing**: Optimizing multi-file processing workflows
23+
- **Output Structure**: Choosing the right output structure for your needs
2524

26-
## Troubleshooting
25+
## Integration & Automation
2726

28-
- **Common Issues**: Solutions to frequent problems
29-
- **Debugging Techniques**: Advanced debugging strategies
30-
- **Performance Profiling**: Identifying and fixing performance bottlenecks
27+
Integrate dtsx into your development workflow:
28+
29+
- **[Integration](./integration.md)**: Build system and CI/CD integration patterns
30+
- **Build Tool Integration**: Webpack, Vite, Rollup, and other bundler integration
31+
- **CI/CD Pipelines**: Automated declaration generation in continuous integration
32+
- **Package.json Scripts**: Effective npm script configurations
33+
- **Development Workflows**: Hot reloading and watch mode strategies
34+
35+
## Troubleshooting & Debugging
36+
37+
Solve common issues and debug complex scenarios:
38+
39+
- **[Troubleshooting](./troubleshooting.md)**: Common issues and their solutions
40+
- **TypeScript Configuration**: Isolated declarations and tsconfig.json setup
3141
- **Type Resolution**: Handling complex type resolution scenarios
42+
- **Import/Export Issues**: Debugging import and export problems
43+
- **Performance Debugging**: Identifying and fixing performance bottlenecks
44+
45+
## Configuration Patterns
46+
47+
Advanced configuration techniques:
48+
49+
### Multi-Package Monorepos
50+
```typescript
51+
// dts.config.ts
52+
export default {
53+
entrypoints: [
54+
'packages/*/src/index.ts',
55+
'packages/*/src/types.ts'
56+
],
57+
outputStructure: 'mirror',
58+
clean: true
59+
}
60+
```
61+
62+
### Selective Type Generation
63+
```typescript
64+
// Generate only specific modules
65+
export default {
66+
entrypoints: [
67+
'src/public-api/**/*.ts',
68+
'!src/internal/**/*.ts'
69+
]
70+
}
71+
```
72+
73+
### Custom Output Structures
74+
```typescript
75+
// Flat structure for libraries
76+
export default {
77+
outputStructure: 'flat',
78+
outdir: './types'
79+
}
80+
```
81+
82+
## Best Practices
83+
84+
### Type Design
85+
- Use explicit type annotations for public APIs
86+
- Leverage JSDoc comments for comprehensive documentation
87+
- Design types with isolated declarations in mind
88+
- Avoid complex type computations in public interfaces
89+
90+
### Project Structure
91+
- Organize types in dedicated files when appropriate
92+
- Use barrel exports for clean public APIs
93+
- Separate internal types from public interfaces
94+
- Maintain consistent naming conventions
95+
96+
### Performance
97+
- Use type-only imports when possible
98+
- Minimize circular dependencies
99+
- Consider output structure impact on bundle size
100+
- Enable verbose logging only for debugging
101+
102+
### Documentation
103+
- Include comprehensive JSDoc comments
104+
- Use `@example` tags for usage examples
105+
- Document complex type relationships
106+
- Maintain up-to-date type documentation
107+
108+
## Advanced Use Cases
109+
110+
### Library Development
111+
Creating type-safe libraries with comprehensive declaration files:
112+
113+
```typescript
114+
// src/index.ts
115+
/**
116+
* Main library interface
117+
* @example
118+
* const lib = new MyLibrary({ config: true })
119+
*/
120+
export class MyLibrary {
121+
constructor(options: LibraryOptions) {}
122+
}
123+
124+
export type { LibraryOptions } from './types'
125+
```
126+
127+
### API Client Generation
128+
Generating types for API clients and SDKs:
129+
130+
```typescript
131+
// Generate types for REST API responses
132+
export interface ApiResponse<T = unknown> {
133+
data: T
134+
status: number
135+
message?: string
136+
}
137+
```
138+
139+
### Plugin Systems
140+
141+
Creating extensible plugin architectures with proper typing:
142+
143+
```typescript
144+
// Plugin interface with proper type constraints
145+
export interface Plugin<TConfig = Record<string, unknown>> {
146+
name: string
147+
config?: TConfig
148+
initialize(): Promise<void>
149+
}
150+
```

0 commit comments

Comments
 (0)