Skip to content

Releases: mint-lang/mint

0.6.0

30 Oct 11:42
Compare
Choose a tag to compare

Breaking Changes

  • References of elements and components now return a Maybe
  • Remove pre defined global styles from the generated HTML #125
  • Type variables are not allow in component properties and records
  • Record definitions are needed for records except records for encode

New Features

  • Improvements for the style tag #140 #128
  • String interpolation #141
  • Implemented member access function for records:
    object = Maybe::Just({
      name: "Joe"
    })
    Maybe.map(.name) /* Maybe::Just("Joe") */
  • Implemented safe operators (&. and &() for dealing with Maybe in specific cases:
    Maybe::Just({ name: "Joe" })&.name /* Maybe::Just("Joe") */
    Maybe::Just(() : String { "Joe" })&() /* Maybe::Just("Joe") */
  • Implement static and runtime type checking for route parameters #134

Changes

  • Add chromium as recognized executable name for test runner #116
  • Allow namespaces in HTML attributes #119
  • Allow string style attributes on elements
  • Allow function recursion by using it's static type definition
  • Allow decoding time from a number (unix timestamp) #137
  • Allow decoding Object as itself
  • Parenthesize JS interpolated values to avoid confusion #135
  • Serve files from baked files and public folder with right mime types #129
  • Don't generate links for icons if there aren't any #126
  • Replace native Maybe and Result implementations with enums #133
  • Use static recrod of a component when accessing it as a ref

Bugfixes:

  • Fix formatting of multiline strings #129
  • Fix readonly attribute compiling
  • Fix crash with remainder % operator

Core

  • Added Array.sumBy
  • Added Array.sum
  • Added Dom.focusWhenVisible
  • Added Dom.contains
  • Added Number.format
  • Added String.replace
  • Added Test.Html.assertActiveElement
  • Added Set.size
  • Fix some Set functions
  • Fix Time.month and Time.year comment
  • Fix Array.indexBy by adding tests and using interpolation

0.5.0

15 Apr 06:44
Compare
Choose a tag to compare
0.5.0 Pre-release
Pre-release

JavaScript output optimizations

All generated JavaScript code is now optimized in the following way:

  • top level entity names are now mangled (Components, Stores, Modules, etc.)
  • entity level names are now mangled
  • white space is removed from the generated code (build only)
  • the CSS selectors and variables are now mangled

This change means that inlined JavaScripts no longer can access arguments by name.

This will result in a runtime error because the argument message is mangled:

fun log (message : String) : Void {
  `console.log(message)`
}

To fix this we need to interpolate the argument:

fun log (message : String) : Void {
  `console.log(#{message})`
}

Calls on expressions

Previously the calls to functions were implemented in two forms: call on a
variable and call on a module function.

This meant that calling a function which
is in a record or which is a result of a function call were not possible.

This release makes it possible to make a call on the result of an expression.

This is an example which raises in error in 0.4.0 but compiles properly in 0.5.0:

module Test {
  fun a (message : String) : Function(String) {
    () : String => { message }
  }

  fun b : String {
    a("Hello")()
  }

  fun c : String {
    try {
      record = {
        function = (message : String) : String => { message }
      }

      record.message("Hello")
    }
  }
}

Partial Application

Functions now can be partially applied by calling them with less arguments than
needed.

An example of using partial application:

/* Format a number by thousands, output: 1,000,000 */

"1000000"
|> String.split("")
|> Array.groupsOfFromEnd(3)
|> Array.map(String.join(""))
|> String.join(",")

/* 
  The argument String.join("") (to Array.map) is a partially applied function
  where it's type is Function(Array(String), String)
*/

Warning for unknown CSS properties

CSS properties are now checked against a list and will result in an error if
they are not in the list.

Changes

  • Fixed array access ([]) when an expression is used as an index
  • Default values of properties are now only calculated once when the component is initialized
  • Providers can now be accessed the same a stores, or modules for introspection
  • Records now can be created without type definition. Such records have a temporary type definition created for them during type checking
  • [Runtime] Functions are bound to components and modules only once (in the constructor) instead of using .bind every time they are called

Formatter

  • Inline functions can now be forced to format the body on a new line by adding
    a line break after the opening bracket {
  • Properties can now be forced to format the default values on a new line by
    adding a line break after the equal sign =
  • Added missing formatter for array access ([])

Core

  • Added Array.groupsOfFromEnd which is the same as Array.groupsOf but grouping from the end
  • Added Array.indexBy to get an items index by a function
  • Added Http.requests for inspection purposes
  • Added String.rchop
  • Added String.lchop
  • Html.Event is now wrapped in an actual record, so it can now be safely used in sequence or parallel expression

0.4.0

23 Feb 11:27
Compare
Choose a tag to compare
0.4.0 Pre-release
Pre-release

Breaking Changes

  • Removed => from inline functions
  • mint-core package is now included in the binary (no longer needed as a dependency)

Features

  • Added --skip-service-worker flag to skip generation of service worker #96
  • Added for expression to allow iterating over some types #110
  • Added ability to expose an item of a store with a different name (connect X exposing { y as z })
  • Added formatter-config field in mint.json to allow setting indent-size #10
  • Implemented language feature for loading environment variables using the @VARIABLE syntax
  • Implemented Dead Code Elimination #98
  • Implemented JavaScript interpolation using the #{...} syntax
  • Implemented referencing childen of a component #108
  • Allow passing Map(String, String) to the style attribute of an element.

Bugfixes / Improvements

  • Raise proper exception when parsing type. #95
  • Allow hash to be matched in routes #101
  • Allow whitespace at the end of parameter list of inline function
  • Allow whitespace between parentheses of if condition #100
  • Allow functions without the event parameter to be passed to event attributes.
  • Added progress bar about parsing files in the CLI
  • The type checker now checks for naming conflicts of Types and Enums
  • Added formatter for array access.
  • Automatically break connect exposes if there is at least new line between them.
  • Don't automatically split long strings only if they are split at least once.

0.3.1

10 Sep 08:21
Compare
Choose a tag to compare
0.3.1 Pre-release
Pre-release

Fixes for the PWA (Progressive Web App) building process.

0.3.0

09 Sep 09:05
66277c0
Compare
Choose a tag to compare
0.3.0 Pre-release
Pre-release

Breaking changes

  • do has been removed
  • Variable shadowing are not allowed and will result in a type error

Language features

  • Added sequence and parallel for better asynchronous task handling
  • Enums now can have parameters and can now be destructured in case statements (essentially they become type ADTs) #71
  • else if can be written now #72
  • Added empty catch to catch all errors #69
  • Added version command to the CLI #80
  • Added type checks for case branches
  • Added support for encoding and decoding Map
  • Added initial support for progressive web apps (PWA) by caching all files for offline use
  • encode can now encode records which have no associated type

Smaller features / bug fixes

  • Fixed typo in build command
  • Block comment improvements #89
  • Fix error on project initialization #87
  • Allow specifing dependencies without the .git extension #77
  • Generate icons in more sizes
  • Correctly format empty fragments <></>
  • Break function arguments into separate lines if they would result in long lines
  • Don't raise initial parsing error when running the development server
  • Fix incorrect resolving of function type
  • Removed Void type restriction from route

Misc

  • Crystal 0.26 support
  • Use underscores to avoid style name conflicts
  • Added contributing guide

0.2.1

17 Aug 16:27
Compare
Choose a tag to compare
0.2.1 Pre-release
Pre-release

Bugfixes

  • Detect recursion during type checking #20
  • Typo fixes in messages #64 ce341f8
  • Property resolve the type of a state #67
  • Fix for the decode statement #68

Misc

  • Updates for the latest version of Crystal (0.26)
  • Added "What makes Mint unique?" question to FAQ in the readme 32d743b
  • Correct a link to project contributors in the readme #66

0.2.0

30 Jul 11:42
Compare
Choose a tag to compare
0.2.0 Pre-release
Pre-release

Breaking changes

  • Anonymous functions now have a new syntax #62
  • In record definitions the from keyword has been renamed to using and
    the decode keyword now honors it #51
  • The state keyword has been changed to be more in line with property #59
  • Stores are now using the state keyword instead of property

Language features

  • Implemented array access #52
  • Implemented html fragments #63
  • Computed functions (get) now can have a where clause just like functions #49

Smaller features / fixes

  • Added --relative flag to the build command #11
  • Added timeout to port checking in development server which fixes an issue on WSL #54

0.1.0

05 Jul 12:48
Compare
Choose a tag to compare
0.1.0 Pre-release
Pre-release

Bigger features:

  • Added comments with the following syntax /* This is a comment */ 🎉
  • Added mint docs command to start a documentation server where you can browse the documentation of the current application / package and all of it's installed packages. 📖
  • Changed the implementation of the type checker to use the Hindley Milner algorithm. This results in a more stable type checking phase.
  • In the mint.json file external JavaScripts can now be specified using external-javascripts field.
    These files are compiled in the head of the bundle.
  • encode keyword is now implemented to convert values to an Object, this is the counterpart of the decode keyword

Small features / fixes:

  • Fixed a bug during the build process related to sub directories in the public folder #38
  • mint init now works on existing directories #39 (thanks to @manveru)
  • There is a nice error message when dependencies are not installed #40 (thanks to @manveru)
  • Added default tests cases to the scaffolded project #41 (thanks to @manveru)
  • Make the test runner work in osx.
  • Fix a bug in where module calls are not scoped to the module / store.

0.0.4

17 Jun 04:34
Compare
Choose a tag to compare
0.0.4 Pre-release
Pre-release
  • Added naive implementation for recursive call checking
  • Added type caching in type checking phase in order to avoid visiting nodes multiple times
  • Added format command to the CLI to format files
  • with is now parsed with whitespace to be more consistent with other constructs #32
  • Arrays can now be passed to attributes without brackets #33
  • Updated to Crystal 0.25

0.0.3

06 Jun 09:15
4d36872
Compare
Choose a tag to compare
0.0.3 Pre-release
Pre-release
  • Allow computed properties on store #25
  • Added decode syntax for decoding primitive structures #23
  • Always default meta charset to UTF-8 #27