swc/crates/swc_ecma_parser/tests/tsc/jsDeclarationsImportAliasExposedWithinNamespaceCjs.json

485 lines
11 KiB
JSON

{
"type": "Script",
"span": {
"start": 217,
"end": 1099,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 217,
"end": 260,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 223,
"end": 259,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 223,
"end": 230,
"ctxt": 0
},
"value": "myTypes",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 233,
"end": 259,
"ctxt": 0
},
"properties": []
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 517,
"end": 543,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 517,
"end": 542,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 517,
"end": 532,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 517,
"end": 524,
"ctxt": 0
},
"value": "exports",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 525,
"end": 532,
"ctxt": 0
},
"value": "myTypes",
"optional": false
}
},
"right": {
"type": "Identifier",
"span": {
"start": 535,
"end": 542,
"ctxt": 0
},
"value": "myTypes",
"optional": false
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 567,
"end": 606,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 573,
"end": 605,
"ctxt": 0
},
"id": {
"type": "ObjectPattern",
"span": {
"start": 573,
"end": 582,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 574,
"end": 581,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 574,
"end": 581,
"ctxt": 0
},
"value": "myTypes",
"optional": false
},
"value": null
}
],
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 585,
"end": 605,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 585,
"end": 592,
"ctxt": 0
},
"value": "require",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 593,
"end": 604,
"ctxt": 0
},
"value": "./file.js",
"raw": "'./file.js'"
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 681,
"end": 728,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 687,
"end": 727,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 687,
"end": 698,
"ctxt": 0
},
"value": "testFnTypes",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 701,
"end": 727,
"ctxt": 0
},
"properties": []
},
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 938,
"end": 944,
"ctxt": 0
},
"value": "testFn",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 945,
"end": 950,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 945,
"end": 950,
"ctxt": 0
},
"value": "input",
"optional": false,
"typeAnnotation": null
}
}
],
"decorators": [],
"span": {
"start": 929,
"end": 1058,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 952,
"end": 1058,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 958,
"end": 1056,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 962,
"end": 987,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "UnaryExpression",
"span": {
"start": 962,
"end": 974,
"ctxt": 0
},
"operator": "typeof",
"argument": {
"type": "Identifier",
"span": {
"start": 969,
"end": 974,
"ctxt": 0
},
"value": "input",
"optional": false
}
},
"right": {
"type": "StringLiteral",
"span": {
"start": 979,
"end": 987,
"ctxt": 0
},
"value": "number",
"raw": "'number'"
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 989,
"end": 1022,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 999,
"end": 1016,
"ctxt": 0
},
"argument": {
"type": "BinaryExpression",
"span": {
"start": 1006,
"end": 1015,
"ctxt": 0
},
"operator": "*",
"left": {
"type": "NumericLiteral",
"span": {
"start": 1006,
"end": 1007,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
},
"right": {
"type": "Identifier",
"span": {
"start": 1010,
"end": 1015,
"ctxt": 0
},
"value": "input",
"optional": false
}
}
}
]
},
"alternate": {
"type": "BlockStatement",
"span": {
"start": 1028,
"end": 1056,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 1038,
"end": 1050,
"ctxt": 0
},
"argument": {
"type": "NullLiteral",
"span": {
"start": 1045,
"end": 1049,
"ctxt": 0
}
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 1060,
"end": 1099,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 1060,
"end": 1098,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 1060,
"end": 1074,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 1060,
"end": 1066,
"ctxt": 0
},
"value": "module",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 1067,
"end": 1074,
"ctxt": 0
},
"value": "exports",
"optional": false
}
},
"right": {
"type": "ObjectExpression",
"span": {
"start": 1077,
"end": 1098,
"ctxt": 0
},
"properties": [
{
"type": "Identifier",
"span": {
"start": 1078,
"end": 1084,
"ctxt": 0
},
"value": "testFn",
"optional": false
},
{
"type": "Identifier",
"span": {
"start": 1086,
"end": 1097,
"ctxt": 0
},
"value": "testFnTypes",
"optional": false
}
]
}
}
}
],
"interpreter": null
}