Comparing version 0.1.2 to 0.1.3
# code-red changelog | ||
## 0.1.3 | ||
* Support nullish coalescing operator ([#42](https://github.com/Rich-Harris/code-red/issues/42)) | ||
* Support optional chaining ([#43](https://github.com/Rich-Harris/code-red/issues/43)) | ||
## 0.1.2 | ||
@@ -4,0 +9,0 @@ |
@@ -95,4 +95,5 @@ (function (global, factory) { | ||
const OPERATOR_PRECEDENCE = { | ||
'||': 3, | ||
'&&': 4, | ||
'||': 2, | ||
'&&': 3, | ||
'??': 4, | ||
'|': 5, | ||
@@ -1247,2 +1248,6 @@ '^': 6, | ||
ChainExpression(node, state) { | ||
return handle(node.expression, state); | ||
}, | ||
CallExpression(node, state) { | ||
@@ -1264,2 +1269,6 @@ const chunks = []; | ||
if ((node ).optional) { | ||
chunks.push(c('?.')); | ||
} | ||
const args = node.arguments.map(arg => handle(arg, state)); | ||
@@ -1306,2 +1315,5 @@ | ||
if (node.computed) { | ||
if (node.optional) { | ||
chunks.push(c('?.')); | ||
} | ||
chunks.push( | ||
@@ -1314,3 +1326,3 @@ c('['), | ||
chunks.push( | ||
c('.'), | ||
c(node.optional ? '?.' : '.'), | ||
...handle(node.property, state) | ||
@@ -1591,3 +1603,3 @@ ); | ||
return { | ||
ecmaVersion: 11, | ||
ecmaVersion: 2020, | ||
sourceType: 'module', | ||
@@ -1594,0 +1606,0 @@ allowAwaitOutsideFunction: true, |
{ | ||
"name": "code-red", | ||
"description": "code-red", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"repository": "Rich-Harris/code-red", | ||
@@ -15,3 +15,3 @@ "main": "dist/code-red.js", | ||
"@types/astring": "^1.3.0", | ||
"@types/estree": "0.0.39", | ||
"@types/estree": "0.0.45", | ||
"@types/mocha": "^5.2.7", | ||
@@ -39,3 +39,3 @@ "@types/node": "^12.12.7", | ||
"dependencies": { | ||
"acorn": "^7.1.0", | ||
"acorn": "^7.3.1", | ||
"is-reference": "^1.1.4", | ||
@@ -42,0 +42,0 @@ "periscopic": "^2.0.1", |
@@ -1,7 +0,7 @@ | ||
import { Property, Node, Expression } from 'estree'; | ||
import { Property, Node, Expression, SpreadElement } from 'estree'; | ||
export declare function b(strings: TemplateStringsArray, ...values: any[]): Node[]; | ||
export declare function x(strings: TemplateStringsArray, ...values: any[]): Expression; | ||
export declare function p(strings: TemplateStringsArray, ...values: any[]): Property; | ||
export declare function p(strings: TemplateStringsArray, ...values: any[]): Property | SpreadElement; | ||
export { print } from './print/index'; | ||
export declare const parse: (source: string, opts: any) => any; | ||
export declare const parseExpressionAt: (source: string, index: number, opts: any) => any; |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
86078
2922
0
Updatedacorn@^7.3.1