New Features
Command Line Improvements
- Switched from alt_getopt to argparse - Both
moonandmooncnow use argparse for argument parsing, providing better help messages via--helpand more robust option handling - Added
-e/--executeflag tomoon- Execute MoonScript code directly from the command line:moon -e "print 'Hello World'" - New
--transformoption formoonc- Allows custom AST transformations before compilation by specifying a module that receives and returns the syntax tree - Improved
-(stdin) handling - Now properly enforces that-must be the only argument
moonc Option Renames
-wis now also available as--watch-lis now also available as--lint-tis now also available as--output-to
New Tools
- moon-tags - New script for generating ctags-compatible tag files for MoonScript, with support for:
- Class definitions
- Class methods
- Top-level function definitions (exported via
{:func}pattern) - Lapis route detection (
--lapisflag) - Optional line numbers (
--include-lineflag) - Optionally skip header (
--no-headerflag)
Utility Improvements
moon.p()now prints multiple arguments - Pass multiple values and each will be dumpedutil.dumpshows class names - When dumping objects, the class name is displayed (e.g.,<MyClass>{...})
Compiler Enhancements
- Lua keyword property access on self - Properties with Lua keyword names (like
@thenor@@then) now compile correctly using bracket notation instead of invalidself.then
Bug Fixes
- Fixed ambiguous Lua generation after
import- Semicolons are now correctly inserted when the next line starts with(, preventing parsing ambiguity - Fixed update operators with complex chain indexes - Expressions like
a[func()].x += 1now correctly lift the index expression to avoid double evaluation - Exit with proper error code -
moonnow exits with code 1 when the executed script fails - Fixed
moonc -- Reading from stdin now works correctly - Removed accidental debug print - Removed stray
print file, timein watcher code dump.treereturns string - Now returns the string instead of printing directly- Removed noisy "Built" message - Single file compilation no longer prints "Built" to stderr
Internal Changes
- Migrated CI from Travis to GitHub Actions
- Added comprehensive compiler and transform specs
- Improved binary building workflow for Windows and Linux
- Better error messages for invalid destructure assignments
- Updated
splat.moonto use argparse, added--strip-prefixoption