Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

atma-loader-ts

tenbits58MIT1.2.7TypeScript support: included

TypeScript compiler for atma-io, IncludeJS and atma-server.

readme

TypeScript Compiler (Atma Plugin)

Build Status

  • supports proper stacktrace line numbers
  • supports custom ts transformers

The Plugin extends:

  • IncludeJS with a custom loader
  • atma-io with a custom middleware to compile the TypeScript files on file read
  • atma-server and Atma Toolkit with a HTTPHandler to serve compiled sources (with sourceMap support)
Usage
Embed into the Project
  • npm i atma-loader-ts

    Update package.json with:

          {
              "dependencies": {
                  "atma-loader-ts"
              },
              "atma": {
                  "plugins": [
                      "atma-loader-ts"
                  ],
                  "settings": {
                      "atma-loader-ts": {
                          "extensions" : [ "ts" ],
                          "typescript": {
                              "compilerOptions": {
                                  // typescript compiler options
                              },
                              // Optionaly transformers
                              "transformers": {
                                  "before": ["foo"],
                                  "after": ["bar"]
                              }
                          }
                      }
                  }
              }
          }
  • That's it. Now, you are ready to use TypeScript in your project
Quick Try
  • install atma: $ npm install atma -g
  • install plugin: $ atma plugin install atma-loader-ts --save
  • add test.html to the directory

      <!DOCTYPE html>
      <script src='test.ts'></script>
  • add test.ts

      function log(msg: string) {
          console.log(msg.toUpperCase());
      }
      setInterval(() => log('works'), 200);
  • start the server: $ atma server
  • open the browser: http://localhost:5777/test.html

Transformers example

For the example, we will use nameof transformer: ts-nameof

  1. Install the transformer

    npm install ts-nameof @types/ts-nameof --save-dev
  2. Locate your ts configuration and add to the root

    {
     "compilerOptions": {
    
     },
     "transformers": {
         "before": ["ts-nameof"]
     }
    }

The MIT License