Skip to content

Commit 8ff7b14

Browse files
committed
fix: git issues
0 parents  commit 8ff7b14

Some content is hidden

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

81 files changed

+11850
-0
lines changed

.eslintrc.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
plugins: ['@typescript-eslint'],
4+
extends: [
5+
'eslint:recommended',
6+
'@typescript-eslint/recommended'
7+
],
8+
env: {
9+
node: true,
10+
es2022: true
11+
},
12+
parserOptions: {
13+
ecmaVersion: 2022,
14+
sourceType: 'module'
15+
},
16+
rules: {
17+
'@typescript-eslint/no-unused-vars': 'warn',
18+
'@typescript-eslint/explicit-function-return-type': 'warn',
19+
'@typescript-eslint/no-explicit-any': 'warn',
20+
'prefer-const': 'error',
21+
'no-var': 'error'
22+
}
23+
};

.github/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: CodeMeAPixel
2+
custom: luats.codemeapixel.dev

.github/workflows/build.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [main, master, development]
6+
pull_request:
7+
branches: [main, master, development]
8+
9+
jobs:
10+
test-build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v3
16+
17+
- name: Set up Bun
18+
uses: oven-sh/setup-bun@v1
19+
20+
- name: Install dependencies
21+
run: bun install
22+
23+
- name: Build library
24+
run: bun run build
25+
26+
- name: Run tests
27+
run: bun test

.github/workflows/docs.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Deploy GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: 'pages'
15+
cancel-in-progress: false
16+
17+
jobs:
18+
deploy:
19+
environment:
20+
name: github-pages
21+
url: ${{ steps.deployment.outputs.page_url }}
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Setup Ruby
28+
uses: ruby/setup-ruby@v1
29+
with:
30+
ruby-version: '3.2'
31+
32+
- name: Install dependencies
33+
run: |
34+
cd docs
35+
bundle install
36+
37+
- name: Build site
38+
run: |
39+
cd docs
40+
bundle exec jekyll build
41+
42+
- name: Setup Pages
43+
uses: actions/configure-pages@v4
44+
45+
- name: Upload artifact
46+
uses: actions/upload-pages-artifact@v3
47+
with:
48+
path: 'docs/_site'
49+
50+
- name: Deploy to GitHub Pages
51+
id: deployment
52+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Logs
2+
logs/*.log
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
8+
# Runtime data
9+
pids
10+
*.pid
11+
*.seed
12+
*.pid.lock
13+
14+
# Directory for instrumented libs generated by jscoverage/JSCover
15+
lib-cov
16+
17+
# Coverage directory used by tools like istanbul
18+
coverage/
19+
20+
# nyc test coverage
21+
.nyc_output
22+
23+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
24+
.grunt
25+
26+
# Bower dependency directory (https://bower.io/)
27+
bower_components
28+
29+
# Node stuff
30+
**/package-lock.json
31+
**/yarn.lock
32+
bun.lockb
33+
bun.lock
34+
35+
# Status files
36+
shared/status.json
37+
38+
# OS generated files
39+
.DS_Store
40+
.DS_Store?
41+
._*
42+
.Spotlight-V100
43+
.Trashes
44+
ehthumbs.db
45+
Thumbs.db
46+
47+
# IDE files
48+
.vscode/
49+
.idea/
50+
*.swp
51+
*.swo
52+
*~
53+
54+
# Temporary files
55+
*.tmp
56+
*.temp
57+
58+
# Other ignored directories
59+
ignored/
60+
61+
# Build output
62+
node_modules/
63+
scripts/**/*
64+
scripts/
65+
test/junit.xml
66+
dist/

.npmignore

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Development files
2+
src/
3+
test/
4+
scripts/
5+
examples/
6+
docs/
7+
.github/
8+
coverage/
9+
.todo/
10+
.vscode/
11+
.idea/
12+
.git/
13+
14+
# Only include the logo in assets
15+
assets/
16+
!assets/logo.png
17+
18+
# Configuration files (except those needed for package users)
19+
.eslintrc.js
20+
.prettierrc
21+
.gitignore
22+
.travis.yml
23+
tsconfig.json
24+
bunfig.toml
25+
Gemfile
26+
bun.lockb
27+
jest.config.js
28+
29+
# Build artifacts
30+
*.log
31+
*.tsbuildinfo
32+
.DS_Store
33+
Thumbs.db
34+
35+
# Test files
36+
__tests__/
37+
__mocks__/
38+
*.test.ts
39+
*.spec.ts
40+
41+
# Documentation files
42+
*.md
43+
!README.md
44+
!LICENSE
45+
!SECURITY.md
46+
!CHANGELOG.md
47+
48+
# Temporary files
49+
tmp/
50+
temp/
51+
.tmp/
52+
.temp/
53+
54+
# IDE configuration
55+
.editorconfig
56+
*.sublime-project
57+
*.sublime-workspace
58+
59+
# Only include dist folder when publishing
60+
# Don't ignore these files
61+
!dist/

.prettierrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "es5",
4+
"singleQuote": true,
5+
"printWidth": 80,
6+
"tabWidth": 2,
7+
"useTabs": false
8+
}

.todo/additional.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## Additional Ideas & Improvements
2+
3+
- [ ] **Publish TypeScript declaration files (`.d.ts`) for all public APIs**
4+
- [ ] **Add ESM and CJS dual support with proper `"exports"` field**
5+
- [ ] **Provide a VSCode extension for Lua/Luau → TypeScript conversion**
6+
- [ ] **Add support for custom output templates (e.g., for JSDoc, TSDoc, etc.)**
7+
- [ ] **Enable incremental builds for large codebases**
8+
- [ ] **Support for Lua 5.4 and future Luau features**
9+
- [ ] **Add a web playground (REPL) for live conversion and preview**
10+
- [ ] **Add a `luats init` command to scaffold config and example files**
11+
- [ ] **Support for YAML config files in addition to JSON**
12+
- [ ] **Add CLI auto-completion scripts for bash/zsh/fish**
13+
- [ ] **Improve error messages with code frames and suggestions**
14+
- [ ] **Add a `luats watch` mode for live conversion in dev workflows**
15+
- [ ] **Provide migration guides for legacy Lua codebases**
16+
- [ ] **Add benchmarking and performance tests**
17+
- [ ] **Support for sourcemaps or code mapping back to Lua**
18+
- [ ] **Add a logo/banner to npm and GitHub README**
19+
- [ ] **Add badges for test coverage, bundle size, etc.**
20+
- [ ] **Publish example projects and templates**
21+
- [ ] **Add a `luats doctor` command for troubleshooting environment/config issues**
22+
- [ ] **Support for monorepo setups and workspace-aware config**
23+
- [ ] **Add support for extern types/classes (typically ending in a .d.lua file)**
24+
- [ ] **Add ability to reverse logic (ie: transform typescript into lua)**
25+
- [ ] **Add support for generating types for lua/luau `local function`**

.todo/basics.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Basic Features/Functionality
2+
- [x] **Fix all TypeScript build errors and warnings**
3+
- [x] Remove duplicate/unused functions and variables
4+
- [x] Correct all type/interface issues (especially optional properties)
5+
- [x] Ensure all imports are correct and used
6+
- [x] **Implement real Lua/Luau parsing in `generateTypeScript`**
7+
- [x] Integrate or stub a parser for Lua/Luau AST generation
8+
- [x] **Add proper plugin loading and application in CLI processor**
9+
- [x] Remove duplicate `applyPlugins` and implement dynamic plugin loading
10+
- [x] **Expand CLI validation logic beyond placeholder**
11+
- [x] Add real validation for Lua/Luau files
12+
- [ ] **Write unit tests for CLI and processor modules**
13+
- [ ] Cover CLI commands and processor logic
14+
- [ ] **Improve error handling and user feedback in CLI**
15+
- [ ] Make CLI output clear and actionable
16+
- [x] **Document configuration options and CLI usage**
17+
- [x] Add README and CLI help improvements
18+
- [ ] **Add support for more CLI commands (e.g., format, lint)**
19+
- [ ] **Ensure cross-platform compatibility (Windows, Linux, macOS)**
20+
- [ ] Replace `rm -rf` with cross-platform alternatives (e.g., `rimraf`)
21+
- [ ] **Set up CI for automated builds and tests**
22+
- [ ] Add GitHub Actions or similar workflow

