babel-plugin-aexpr-source-transformation
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -10,2 +10,3 @@ "use strict"; | ||
var template = param.template; | ||
var traverse = param.traverse; | ||
@@ -74,3 +75,14 @@ console.log(arguments); | ||
pre: function pre(file) { | ||
console.log("fff", file); | ||
console.log("fff", file, traverse); | ||
traverse(file.ast, { | ||
enter: function enter(path) { | ||
if (path.node.leadingComments && path.node.leadingComments.some(function (comment) { | ||
return comment.value.includes(IGNORE_STRING); | ||
})) { | ||
console.log("IGNORED!!!"); | ||
file[IGNORE_INDICATOR] = true; | ||
} | ||
} | ||
}); | ||
}, | ||
@@ -81,7 +93,10 @@ | ||
enter: function enter(path, state) { | ||
console.log("file", path); | ||
//state.file.addImport("aexpr-source-transformation-propagation21", "aexpr"); | ||
console.log("file", path, state); | ||
if (state.file[IGNORE_INDICATOR]) { | ||
console.log("read ignored");return; | ||
}; | ||
path.traverse({ | ||
Identifier: function Identifier(path) { | ||
console.log(path.node.name); | ||
//console.log(path.node.name) | ||
// Check for a call to aexpr: | ||
@@ -292,2 +307,5 @@ if (t.isCallExpression(path.parent) && path.node.name === AEXPR_IDENTIFIER_NAME && !path.scope.hasBinding(AEXPR_IDENTIFIER_NAME)) { | ||
var IGNORE_STRING = "aexpr ignore"; | ||
var IGNORE_INDICATOR = Symbol("aexpr ignore"); | ||
// const SET_LOCAL = "setLocal"; | ||
@@ -294,0 +312,0 @@ // const GET_LOCAL = "getLocal"; |
26
index.js
@@ -7,2 +7,5 @@ const AEXPR_IDENTIFIER_NAME = "aexpr"; | ||
const IGNORE_STRING = "aexpr ignore"; | ||
const IGNORE_INDICATOR = Symbol("aexpr ignore"); | ||
// const SET_LOCAL = "setLocal"; | ||
@@ -15,3 +18,3 @@ // const GET_LOCAL = "getLocal"; | ||
export default function(param) { | ||
let { types: t, template } = param; | ||
let { types: t, template, traverse } = param; | ||
console.log(arguments); | ||
@@ -93,3 +96,15 @@ | ||
pre(file) { | ||
console.log("fff", file) | ||
console.log("fff", file, traverse); | ||
traverse(file.ast, { | ||
enter(path) { | ||
if ( | ||
path.node.leadingComments && | ||
path.node.leadingComments.some(comment => comment.value.includes(IGNORE_STRING)) | ||
) { | ||
console.log("IGNORED!!!") | ||
file[IGNORE_INDICATOR] = true; | ||
} | ||
} | ||
}); | ||
}, | ||
@@ -99,7 +114,8 @@ visitor: { | ||
enter(path, state) { | ||
console.log("file", path); | ||
//state.file.addImport("aexpr-source-transformation-propagation21", "aexpr"); | ||
console.log("file", path, state); | ||
if(state.file[IGNORE_INDICATOR]) { console.log("read ignored"); return; }; | ||
path.traverse({ | ||
Identifier(path) { | ||
console.log(path.node.name) | ||
//console.log(path.node.name) | ||
// Check for a call to aexpr: | ||
@@ -106,0 +122,0 @@ if( |
{ | ||
"name": "babel-plugin-aexpr-source-transformation", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "3rd implementation strategy of active expressions, via a babel transformation", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31647
688