karma-typescript-es6-transform
Plugin for transforming ES2015 javascript code to to ES5 syntax.
Last updated 4 months ago by erikbarke .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install karma-typescript-es6-transform 
SYNC missed versions from official npm registry.

karma-typescript-es6-transform

Npm Version Npm Total Downloads Travis Status Appveyor Status

Karma-Typescript :heart: ES2015

This plugin uses the Babel compiler to transform ES2015 (aka ES6) code to ES5 syntax, making the code browser compatible when running tests with karma-typescript.

Installation

$ npm install --save-dev karma-typescript-es6-transform

Configuration

In the karma-typescript section of karma.conf.js:

karmaTypescriptConfig: {
    bundlerOptions: {
        transforms: [
            require("karma-typescript-es6-transform")()
        ]
    }
}

Babel core options

By default, the options presets: [["env"]] and filename: TransformContext.filename are passed to the Babel compiler.

Custom options can be passed to the compiler in the first argument when calling the plugin:

karmaTypescriptConfig: {
    bundlerOptions: {
        transforms: [
            require("karma-typescript-es6-transform")({
                presets: [
                    ["env", {
                        targets: {
                            chrome: "60"
                        }
                    }]
                ]
            })
        ]
    }
}

Passing custom presets or filename options will override the default settings.

ES2015 syntax detection

The javascript code passed to the plugin is statically analyzed by recursively traversing the AST, looking for these ES2015 keywords: class, const, export, import, let. If any keyword or a fat arrow function is found the code will be transformed to ES5 syntax.

Licensing

This software is licensed with the MIT license.

© 2016-2019 Erik Barke, Monounity

Current Tags

  • 5.0.0-beta.0                                ...           beta (2 months ago)
  • 4.1.1                                ...           latest (4 months ago)

18 Versions

  • 5.0.0-beta.0                                ...           2 months ago
  • 4.1.1                                ...           4 months ago
  • 4.1.0                                ...           5 months ago
  • 4.0.0                                ...           9 months ago
  • 4.0.0-beta.3                                ...           10 months ago
  • 4.0.0-beta.2                                ...           10 months ago
  • 4.0.0-beta.1                                ...           a year ago
  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           3 years ago
  • 1.0.0-beta.6                                ...           3 years ago
  • 1.0.0-beta.5                                ...           3 years ago
  • 1.0.0-beta.4                                ...           3 years ago
  • 1.0.0-beta.3                                ...           3 years ago
  • 1.0.0-beta.2                                ...           3 years ago
  • 1.0.0-beta.1                                ...           3 years ago
Maintainers (2)
Downloads
Today 1
This Week 2
This Month 46
Last Day 1
Last Week 41
Last Month 77
Dependencies (6)
Dev Dependencies (15)

Copyright 2014 - 2016 © taobao.org |