Releases: mint-lang/mint
0.16.0
Parser
The parser has been speeded up thanks to @asterite (#537) - it should parse twice as fast and consume half the memory in the general case.
Type Checker
- Fixed a bug in scoping #529
Bundler
- The service worker now only falls back to paths that matches any routes defined for the application @Eternahl #370 #539
Language Server
- Added
FoldingRange
provider. - Added
CodeAction
provider. - Added a code action to sort the module entities in order.
Standard Library
- Added
Math.trunc
- Added
String.padLeft
- Added
String.takeRight
Time module rewrite
The time module has been completely reworked, check the PR: #526 and the docs for more information.
Housekeeping (@Sija @gdotdesign)
- Bumped Crystal version requirement to 1.3.2
Makefile
: Build the binary only if there are changed files- Updated dependencies
0.15.3
Fixed runtime error in Clipboard.set
0.15.2
0.15.1
Fixed a regression in inline styles handling, where using an non-string attribute could lead to runtime errors (mint-lang/mint-runtime#24)
0.15.0
Language
Time
is now automatically serialized intoString
#357- Tuples now can be automatically serialized #519
- Fixed selector reference
&
in styles #479 or
operator can be used withResult(error, value)
as well
LSP
- Added basic completions for HTML tags and CSS properties #511
- Added completions for enum options #518
- Fixed cursor position lookup #481
- Fixed some compatibility issues with specific clients #493
- Honor
snippetSupport
client setting #520
CLI
- A custom runtime can be used with the
--runtime
flag for thebuild
andcompile
commands #476
Service Worker
- Fix service-worker generation issue #506
Standard Library
Clipboard.set
now returns a string and restores focus and text selection #524- Added
Time.fromUnixTimestampInMs
andTime.toUnixTimestampInMs
#522
Web Components
-
Components can now be exported as web components #501
A new field was added to the
mint.json
for this purpose:{ "name": "my-library", "web-components": { "Button": "my-button" }, "source-directories": [ "source" ] }
In the object, the key of the field refers to the component and the value refers to the tag name of the web component, in this case, the
Button
component will be exported as<my-button>
.
Housekeeping
- More cleanups and refactors by @Sija
0.14.0
Documentation Generator
- Fix documentation generation for modules.
Installer
- Eliminate versions of packages with missing or invalid
mint.json
when installing dependencies.
Compiler
-
#467 #115 Don't minimize the CSS classes in development.
Don't use these CSS classes for targeting - either with DOM or as sub styles - because they are minimized in production!
-
Update the list of valid CSS property names - @Sija
-
Fixes in the generated service worker.
Standard Library
- BREAKING CHANGE Renamed
treshold
field tothreshold
in the subscription forProvider.Intersection
. - Fixes documentation comments for some functions.
Housekeeping
- More cleanups and refactors - @Sija
- Update documentation viewer app.
0.13.1
Fixes a regression with service workers which results in the website not loading.
0.13.0
Breaking Changes
-
Enum destructuring within
case
statements now uses parentheses and commas instead of whitespaces.Given this enum:
enum Status { LoggedIn(Time, User) LoggedOut }
Destructuing before:
case (maybe) { Status::LoggedIn time user => true Status::LoggedOut => flase }
After:
case (maybe) { Status::LoggedIn(time, user) => true Status::LoggedOut => flase }
This was a necessary step to make nested destructuring work.
Language
-
#81 #451 Added line comments: 🎉
// Line comment fun render : Html { ... }
-
Added
@inline
directive which inlines a text file into Mint code asString
:@inline(path/to/file.html) /* String */
-
#418 #419 Added
index
variable to thefor
loops:/* Iterating over Array(item) or Set(item). */ for (item, index of array) { ... } /* Iterating over Map(key, value). */ for (key, value, index of map) { ... }
-
#437 Tuples can be destructured recursively (@matthewmcgarvey):
case ({"A", {"B", "C"}}) { {a, {b, c}} => c => "" }
Official Docker Image
Mint now has alpine-based Docker images hosted on DockerHub (https://hub.docker.com/r/mintlang/mint) for tags and from master (latest
).
Housekeeping
- #429 Run core tests both on Chrome and Firefox in CI.
- Run a format test on the standard library in CI.
- Added
Dockerfile
for official docker images. - Cleanup Markdown files in the repository.
- #421 #423 #424 #425 No longer depending on
string_inflection
,time_format
,time_format
shards - @matthewmcgarvey - Move inlined HTML templates to their own files.
- Lot of assorted refactors 🙏 - @Sija
Standard Library
- Fixed some typos in the documentation comments.
- #427 Fixed
Window.scrollHeight
,Window.scrollWidth
,Window.scrollLeft
,Window.scrollTop
functions in non quirks mode. - Added
File.download
function. - Added
Http.Header
record. - Added
Http.hasHeader
function. - #454 Added
Maybe.withLazyDefault
function. - #453 #460
AnimationFrame
and its provider now provides the elapsed timestamp. - #432 #438 #434
Http.jsonBody
now sets theContent-Type
header of the request toapplication/json
.
Parser
- #435 #431 Optimizations to the parser lead to significant speedups in parsing.
- #420
try
expressions now need a space after thetry
keyword. - Don't parse double equals as a statement.
Type Checker
- #403 Fix rendering of types in error messages.
Formatter
- #273 Record constructors now format into multiple lines if it contains a line break.
- Only use a single space for empty records instead of two.
- Don't format Mint code in JavaScript interpolations.
Installer
- #398 The installer now uses the force flag to checkout using Git.
- #198 Added
mint-version
field to themint.json
which specifies which Mint versions the package works on.
Language Server
- The server now exits properly instead of hanging if the client disconnects unexpectedly.
Test Runner
- #433 #436 The suite name is displayed for failing test cases.
- #441 #443 The test location (filename, line, and column) is displayed for each failing test case.
Compiler
- Fixed the compile order of constants depending on other constants.
CLI
- #408 Added
sandbox-server
command which starts a server for compiling and formatting projects using requests. - #405 Added
lint
command to lint the project for syntax and type errors. - #412 Added
--minify
,--no-minify
flags to thebuild
andcompile
commands which control whether or not to minify the output JavaScript. - #450 Show syntax errors for the
format
command. - #413 Don't generate icons if there is no icon specified.
- Added
--check
flag toformat
command, allowing to check for changes without actually modifying the files (returns with exit code 1 if there are changes) - Added
-r
,--live-reload
,--no-live-reload
flags tostart
command which controls the live reload functionality. - Building assets now respect the
--relative
flag. - Fixed
format
command without any arguments. - Fixed
test
command to return with exit code 1 if any tests fail. - Changed
version
command now returns the plain version only.
0.12.0
This release brings language server support and asset handling to Mint!
Language Server 🎉
One of the highly requested features the language server is now available using the mint ls
command.
Having this shipped allows us to incrementally implement other features such as showing errors and goto declaration / implementation.
Format on save
The files are formatted when saved if they don't contain any errors.
Hover Provider
The type information of most entities can be checked by hovering over them also, if available the documentation is displayed as well.
Completion
Completions are provided for entities in stores, components, modules and also in scope variables (depending on where to cursor is).
New App Template
A new application template has been implemented!
Language Features
The asset directive was implemented also support for constants in tests.
Asset Directive
The asset directive allows you to reference an asset (image, stylesheet, video, etc..) - relative to the current file. These assets are bundled in the production build.
component Main {
fun render : Html {
/* The image should be in the same directory as this file. */
<img src={@asset(some-image.jpg)}/>
}
}
Only those assets get bundled which are touched during type checking, for example if a component references some assets then those assets are only bundled if that component is used.
Constants in Tests
Constants can now be used in tests:
suite "Some tests" {
const VALUE = "Hello"
test "Constant equals Hello" {
VALUE == "Hello"
}
}
Runtime
- Fixed Preact to
10.4.4
(last known working version). - Don't use
shouldComponentUpdate
in components #316. - Normalize
dataTransfer
andclipboardData
fields in events. - Properly resolve page position after navigation (hash jump, scroll to top).
- Don't handle links that point out of the current frame.
Formatter
- Implemented missing CSS keyframes formatter.
- Properly format Html body when there are only comments inside.
- Open modules now format properly (not duplicating entities).
- Format Html body properly if it's children has new lines.
- Format inline functions as multiline if they contain new lines.
- Format state statements as multiline if appropriate.
Housekeeping
- Crystal 1.0 compatibility.
- Builds now use the latest crystal version.
- #375 Contribution guide has been updated (@itsgreggreg).
- #383 Github actions has been improved (@Sija).
Standard Library
- Added
Map.fromArray
. - Added
String.wrap
. - Added
String.indent
. - Added
String.indentWithOptions
. - Added
Time.nextWeek
. - Added
Time.previousWeek
. - Added
Function.debounce1
. - Added
Html.Portals.Head
component. String.parameterize
now converts titlecase to dash case.Window.isActiveURL
now ignores search (query) parameters and the hash.Window.open
now works again #390.- Make sure the copy clipboard function does not scroll the page.
Minor changes / fixes
- Use
Array(Char)
instead ofString
in the parser which speeds up parsing in some cases. - #385 Rename
manifest.json
tomanifest.webmanifest
(@jonathanoberg).
Fixed issues
- #371 Case does not unify branches which can lead to unexpected behaviour.
- #372 Make sure that module functions are resolved in the proper scope.
- #373 Convert string literals in CSS values to string unless they contain interpolations.
- #376, #358 Make sure that error messages render properly.
- #381 Try now can return a result directly (@itsgreggreg).
- #366 Gracefully shut down the test runner in case of uncaught exceptions in JavaScript (@Sam647254).
0.11.0
This release focused on bug fixes, although there are some new language features.
Language Features
Regular Expression Literal #250
Mint now supports regular expression literals:
Regexp.match("abbc", /ab+c/i) == true
Open Modules #265
Modules now can be defined in multiple places allowing to define constants and functions.
module Greeter {
fun greet (name : String) {
"Hello #{name}!"
}
}
module Greeter {
fun greetPolitely (name : String) {
"Have a nice day Mr. #{name}!"
}
}
This is mostly useful if you want to extend a module in the standard library (like Array
).
Or operator
Added the or
operator as an alias to Maybe.withDefault
:
Maybe.withDefault("Hello", Maybe::Just("Value")) /* "Value" */
Maybe.withDefault("Hello", Maybe::Nothing) /* "Hello" */
Maybe::Just("Value") or "Hello" /* "Value" */
Maybe::Nothing or "Hello" /* "Hello" */
[]
access on tuples
It is now possible to use []
on tuples:
{"Name", "Joe"}[0] == "Name"
Only literal numbers are valid since it's the only way we can only determine the type.
Formatter
- Format the type signature of the inline JavaScript if given.
- Format the type signature of an array literal if given.
Housekeeping
- Moved the CI from Travis to Github actions.
Standard Library
- #288 - Added API wrapper for
DataTransfer
and addeddataTransfer
to Html.Event. - Added return types to all functions @s0kil
- Added
Array.uniq
Minor changes / fixes
- Fixed compiling of calls when the expression is an anonymous function.
- Fixed compiling of referenced html elements.
- Compile empty HTML fragments as
nil
.
Fixed issues
- #249 #319 - Disallow referencing other entities from the same top level entity in the default value of a state or property.
- #277 - Added
clean
command to delete compiler and package artifacts @s0kil - #278 - Format code from STDIN if
--stdin
flag is passed @s0kil - #302 - Added error message for ambiguous pipe operators
- #305 - Allow parsing string literals in css definitions
- #317 - Throw error when record does not have a record definition @s0kil
- #320 - Set
manifest.json
as relative path when--relative
flag is set @s0kil - #326 - Refactor encoding to be explicit
- #327 - Confusing error when trying to add styles to custom components @matthewmcgarvey
- #330 - Make sure inlined variable names are not conflicting with generated ones
- #332 - Add the record type as the last parameter in record constructor functions
- #338 - Allow trailing comment in record definitions.
- #339 - Better error message for
NextCallStateTypeMismatch
@s0kil - #341 - Update documentation viewer to handle inferred types @s0kil
- #349 - Allow prefixing CSS classes using
mint.json