1.2.7 • Published 11 months ago

atma-loader-ts v1.2.7

Weekly downloads
3
License
MIT
Repository
github
Last release
11 months ago

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
  1. Locate your ts configuration and add to the root
{
    "compilerOptions": {

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

The MIT License

1.2.7

11 months ago

1.2.6

11 months ago

1.2.4

12 months ago

1.2.3

12 months ago

1.2.2

12 months ago

1.2.1

12 months ago

1.1.20

2 years ago

1.1.19

3 years ago

1.1.18

3 years ago

1.1.17

3 years ago

1.1.16

4 years ago

1.1.15

4 years ago

1.1.14

4 years ago

1.1.12

6 years ago

1.1.11

7 years ago

1.1.9

7 years ago

1.1.7

7 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

8 years ago