edge-parser
Advanced tools
Comparing version 5.1.6 to 5.2.0
@@ -27,2 +27,4 @@ export { Stack } from './src/Stack'; | ||
NewExpression: "NewExpression"; | ||
BlockStatement: "BlockStatement"; | ||
ReturnStatement: "ReturnStatement"; | ||
}; |
@@ -0,4 +1,5 @@ | ||
import { Parser } from '../Parser'; | ||
declare const _default: { | ||
toStatement(statement: any): any; | ||
toStatement(statement: any, filename: string, parser: Parser): any; | ||
}; | ||
export default _default; |
@@ -11,6 +11,23 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const transformAst_1 = require("../Parser/transformAst"); | ||
exports.default = { | ||
toStatement(statement) { | ||
toStatement(statement, filename, parser) { | ||
parser.stack.defineScope(); | ||
statement.params.forEach((param) => { | ||
if (param.type === 'Identifier') { | ||
parser.stack.defineVariable(param.name); | ||
} | ||
else if (param.type === 'ObjectPattern') { | ||
parser.utils.collectObjectExpressionProperties(param).forEach((prop) => { | ||
parser.stack.defineVariable(prop); | ||
}); | ||
} | ||
else { | ||
throw new Error(`Report this error to the maintainers: Expected Arrow function params to be an identifier. Instead received ${param.type}`); | ||
} | ||
}); | ||
statement.body = transformAst_1.transformAst(statement.body, filename, parser); | ||
parser.stack.clearScope(); | ||
return statement; | ||
}, | ||
}; |
@@ -19,1 +19,3 @@ export { default as Identifier } from './Identifier'; | ||
export { default as NewExpression } from './NewExpression'; | ||
export { default as BlockStatement } from './BlockStatement'; | ||
export { default as ReturnStatement } from './ReturnStatement'; |
@@ -14,3 +14,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.NewExpression = exports.AwaitExpression = exports.AssignmentExpression = exports.SequenceExpression = exports.LogicalExpression = exports.ConditionalExpression = exports.FunctionDeclaration = exports.UnaryExpression = exports.ObjectExpression = exports.ArrayExpression = exports.BinaryExpression = exports.TemplateLiteral = exports.Literal = exports.ArrowFunctionExpression = exports.CallExpression = exports.ExpressionStatement = exports.MemberExpression = exports.Identifier = void 0; | ||
exports.ReturnStatement = exports.BlockStatement = exports.NewExpression = exports.AwaitExpression = exports.AssignmentExpression = exports.SequenceExpression = exports.LogicalExpression = exports.ConditionalExpression = exports.FunctionDeclaration = exports.UnaryExpression = exports.ObjectExpression = exports.ArrayExpression = exports.BinaryExpression = exports.TemplateLiteral = exports.Literal = exports.ArrowFunctionExpression = exports.CallExpression = exports.ExpressionStatement = exports.MemberExpression = exports.Identifier = void 0; | ||
var Identifier_1 = require("./Identifier"); | ||
@@ -52,1 +52,5 @@ Object.defineProperty(exports, "Identifier", { enumerable: true, get: function () { return __importDefault(Identifier_1).default; } }); | ||
Object.defineProperty(exports, "NewExpression", { enumerable: true, get: function () { return __importDefault(NewExpression_1).default; } }); | ||
var BlockStatement_1 = require("./BlockStatement"); | ||
Object.defineProperty(exports, "BlockStatement", { enumerable: true, get: function () { return __importDefault(BlockStatement_1).default; } }); | ||
var ReturnStatement_1 = require("./ReturnStatement"); | ||
Object.defineProperty(exports, "ReturnStatement", { enumerable: true, get: function () { return __importDefault(ReturnStatement_1).default; } }); |
@@ -10,2 +10,3 @@ import { Token } from 'edge-lexer'; | ||
import { makeStatePropertyAccessor } from './makeStatePropertyAccessor'; | ||
import { collectObjectExpressionProperties } from './collectObjectExpressionProperties'; | ||
/** | ||
@@ -51,2 +52,3 @@ * Edge parser converts template strings to an invokable function. This module | ||
makeStatePropertyAccessor: typeof makeStatePropertyAccessor; | ||
collectObjectExpressionProperties: typeof collectObjectExpressionProperties; | ||
getExpressionLoc(expression: any): { | ||
@@ -53,0 +55,0 @@ line: number; |
@@ -20,2 +20,3 @@ "use strict"; | ||
const makeStatePropertyAccessor_1 = require("./makeStatePropertyAccessor"); | ||
const collectObjectExpressionProperties_1 = require("./collectObjectExpressionProperties"); | ||
/** | ||
@@ -57,2 +58,3 @@ * Edge parser converts template strings to an invokable function. This module | ||
makeStatePropertyAccessor: makeStatePropertyAccessor_1.makeStatePropertyAccessor, | ||
collectObjectExpressionProperties: collectObjectExpressionProperties_1.collectObjectExpressionProperties, | ||
getExpressionLoc(expression) { | ||
@@ -59,0 +61,0 @@ var _a; |
{ | ||
"name": "edge-parser", | ||
"version": "5.1.6", | ||
"version": "5.2.0", | ||
"description": "Parser for edge template engine", | ||
@@ -35,3 +35,3 @@ "main": "build/index.js", | ||
"dependencies": { | ||
"acorn": "^8.0.3", | ||
"acorn": "^8.0.4", | ||
"astring": "^1.4.3", | ||
@@ -47,4 +47,4 @@ "edge-error": "^1.0.5", | ||
"@types/astring": "^1.3.0", | ||
"@types/node": "^14.11.2", | ||
"commitizen": "^4.2.1", | ||
"@types/node": "^14.14.6", | ||
"commitizen": "^4.2.2", | ||
"cz-conventional-changelog": "^3.3.0", | ||
@@ -54,4 +54,4 @@ "dedent-js": "^1.0.1", | ||
"doctoc": "^1.4.0", | ||
"eslint": "^7.10.0", | ||
"eslint-config-prettier": "^6.12.0", | ||
"eslint": "^7.12.1", | ||
"eslint-config-prettier": "^6.15.0", | ||
"eslint-plugin-adonis": "^1.0.15", | ||
@@ -63,9 +63,9 @@ "eslint-plugin-prettier": "^3.1.4", | ||
"japa-cli": "^1.0.1", | ||
"mrm": "^2.5.1", | ||
"np": "^6.5.0", | ||
"mrm": "^2.5.8", | ||
"np": "^7.0.0", | ||
"npm-audit-html": "^1.4.3", | ||
"prettier": "^2.1.2", | ||
"typedoc": "^0.19.2", | ||
"typedoc-plugin-markdown": "^3.0.6", | ||
"typescript": "^4.0.3", | ||
"typedoc-plugin-markdown": "^3.0.11", | ||
"typescript": "^4.0.5", | ||
"youch": "^2.1.1" | ||
@@ -72,0 +72,0 @@ }, |
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
70351
68
1550
Updatedacorn@^8.0.4