CHANGELOG.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.1.0] - 2025-08-02
9+
10+
### 🎉 Initial Release
11+
12+
#### Core Parsing & Generation
13+
- **Complete Lua parser** with full AST generation supporting all Lua 5.1+ syntax
14+
- **Advanced Luau parser** with type annotations, generics, and modern syntax features
15+
- **TypeScript code generation** from Luau type definitions with intelligent mapping
16+
- **Lua code formatting** with customizable styling options and pretty-printing
17+
- **AST manipulation utilities** with comprehensive type definitions
18+
19+
#### Advanced Type System
20+
- **Primitive type mapping**: `string`, `number`, `boolean`, `nil``null`
21+
- **Optional types**: `foo: string?``foo?: string`
22+
- **Array types**: `{string}``string[]` with proper element type detection
23+
- **Record types**: `{[string]: any}``Record<string, any>` and index signatures
24+
- **Union types**: `"GET" | "POST" | "PUT"` with string literal preservation
25+
- **Intersection types**: `A & B` with proper parenthesization
26+
- **Function types**: `(x: number) -> string``(x: number) => string`
27+
- **Method types**: Automatic `self` parameter removal for class methods
28+
- **Generic types**: Support for parameterized types and type variables
29+
- **Table types**: Complex nested object structures with property signatures
30+
31+
#### Language Features
32+
- **Template string interpolation**: Full backtick string support with `${var}` and `{var}` syntax
33+
- **Continue statements**: Proper parsing with loop context validation
34+
- **Reserved keywords as properties**: Handle `type`, `export`, `function`, `local` as object keys
35+
- **Comment preservation**: Single-line (`--`) and multi-line (`--[[ ]]`) comment handling
36+
- **JSDoc conversion**: Transform Lua comments to TypeScript JSDoc format
37+
- **Export statements**: Support for `export type` declarations
38+
- **String literals**: Proper handling of quoted strings in union types
39+
40+
#### Modular Architecture
41+
- **Component-based lexer**: Specialized tokenizers for numbers, strings, identifiers, comments
42+
- **Pluggable tokenizer system**: Easy extension with new language constructs
43+
- **Operator precedence handling**: Correct parsing of complex expressions
44+
- **Error recovery**: Graceful handling of syntax errors with detailed diagnostics
45+
- **Memory efficient**: Streaming parsing for large files
46+
47+
#### Plugin System
48+
- **File-based plugins**: Load plugins from JavaScript/TypeScript files
49+
- **Inline plugin objects**: Direct plugin integration in code
50+
- **Type transformation hooks**: Customize how Luau types map to TypeScript
51+
- **Interface modification**: Add, remove, or modify generated interface properties
52+
- **Post-processing**: Transform final generated TypeScript code
53+
- **Plugin registry**: Manage multiple plugins with validation
54+
- **Hot reloading**: Plugin cache management for development
55+
56+
#### CLI Tools
57+
- **File conversion**: `luats convert file.lua -o file.d.ts`
58+
- **Directory processing**: `luats convert-dir src/lua -o src/types`
59+
- **Watch mode**: Auto-regeneration on file changes with `--watch`
60+
- **Syntax validation**: `luats validate` for error checking
61+
- **Configuration files**: Support for `luats.config.json` with rich options
62+
- **Glob patterns**: Include/exclude file patterns for batch processing
63+
64+
#### Developer Experience
65+
- **Comprehensive TypeScript definitions**: Full type safety for all APIs
66+
- **Error handling**: Detailed error messages with line/column information
67+
- **Snapshot testing**: Fixture-based testing for regression prevention
68+
- **Performance optimizations**: Efficient parsing and generation algorithms
69+
- **Documentation generation**: Generate docs from parsed code structures
70+
71+
#### Configuration Options
72+
- **Type generation**: `useUnknown`, `interfacePrefix`, `includeSemicolons`
73+
- **Comment handling**: `preserveComments`, `commentStyle` (jsdoc/inline)
74+
- **Code formatting**: Indentation, spacing, and style preferences
75+
- **Plugin configuration**: File paths and plugin-specific options
76+
- **Include/exclude patterns**: Fine-grained control over processed files
77+
78+
#### Testing & Quality
79+
- **47 comprehensive tests** covering all major functionality
80+
- **100% test pass rate** with robust edge case handling
81+
- **Snapshot testing** for generated TypeScript output validation
82+
- **Plugin system testing** with both file and object-based plugins
83+
- **CLI integration tests** with temporary file handling
84+
- **Error scenario testing** for graceful failure handling
85+
86+
#### Examples & Documentation
87+
- **Plugin examples**: ReadonlyPlugin, CustomNumberPlugin, TypeMapperPlugin
88+
- **CLI usage examples**: Common workflows and configuration patterns
89+
- **API examples**: Programmatic usage for all major features
90+
- **Roblox integration**: Specific examples for game development workflows
91+
92+
### Technical Details
93+
- **Lexer**: 4 specialized tokenizers (Number, String, Identifier, Comment)
94+
- **Parser**: Recursive descent with operator precedence and error recovery
95+
- **Type System**: 15+ AST node types with full TypeScript definitions
96+
- **Plugin Architecture**: 4 transformation hooks (transformType, transformInterface, process, postProcess)
97+
- **CLI**: 4 main commands with configuration file support
98+
- **Exports**: Modular imports for tree-shaking and selective usage
99+
100+
This release establishes LuaTS as a production-ready tool for Lua/Luau to TypeScript workflows, with particular strength in Roblox development, legacy code integration, and type-safe API definitions.

0 commit comments

Comments
 (0)