File tree 4 files changed +11
-7
lines changed
4 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 44
44
},
45
45
"devDependencies" : {
46
46
"@types/acorn" : " 4.0.5" ,
47
- "@types/estree" : " 0.0.42 " ,
47
+ "@types/estree" : " 0.0.44 " ,
48
48
"@types/node" : " 12.12.35" ,
49
49
"@types/uuid" : " 7.0.2" ,
50
50
"ava" : " 2.4.0" ,
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import {
28
28
VariableDeclaration ,
29
29
ClassDeclaration ,
30
30
ExportSpecifier ,
31
+ Property ,
31
32
} from 'estree' ;
32
33
import * as acorn from 'acorn' ;
33
34
import { log } from './debug' ;
@@ -96,3 +97,6 @@ export function isClassDeclaration(node: BaseNode): node is ClassDeclaration {
96
97
export function isExportSpecifier ( node : BaseNode ) : node is ExportSpecifier {
97
98
return node . type === 'ExportSpecifier' ;
98
99
}
100
+ export function isProperty ( node : BaseNode ) : node is Property {
101
+ return node . type === 'Property' ;
102
+ }
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ import { ChunkTransform } from '../../transform';
18
18
import { Range , TransformInterface } from '../../types' ;
19
19
import MagicString from 'magic-string' ;
20
20
import { ObjectExpression } from 'estree' ;
21
- import { parse , walk } from '../../acorn' ;
21
+ import { parse , walk , isProperty } from '../../acorn' ;
22
22
23
23
/**
24
24
* Closure Compiler will not transform computed keys with literal values back to the literal value.
@@ -40,7 +40,7 @@ export default class LiteralComputedKeys extends ChunkTransform implements Trans
40
40
walk . simple ( program , {
41
41
ObjectExpression ( node : ObjectExpression ) {
42
42
for ( const property of node . properties ) {
43
- if ( property . computed && property . key . type === 'Literal' ) {
43
+ if ( isProperty ( property ) && property . computed && property . key . type === 'Literal' ) {
44
44
const [ propertyStart ] : Range = property . range as Range ;
45
45
const [ valueStart ] : Range = property . value . range as Range ;
46
46
Original file line number Diff line number Diff line change 380
380
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.40.tgz#0e6cb9b9bbd098031fa19e4b4e8131bc70e5de13"
381
381
integrity sha512-p3KZgMto/JyxosKGmnLDJ/dG5wf+qTRMUjHJcspC2oQKa4jP7mz+tv0ND56lLBu3ojHlhzY33Ol+khLyNmilkA==
382
382
383
-
384
- version "0.0.42 "
385
- resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.42 .tgz#8d0c1f480339efedb3e46070e22dd63e0430dd11 "
386
- integrity sha512-K1DPVvnBCPxzD+G51/cxVIoc2X8uUVl1zpJeE6iKcgHMj4+tbat5Xu4TjV7v2QSDbIeAfLi2hIk+u2+s0MlpUQ ==
383
+
384
+ version "0.0.44 "
385
+ resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.44 .tgz#980cc5a29a3ef3bea6ff1f7d021047d7ea575e21 "
386
+ integrity sha512-iaIVzr+w2ZJ5HkidlZ3EJM8VTZb2MJLCjw3V+505yVts0gRC4UMvjw0d1HPtGqI/HQC/KdsYtayfzl+AXY2R8g ==
387
387
388
388
" @types/events@* " :
389
389
version "3.0.0"
You can’t perform that action at this time.
0 commit comments