babel-plugin-transform-proxy-compat
Babel plugin to transform code to COMPAT mode
Last updated 5 months ago by jodarove .
MIT · Original npm · Tarball · package.json
$ cnpm install babel-plugin-transform-proxy-compat 
SYNC missed versions from official npm registry.

babel-plugin-transform-proxy-compat

This babel plugin enables Proxy usage in IE 11. In order to make this work, we have to rewrite property lookups, assignments, property deletions, function invocations, in statements and for in loops to use functions in order to execute the correct proxy handlers.

Options

resolveProxyCompat

Object, default to { module: 'proxy-compat' }

Accepts either:

  • module property with a string value when the proxy APIs should be retrieved from an external module.
// Config
{
    module: 'my-proxy-compat';
}

// Result
import ProxyCompat from 'my-proxy-compat';
const callKey = ProxyCompat.callKey;
callKey(console, 'log', 'I am Compat');
  • global property with a string value when the proxy APIs should be retrieved from a global variable.
// Config
{
    global: 'MyProxyCompat';
}

// Result
const callKey = MyProxyCompat.callKey;
callKey(console, 'log', 'I am Compat');
  • independent property with a string value when the proxy APIs should be retrieved from independent modules.
// Config
{
    independent: 'my-proxy-compat';
}

// Result
import callKey from 'my-proxy-compat/callKey';
callKey(console, 'log', 'I am Compat');

Disabling compat transform with comment

It's possible to disable the proxy compat transform for a specific file using the /* proxy-compat-disable */ comment at the top of the file. This is an escape hatch for code that is performance sensitive and doesn't manipulate any Proxy. Make sure to use it extremely wisely.

/* proxy-compat-disable */

function palindrome(str) {
    return (
        str ===
        str
            .split('')
            .reverse()
            .join('')
    );
}

Current Tags

  • 0.22.1                                ...           latest (5 months ago)

10 Versions

  • 0.22.1                                ...           5 months ago
  • 0.22.0                                ...           a year ago
  • 0.21.7                                ...           a year ago
  • 0.21.5                                ...           a year ago
  • 0.21.4                                ...           2 years ago
  • 0.21.3                                ...           2 years ago
  • 0.21.2                                ...           2 years ago
  • 0.18.12                                ...           2 years ago
  • 0.21.0                                ...           2 years ago
  • 0.21.1                                ...           2 years ago
Downloads
Today 0
This Week 0
This Month 6
Last Day 0
Last Week 2
Last Month 126
Dependencies (1)
Dev Dependencies (0)
None

Copyright 2014 - 2016 © taobao.org |