Elixirscript Versions Save

Converts Elixir to JavaScript

v0.23.0

7 years ago

[0.23.0] - 2016-11-15

Added

  • with now supports else

  • Implement context option on quote

  • New compiler pipeline

  • @on_js_load. Expects a 0 arity function. This function will be called when the compiled module is loaded in JavaScript

  • JS.import\3. Just like JS.import\2 but expects options to decide if the import should be a default one or a namespace on. Only option allowed is default. Set to true by default

    # translates to "import A from 'a'"
    JS.import A, "a"
    
    #translates to "import * as A from 'a'"
    JS.import A, "a", default: false
    

Removed

  • The form of JS.import that accepted a list of atoms as the first arg. Used JS.import\3 with default: false instead to create a namespace import
  • env and root are no longer options for ElixirScript's compile functions and cli
  • Syntax once supported by Elixirscript JQuery.("#element"), is no longer supported

Changed

  • Changed CHANGELOG.md to adhere the format from Keep a Changelog

  • defmacro now supported. No longer have to separate macros from functions in separate files. defmacrop still unsupported

  • To use anything in the JS module, you must require the JS module first

  • Elixirscript files must now contain valid Elixir syntax.

  • Now compiles exjs and ex files within the path can be compiled all the same. Dependencies from hex are still unsupported so these files must not rely on any code outside of the path. What this does mean is that it is now possible to share code between Elixir and Elixirscript as long as the Elixir files functionality fall within what Elixirscript currently supports.

  • defgen, defgenp, yield, yield_to, and object are now in the JS module

  • To access functions in the global JavaScript scope, either use JS.global\0 or use the erlang module call syntax

    #calling alert
    JS.global().alert("hi")
    
    #calling alert
    :window.alert("hi")
    

    Calling JavaScript modules in the global scope works without using the above methods

    #calls window.Date.now()
    Date.now()
    

v0.22.0

7 years ago
  • Enhancements
    • Add defgen and defgenp for defining public and private generators
    • Add yield/0, yield/1, and yield_to\1 to Kernel
    • Updated output folder structure. stdlib code will now go in an elxiir folder under the output paths while generated app code will go into an app folder under the output path
  • Breaking
    • All process macros and functions now expect to receive and/or work using generators as entry points. Using functions defined with def or defp will not work correctly with them
  • Bug fixes
    • Correctly returning list if list is only item in body

v0.21.0

7 years ago

v0.21.0

  • Enhancements
    • This is the first release with early support for processes in elixirscript. Creating a process only works currently using spawn/1, spawn_link/1, and spawn_monitor/1. Inside of a process, you can use functions such as send and receive, along with some defined in the Process module. From outside of a process, you can send messages to a process, but you cannot receive a message from a process. Eventually all code will run inside processes and this restriction will naturally lift.
    • The Process module has been implemented with the following functions:
      • alive?/1
      • delete/1
      • demonitor/1
      • exit/2
      • flag/2
      • flag/3
      • get/0
      • get_keys/0
      • get_keys/1
      • link/1
      • list/0
      • monitor/1
      • put/2
      • register/2
      • registered/0
      • send/3
      • sleep/1
      • unlink/1
      • unregister/1
      • whereis/1
    • The receive special form has been implemented with the above caveat
    • The following have been implemented on Kernel:
      • spawn/1
      • spawn_link/1
      • spawn_monitor/1
      • send/2
      • make_ref/0

v0.20.0

8 years ago
  • Enhancements
    • Add ElixirScript.Watcher module and elixirscript.watch mix task
    • Add logging MatchError exceptions to better show terms that don't match

v0.19.0

8 years ago
  • Enhancements
    • Added elixir_script mix compiler
  • Breaking
    • Html, View, and VDom modules have been removed

v0.18.0

8 years ago
  • Enhancements
    • Better support for macros. Macros should be defined in .ex or .exs files. ElixirScript code should be in .exjs files
  • Breaking
    • The above functionality will cause either compiler errors or no output. Please change extensions of ElixirScript code to .exjs
  • Deprecations
    • Html, View, and VDom modules will be removed in the next version as they can now be replicated using macros

v0.17.0

8 years ago
  • Enhancements
    • Incremental Compilation: ElixirScript will now only build files and modules that have changed since the last build
    • Added output as an option for compiler functions. This controls whether output is returned as a list of tuples, send to stdout, or saved to a file path
    • Added :full_build as an option for compiler functions and --full-build option to CLI. These force the compiler to perform a full build
    • Added --version option to CLI. Outputs current version of elixirscript
    • Added --std-lib option to CLI. Takes a path and adds the stdlib to that path
  • Breaking
    • Removed --core option from CLI and :core compiler option.
    • Renamed copy_core_to_destination to copy_stdlib_to_destination

v0.16.0

8 years ago
  • Enhancements
    • Bitstring pattern matching

    • Bitstrings in for comprehensions

    • Functions with catch, after, else clauses

    • with special form

    • Pin operator in map keys and function clauses

    • Added Kernel.object/1 function to make it more natural to create a JavaScript object with string keys Elixirscript, by default turns the following, %{a: "b"} into {[Symbol.for("a")]: "b"} in JavaScript. In order to get string keys, one would have to do %{"a" => "b"} which turns into {a: "b"} in JavaScript. With Kernel.object, you can create string keyed maps conveniently, object(a: "b") which turns into {a: "b"}.

      NOTE: when updating the created by, you still have to use the string form %{ my_map | "a" => "c" }

  • Bugfixes
    • Optional parameters should now work as expected
  • Breaking
    • JS.update(object, property, value) has been removed and replaced with JS.update(object, map) This allows you to update multiple values on a javascript object at once.

v0.15.2

8 years ago
  • Enhancements
    • Support for variables as map keys
  • Bug fixes
    • Fixed protocol implementations for Integer and Float which where not recognized
    • Fixed calling properties on non-objects

v0.15.1

8 years ago
  • Bug fixes
    • Fixed View module so that an element can have multiple elements within
    • Removed catch as a javascript keyword to filter
    • Fixed struct implementation so that lists of atoms for fields are compiled correctly
    • Fixed head-tail pattern match to allow for more complicated scenarios
    • Fixed ModuleCollector to properly alias inner modules
    • Fixed raise translation to properly translate when string messages are given