Comparing version 0.0.2 to 0.0.3
# code-red changelog | ||
## 0.0.3 | ||
* Allow return outside function | ||
* Print code on syntax error | ||
## 0.0.2 | ||
@@ -4,0 +9,0 @@ |
@@ -134,18 +134,33 @@ (function (global, factory) { | ||
function b(strings, ...values) { | ||
const ast = acorn.parse(join(strings), { | ||
ecmaVersion: 2019, | ||
sourceType: 'module' | ||
}); | ||
const str = join(strings); | ||
try { | ||
const ast = acorn.parse(str, { | ||
ecmaVersion: 2019, | ||
sourceType: 'module', | ||
allowAwaitOutsideFunction: true, | ||
allowReturnOutsideFunction: true | ||
}); | ||
inject(ast, values); | ||
inject(ast, values); | ||
return ast.body; | ||
return ast.body; | ||
} catch (err) { | ||
console.log(str); // TODO proper error reporting | ||
throw err; | ||
} | ||
} | ||
function x(strings, ...values) { | ||
const expression = acorn.parseExpressionAt(join(strings)); | ||
const str = join(strings); | ||
inject(expression, values); | ||
try { | ||
const expression = acorn.parseExpressionAt(str); | ||
return expression; | ||
inject(expression, values); | ||
return expression; | ||
} catch (err) { | ||
console.log(str); // TODO proper error reporting | ||
throw err; | ||
} | ||
} | ||
@@ -152,0 +167,0 @@ |
{ | ||
"name": "code-red", | ||
"description": "code-red", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"repository": "Rich-Harris/code-red", | ||
@@ -6,0 +6,0 @@ "main": "dist/code-red.js", |
Sorry, the diff of this file is not supported yet
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
12311
283