diff --git a/src/babel/transformation/file/index.js b/src/babel/transformation/file/index.js index a3ed081aad..c053910ad8 100644 --- a/src/babel/transformation/file/index.js +++ b/src/babel/transformation/file/index.js @@ -87,8 +87,8 @@ export default class File { ]; static soloHelpers = [ - "proxy-create", - "proxy-directory" + "ludicrous-proxy-create", + "ludicrous-proxy-directory" ]; static options = require("./options"); diff --git a/src/babel/transformation/templates/ludicrous-in.js b/src/babel/transformation/templates/helper-ludicrous-in.js similarity index 100% rename from src/babel/transformation/templates/ludicrous-in.js rename to src/babel/transformation/templates/helper-ludicrous-in.js diff --git a/src/babel/transformation/templates/helper-proxy-create.js b/src/babel/transformation/templates/helper-ludicrous-proxy-create.js similarity index 100% rename from src/babel/transformation/templates/helper-proxy-create.js rename to src/babel/transformation/templates/helper-ludicrous-proxy-create.js diff --git a/src/babel/transformation/templates/helper-proxy-directory.js b/src/babel/transformation/templates/helper-ludicrous-proxy-directory.js similarity index 100% rename from src/babel/transformation/templates/helper-proxy-directory.js rename to src/babel/transformation/templates/helper-ludicrous-proxy-directory.js diff --git a/src/babel/transformation/transformers/es6/proxies.js b/src/babel/transformation/transformers/es6/proxies.js deleted file mode 100644 index 918a9722bf..0000000000 --- a/src/babel/transformation/transformers/es6/proxies.js +++ /dev/null @@ -1,43 +0,0 @@ -import * as t from "../../../types"; - -export var metadata = { - optional: true -}; - -// foo.bar -export function MemberExpression(node) { - -} - -// Object.setPrototypeOf -// Object.preventExtensions -// Object.keys -// Object.isExtensible -// Object.getOwnPropertyDescriptor -// Object.defineProperty -export function CallExpression(node) { - -} - -// delete foo.bar -export function UnaryExpression(node) { - -} - -// foo in bar -export function BinaryExpression(node) { - -} - -export function AssignmentExpression(node) { - -} - -// new Proxy -export function NewExpression(node, parent, scope, file) { - if (this.get("callee").isIdentifier({ name: "Proxy" })) { - return t.callExpression(file.addHelper("proxy-create"), [node.arguments[0], file.addHelper("proxy-directory")]); - } else { - // possible proxy constructor - } -} diff --git a/src/babel/transformation/transformers/index.js b/src/babel/transformation/transformers/index.js index 7b9f8f0b87..5d94722f50 100644 --- a/src/babel/transformation/transformers/index.js +++ b/src/babel/transformation/transformers/index.js @@ -3,7 +3,6 @@ export default { "es7.trailingFunctionCommas": require("./es7/trailing-function-commas"), "es7.asyncFunctions": require("./es7/async-functions"), "es7.decorators": require("./es7/decorators"), - "es6.proxies": require("./es6/proxies"), strict: require("./other/strict"), diff --git a/src/babel/transformation/transformers/other/ludicrous.js b/src/babel/transformation/transformers/other/ludicrous.js index e240018e47..d2c56bb118 100644 --- a/src/babel/transformation/transformers/other/ludicrous.js +++ b/src/babel/transformation/transformers/other/ludicrous.js @@ -5,6 +5,7 @@ export var metadata = { optional: true }; +// foo in bar export function BinaryExpression(node) { if (node.operator === "in") { return util.template("ludicrous-in", { @@ -14,6 +15,7 @@ export function BinaryExpression(node) { } } +// { 1: "foo" } export function Property(node) { var key = node.key; if (t.isLiteral(key) && typeof key.value === "number") { @@ -21,9 +23,44 @@ export function Property(node) { } } +// /foobar/g export function Literal(node) { if (node.regex) { node.regex.pattern = "foobar"; node.regex.flags = ""; } } + +// foo.bar +export function MemberExpression(node) { + +} + +// Object.setPrototypeOf +// Object.preventExtensions +// Object.keys +// Object.isExtensible +// Object.getOwnPropertyDescriptor +// Object.defineProperty +export function CallExpression(node) { + +} + +// delete foo.bar +export function UnaryExpression(node) { + +} + +// foo.bar = bar; +export function AssignmentExpression(node) { + +} + +// new Proxy +export function NewExpression(node, parent, scope, file) { + if (this.get("callee").isIdentifier({ name: "Proxy" })) { + return t.callExpression(file.addHelper("proxy-create"), [node.arguments[0], file.addHelper("proxy-directory")]); + } else { + // possible proxy constructor + } +} diff --git a/test/core/fixtures/transformation/es6.proxies/options.json b/test/core/fixtures/transformation/es6.proxies/options.json deleted file mode 100644 index 84b1a52d53..0000000000 --- a/test/core/fixtures/transformation/es6.proxies/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "optional": ["es6.proxies"] -} diff --git a/test/core/fixtures/transformation/ludicrous/options.json b/test/core/fixtures/transformation/ludicrous/options.json new file mode 100644 index 0000000000..9bc9970d20 --- /dev/null +++ b/test/core/fixtures/transformation/ludicrous/options.json @@ -0,0 +1,3 @@ +{ + "optional": ["ludicrous"] +} diff --git a/test/core/fixtures/transformation/es6.proxies/apply-handler.js b/test/core/fixtures/transformation/ludicrous/proxy-apply-handler.js similarity index 100% rename from test/core/fixtures/transformation/es6.proxies/apply-handler.js rename to test/core/fixtures/transformation/ludicrous/proxy-apply-handler.js diff --git a/test/core/fixtures/transformation/es6.proxies/construct-handler.js b/test/core/fixtures/transformation/ludicrous/proxy-construct-handler.js similarity index 100% rename from test/core/fixtures/transformation/es6.proxies/construct-handler.js rename to test/core/fixtures/transformation/ludicrous/proxy-construct-handler.js diff --git a/test/core/fixtures/transformation/es6.proxies/define-property-handler.js b/test/core/fixtures/transformation/ludicrous/proxy-define-property-handler.js similarity index 100% rename from test/core/fixtures/transformation/es6.proxies/define-property-handler.js rename to test/core/fixtures/transformation/ludicrous/proxy-define-property-handler.js diff --git a/test/core/fixtures/transformation/es6.proxies/delete-property-handler.js b/test/core/fixtures/transformation/ludicrous/proxy-delete-property-handler.js similarity index 100% rename from test/core/fixtures/transformation/es6.proxies/delete-property-handler.js rename to test/core/fixtures/transformation/ludicrous/proxy-delete-property-handler.js diff --git a/test/core/fixtures/transformation/es6.proxies/enumerate-handler.js b/test/core/fixtures/transformation/ludicrous/proxy-enumerate-handler.js similarity index 100% rename from test/core/fixtures/transformation/es6.proxies/enumerate-handler.js rename to test/core/fixtures/transformation/ludicrous/proxy-enumerate-handler.js diff --git a/test/core/fixtures/transformation/es6.proxies/get-handler-instance-of-proxies.js b/test/core/fixtures/transformation/ludicrous/proxy-get-handler-instance-of-proxies.js similarity index 100% rename from test/core/fixtures/transformation/es6.proxies/get-handler-instance-of-proxies.js rename to test/core/fixtures/transformation/ludicrous/proxy-get-handler-instance-of-proxies.js diff --git a/test/core/fixtures/transformation/es6.proxies/get-handler.js b/test/core/fixtures/transformation/ludicrous/proxy-get-handler.js similarity index 100% rename from test/core/fixtures/transformation/es6.proxies/get-handler.js rename to test/core/fixtures/transformation/ludicrous/proxy-get-handler.js diff --git a/test/core/fixtures/transformation/es6.proxies/get-own-property-descriptor-handler.js b/test/core/fixtures/transformation/ludicrous/proxy-get-own-property-descriptor-handler.js similarity index 100% rename from test/core/fixtures/transformation/es6.proxies/get-own-property-descriptor-handler.js rename to test/core/fixtures/transformation/ludicrous/proxy-get-own-property-descriptor-handler.js diff --git a/test/core/fixtures/transformation/es6.proxies/get-prototype-of-handler.js b/test/core/fixtures/transformation/ludicrous/proxy-get-prototype-of-handler.js similarity index 100% rename from test/core/fixtures/transformation/es6.proxies/get-prototype-of-handler.js rename to test/core/fixtures/transformation/ludicrous/proxy-get-prototype-of-handler.js diff --git a/test/core/fixtures/transformation/es6.proxies/has-handler-instance-of-proxies.js b/test/core/fixtures/transformation/ludicrous/proxy-has-handler-instance-of-proxies.js similarity index 100% rename from test/core/fixtures/transformation/es6.proxies/has-handler-instance-of-proxies.js rename to test/core/fixtures/transformation/ludicrous/proxy-has-handler-instance-of-proxies.js diff --git a/test/core/fixtures/transformation/es6.proxies/has-handler.js b/test/core/fixtures/transformation/ludicrous/proxy-has-handler.js similarity index 100% rename from test/core/fixtures/transformation/es6.proxies/has-handler.js rename to test/core/fixtures/transformation/ludicrous/proxy-has-handler.js diff --git a/test/core/fixtures/transformation/es6.proxies/is-extensible-handler.js b/test/core/fixtures/transformation/ludicrous/proxy-is-extensible-handler.js similarity index 100% rename from test/core/fixtures/transformation/es6.proxies/is-extensible-handler.js rename to test/core/fixtures/transformation/ludicrous/proxy-is-extensible-handler.js diff --git a/test/core/fixtures/transformation/es6.proxies/own-keys-handler.js b/test/core/fixtures/transformation/ludicrous/proxy-own-keys-handler.js similarity index 100% rename from test/core/fixtures/transformation/es6.proxies/own-keys-handler.js rename to test/core/fixtures/transformation/ludicrous/proxy-own-keys-handler.js diff --git a/test/core/fixtures/transformation/es6.proxies/prevent-extensions.js b/test/core/fixtures/transformation/ludicrous/proxy-prevent-extensions.js similarity index 100% rename from test/core/fixtures/transformation/es6.proxies/prevent-extensions.js rename to test/core/fixtures/transformation/ludicrous/proxy-prevent-extensions.js diff --git a/test/core/fixtures/transformation/es6.proxies/set-handler-instance-of-proxies.js b/test/core/fixtures/transformation/ludicrous/proxy-set-handler-instance-of-proxies.js similarity index 100% rename from test/core/fixtures/transformation/es6.proxies/set-handler-instance-of-proxies.js rename to test/core/fixtures/transformation/ludicrous/proxy-set-handler-instance-of-proxies.js diff --git a/test/core/fixtures/transformation/es6.proxies/set-handler.js b/test/core/fixtures/transformation/ludicrous/proxy-set-handler.js similarity index 100% rename from test/core/fixtures/transformation/es6.proxies/set-handler.js rename to test/core/fixtures/transformation/ludicrous/proxy-set-handler.js diff --git a/test/core/fixtures/transformation/es6.proxies/set-prototype-of-handler.js b/test/core/fixtures/transformation/ludicrous/proxy-set-prototype-of-handler.js similarity index 100% rename from test/core/fixtures/transformation/es6.proxies/set-prototype-of-handler.js rename to test/core/fixtures/transformation/ludicrous/proxy-set-prototype-of-handler.js