JSPM

  • Created
  • Published
  • Downloads 18864
  • Score
    100M100P100Q149726F
  • License MIT

Plugin for transforming ES2015 javascript code to to ES5 syntax.

Package Exports

  • karma-typescript-es6-transform

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (karma-typescript-es6-transform) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

karma-typescript-es6-transform

Npm version Travis build status Appveyor build status

Karma-Typescript ❤️ 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: ["es2015"] 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: ["es2016"]})
        ]
    }
}

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 traversing the AST, and if any export or import statements are found the code will be transformed to ES5 syntax.

Licensing

This software is licensed with the MIT license.

© 2016-2017 Erik Barke, Monounity