module.exports = function (babel) {
  var t = babel.types;

  return new babel.Plugin("protect-internal-apis", {
    visitor: {
      Program: function (node, parent, scope, file) {
        if (file.opts.filename.indexOf("tools/protect") >= 0) return;
        if (file.opts.filename.indexOf("templates") >= 0) return;

        this.unshiftContainer("body", [
          t.expressionStatement(t.callExpression(file.addImport("babel-core/lib/babel/tools/protect"), [t.identifier("module")]))
        ]);
      }
    }
  });
}

@@ -1,12 +1,41 @@
+var path = require(%22path%22);%0A%0A
 module.expor
@@ -341,16 +341,212 @@
 eturn;%0A%0A
+        var from = %22/%22 + path.dirname(file.opts.filename.replace(/%5Esrc/, %22lib%22));%0A        var to   = %22/lib/babel/tools%22;%0A%0A        var protectLoc = %22./%22 + path.relative(from, to) + %22/protect.js%22;%0A%0A
         
@@ -645,44 +645,18 @@
 ort(
-%22babel-core/lib/babel/tools/
 protect
-%22
+Loc
 ), %5B

use relative tools/protect.js filenames