Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

karma-typescript-es6-transform

Package Overview
Dependencies
Maintainers
2
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

karma-typescript-es6-transform

Plugin for transforming ES2015 javascript code to to ES5 syntax.

  • 5.5.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5K
decreased by-52.29%
Maintainers
2
Weekly downloads
 
Created
Source

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: [["@babel/preset-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: [
                    ["@babel/preset-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-2021 Erik Barke, Monounity

Keywords

FAQs

Package last updated on 01 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc