@binaris/shift-babel-macro
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -5,2 +5,19 @@ { | ||
{ | ||
"version": "0.0.4", | ||
"tag": "@binaris/shift-babel-macro_v0.0.4", | ||
"date": "Thu, 18 Jul 2019 12:48:13 GMT", | ||
"comments": { | ||
"patch": [ | ||
{ | ||
"comment": "Use common module for some babel code" | ||
} | ||
], | ||
"dependency": [ | ||
{ | ||
"comment": "Updating dependency \"@binaris/shift-babel-common\" from `0.0.0` to `0.0.1`" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"version": "0.0.3", | ||
@@ -7,0 +24,0 @@ "tag": "@binaris/shift-babel-macro_v0.0.3", |
# Change Log - @binaris/shift-babel-macro | ||
This log was last generated on Tue, 09 Jul 2019 07:26:14 GMT and should not be manually modified. | ||
This log was last generated on Thu, 18 Jul 2019 12:48:13 GMT and should not be manually modified. | ||
## 0.0.4 | ||
Thu, 18 Jul 2019 12:48:13 GMT | ||
### Patches | ||
- Use common module for some babel code | ||
## 0.0.3 | ||
@@ -6,0 +13,0 @@ Tue, 09 Jul 2019 07:26:14 GMT |
@@ -8,7 +8,5 @@ "use strict"; | ||
const parser_1 = require("@babel/parser"); | ||
const shift_babel_common_1 = require("@binaris/shift-babel-common"); | ||
const fs_1 = require("fs"); | ||
const path_1 = __importDefault(require("path")); | ||
function getFunctionName(e, t) { | ||
return t.isIdentifier(e.id) ? e.id.name : undefined; | ||
} | ||
function assertExportedMember(ast, t, funcName) { | ||
@@ -19,12 +17,3 @@ // This function is looking for this line in the file | ||
const { body } = ast.program; | ||
const isFunctionExported = body.some((e) => t.isExpressionStatement(e) && | ||
t.isAssignmentExpression(e.expression) && | ||
e.expression.operator === '=' && | ||
t.isMemberExpression(e.expression.left) && | ||
t.isIdentifier(e.expression.left.object) && | ||
e.expression.left.object.name === 'exports' && | ||
t.isIdentifier(e.expression.left.property) && | ||
e.expression.left.property.name === funcName && | ||
t.isIdentifier(e.expression.right) && | ||
e.expression.right.name === funcName); | ||
const isFunctionExported = body.some((e) => shift_babel_common_1.isTypeScriptGeneratedExport(e, t, funcName)); | ||
if (!isFunctionExported) { | ||
@@ -37,6 +26,6 @@ throw new Error(`${funcName} has @expose decorator but it is not exported`); | ||
// support ExportDefaultDeclaration (ExportAllDeclaration too for re-exporting ?) | ||
const exposedStatements = body.filter((e) => e.leadingComments && e.leadingComments.some((comment) => /@expose/.test(comment.value))); | ||
const exposedStatements = body.filter(shift_babel_common_1.isExposedStatement); | ||
return exposedStatements.reduce((ret, e) => { | ||
if (t.isFunctionDeclaration(e)) { | ||
const funcName = getFunctionName(e, t); | ||
const funcName = shift_babel_common_1.getFunctionName(e, t); | ||
if (funcName && importedNames.includes(funcName)) { | ||
@@ -48,3 +37,3 @@ assertExportedMember(ast, t, funcName); | ||
else if (t.isExportNamedDeclaration(e) && t.isFunctionDeclaration(e.declaration)) { | ||
const funcName = getFunctionName(e.declaration, t); | ||
const funcName = shift_babel_common_1.getFunctionName(e.declaration, t); | ||
if (funcName) { | ||
@@ -129,1 +118,2 @@ ret.push(funcName); | ||
module.exports = babel_plugin_macros_1.createMacro(shiftMacro); | ||
//# sourceMappingURL=macro.js.map |
@@ -14,1 +14,2 @@ "use strict"; | ||
exports.bar = bar; | ||
//# sourceMappingURL=mockTypeScriptBackend.js.map |
@@ -117,1 +117,2 @@ "use strict"; | ||
}); | ||
//# sourceMappingURL=macro.spec.js.map |
{ | ||
"name": "@binaris/shift-babel-macro", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"files": [ | ||
@@ -17,7 +17,8 @@ "dist", | ||
"dependencies": { | ||
"@babel/parser": "^7.4.5", | ||
"babel-plugin-macros": "^2.6.0" | ||
"@babel/parser": "^7.5.0", | ||
"@binaris/shift-babel-common": "0.0.1", | ||
"babel-plugin-macros": "^2.6.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/types": "^7.4.4", | ||
"@babel/types": "^7.5.0", | ||
"@types/jest": "^24.0.15", | ||
@@ -29,4 +30,4 @@ "@types/node": "^10.14.9", | ||
"tslint": "^5.18.0", | ||
"typescript": "^3.5.2" | ||
"typescript": "^3.5.3" | ||
} | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
21280
21
357
0
3
+ Added@binaris/shift-babel-common@0.0.1(transitive)
Updated@babel/parser@^7.5.0
Updatedbabel-plugin-macros@^2.6.1