oxygen-core
Version:
Oxygen game engine (Xenon Core for browsers)
1,371 lines (1,370 loc) • 411 kB
JSON
{
"type": "File",
"start": 0,
"end": 1972,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 77,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 1972,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 77,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 49,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 49
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 7,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 12
}
},
"local": {
"type": "Identifier",
"start": 7,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 12
},
"identifierName": "Asset"
},
"name": "Asset"
}
}
],
"source": {
"type": "StringLiteral",
"start": 18,
"end": 48,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 48
}
},
"extra": {
"rawValue": "../systems/AssetSystem/Asset",
"raw": "'../systems/AssetSystem/Asset'"
},
"value": "../systems/AssetSystem/Asset"
}
},
{
"type": "VariableDeclaration",
"start": 53,
"end": 155,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 4,
"column": 78
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 59,
"end": 154,
"loc": {
"start": {
"line": 3,
"column": 6
},
"end": {
"line": 4,
"column": 77
}
},
"id": {
"type": "Identifier",
"start": 59,
"end": 73,
"loc": {
"start": {
"line": 3,
"column": 6
},
"end": {
"line": 3,
"column": 20
},
"identifierName": "viewBoxPattern"
},
"name": "viewBoxPattern"
},
"init": {
"type": "RegExpLiteral",
"start": 79,
"end": 154,
"loc": {
"start": {
"line": 4,
"column": 2
},
"end": {
"line": 4,
"column": 77
}
},
"extra": {
"raw": "/viewBox=\\\"(\\d+(\\.\\d+)?)\\s+(\\d+(\\.\\d+)?)\\s+(\\d+(\\.\\d+)?)\\s+(\\d+(\\.\\d+)?)\\\"/"
},
"pattern": "viewBox=\\\"(\\d+(\\.\\d+)?)\\s+(\\d+(\\.\\d+)?)\\s+(\\d+(\\.\\d+)?)\\s+(\\d+(\\.\\d+)?)\\\"",
"flags": ""
}
}
],
"kind": "const",
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * SVG image asset loader.\r\n ",
"start": 159,
"end": 195,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 8,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 197,
"end": 1970,
"loc": {
"start": {
"line": 9,
"column": 0
},
"end": {
"line": 76,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 212,
"end": 1970,
"loc": {
"start": {
"line": 9,
"column": 15
},
"end": {
"line": 76,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 218,
"end": 226,
"loc": {
"start": {
"line": 9,
"column": 21
},
"end": {
"line": 9,
"column": 29
},
"identifierName": "SVGAsset"
},
"name": "SVGAsset",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 235,
"end": 240,
"loc": {
"start": {
"line": 9,
"column": 38
},
"end": {
"line": 9,
"column": 43
},
"identifierName": "Asset"
},
"name": "Asset"
},
"body": {
"type": "ClassBody",
"start": 241,
"end": 1970,
"loc": {
"start": {
"line": 9,
"column": 44
},
"end": {
"line": 76,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 457,
"end": 522,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 23,
"column": 3
}
},
"static": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 464,
"end": 471,
"loc": {
"start": {
"line": 21,
"column": 9
},
"end": {
"line": 21,
"column": 16
},
"identifierName": "factory"
},
"name": "factory"
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "RestElement",
"start": 472,
"end": 479,
"loc": {
"start": {
"line": 21,
"column": 17
},
"end": {
"line": 21,
"column": 24
}
},
"argument": {
"type": "Identifier",
"start": 475,
"end": 479,
"loc": {
"start": {
"line": 21,
"column": 20
},
"end": {
"line": 21,
"column": 24
},
"identifierName": "args"
},
"name": "args"
}
}
],
"body": {
"type": "BlockStatement",
"start": 481,
"end": 522,
"loc": {
"start": {
"line": 21,
"column": 26
},
"end": {
"line": 23,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 488,
"end": 517,
"loc": {
"start": {
"line": 22,
"column": 4
},
"end": {
"line": 22,
"column": 33
}
},
"argument": {
"type": "NewExpression",
"start": 495,
"end": 516,
"loc": {
"start": {
"line": 22,
"column": 11
},
"end": {
"line": 22,
"column": 32
}
},
"callee": {
"type": "Identifier",
"start": 499,
"end": 507,
"loc": {
"start": {
"line": 22,
"column": 15
},
"end": {
"line": 22,
"column": 23
},
"identifierName": "SVGAsset"
},
"name": "SVGAsset"
},
"arguments": [
{
"type": "SpreadElement",
"start": 508,
"end": 515,
"loc": {
"start": {
"line": 22,
"column": 24
},
"end": {
"line": 22,
"column": 31
}
},
"argument": {
"type": "Identifier",
"start": 511,
"end": 515,
"loc": {
"start": {
"line": 22,
"column": 27
},
"end": {
"line": 22,
"column": 31
},
"identifierName": "args"
},
"name": "args"
}
}
]
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Asset factory.\r\n *\r\n * @param {*}\targs - Factory parameters.\r\n *\r\n * @return {SVGAsset} Asset instance.\r\n *\r\n * @example\r\n * system.registerProtocol('svg', SVGAsset.factory);\r\n ",
"start": 248,
"end": 453,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 20,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * @override\r\n ",
"start": 528,
"end": 554,
"loc": {
"start": {
"line": 25,
"column": 2
},
"end": {
"line": 27,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 558,
"end": 658,
"loc": {
"start": {
"line": 28,
"column": 2
},
"end": {
"line": 34,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 558,
"end": 565,
"loc": {
"start": {
"line": 28,
"column": 2
},
"end": {
"line": 28,
"column": 9
},
"identifierName": "dispose"
},
"name": "dispose",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 568,
"end": 658,
"loc": {
"start": {
"line": 28,
"column": 12
},
"end": {
"line": 34,
"column": 3
}
},
"body": [
{
"type": "IfStatement",
"start": 575,
"end": 629,
"loc": {
"start": {
"line": 29,
"column": 4
},
"end": {
"line": 31,
"column": 5
}
},
"test": {
"type": "UnaryExpression",
"start": 579,
"end": 590,
"loc": {
"start": {
"line": 29,
"column": 8
},
"end": {
"line": 29,
"column": 19
}
},
"operator": "!",
"prefix": true,
"argument": {
"type": "UnaryExpression",
"start": 580,
"end": 590,
"loc": {
"start": {
"line": 29,
"column": 9
},
"end": {
"line": 29,
"column": 19
}
},
"operator": "!",
"prefix": true,
"argument": {
"type": "MemberExpression",
"start": 581,
"end": 590,
"loc": {
"start": {
"line": 29,
"column": 10
},
"end": {
"line": 29,
"column": 19
}
},
"object": {
"type": "ThisExpression",
"start": 581,
"end": 585,
"loc": {
"start": {
"line": 29,
"column": 10
},
"end": {
"line": 29,
"column": 14
}
}
},
"property": {
"type": "Identifier",
"start": 586,
"end": 590,
"loc": {
"start": {
"line": 29,
"column": 15
},
"end": {
"line": 29,
"column": 19
},
"identifierName": "data"
},
"name": "data"
},
"computed": false
},
"extra": {
"parenthesizedArgument": false
}
},
"extra": {
"parenthesizedArgument": false
}
},
"consequent": {
"type": "BlockStatement",
"start": 592,
"end": 629,
"loc": {
"start": {
"line": 29,
"column": 21
},
"end": {
"line": 31,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 601,
"end": 622,
"loc": {
"start": {
"line": 30,
"column": 6
},
"end": {
"line": 30,
"column": 27
}
},
"expression": {
"type": "UnaryExpression",
"start": 601,
"end": 621,
"loc": {
"start": {
"line": 30,
"column": 6
},
"end": {
"line": 30,
"column": 26
}
},
"operator": "delete",
"prefix": true,
"argument": {
"type": "MemberExpression",
"start": 608,
"end": 621,
"loc": {
"start": {
"line": 30,
"column": 13
},
"end": {
"line": 30,
"column": 26
}
},
"object": {
"type": "MemberExpression",
"start": 608,
"end": 617,
"loc": {
"start": {
"line": 30,
"column": 13
},
"end": {
"line": 30,
"column": 22
}
},
"object": {
"type": "ThisExpression",
"start": 608,
"end": 612,
"loc": {
"start": {
"line": 30,
"column": 13
},
"end": {
"line": 30,
"column": 17
}
}
},
"property": {
"type": "Identifier",
"start": 613,
"end": 617,
"loc": {
"start": {
"line": 30,
"column": 18
},
"end": {
"line": 30,
"column": 22
},
"identifierName": "data"
},
"name": "data"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 618,
"end": 621,
"loc": {
"start": {
"line": 30,
"column": 23
},
"end": {
"line": 30,
"column": 26
},
"identifierName": "src"
},
"name": "src"
},
"computed": false
},
"extra": {
"parenthesizedArgument": false
}
}
}
],
"directives": []
},
"alternate": null
},
{
"type": "ExpressionStatement",
"start": 637,
"end": 653,
"loc": {
"start": {
"line": 33,
"column": 4
},
"end": {
"line": 33,
"column": 20
}
},
"expression": {
"type": "CallExpression",
"start": 637,
"end": 652,
"loc": {
"start": {
"line": 33,
"column": 4
},
"end": {
"line": 33,
"column": 19
}
},
"callee": {
"type": "MemberExpression",
"start": 637,
"end": 650,
"loc": {
"start": {
"line": 33,
"column": 4
},
"end": {
"line": 33,
"column": 17
}
},
"object": {
"type": "Super",
"start": 637,
"end": 642,
"loc": {
"start": {
"line": 33,
"column": 4
},
"end": {
"line": 33,
"column": 9
}
}
},
"property": {
"type": "Identifier",
"start": 643,
"end": 650,
"loc": {
"start": {
"line": 33,
"column": 10
},
"end": {
"line": 33,
"column": 17
},
"identifierName": "dispose"
},
"name": "dispose"
},
"computed": false
},
"arguments": []
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * @override\r\n ",
"start": 528,
"end": 554,
"loc": {
"start": {
"line": 25,
"column": 2
},
"end": {
"line": 27,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * @override\r\n ",
"start": 664,
"end": 690,
"loc": {
"start": {
"line": 36,
"column": 2
},
"end": {
"line": 38,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 694,
"end": 1965,
"loc": {
"start": {
"line": 39,
"column": 2
},
"end": {
"line": 74,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 694,
"end": 698,
"loc": {
"start": {
"line": 39,
"column": 2
},
"end": {
"line": 39,
"column": 6
},
"identifierName": "load"
},
"name": "load",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 701,
"end": 1965,
"loc": {
"start": {
"line": 39,
"column": 9
},
"end": {
"line": 74,
"column": 3
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 708,
"end": 741,
"loc": {
"start": {
"line": 40,
"column": 4
},
"end": {
"line": 40,
"column": 37
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 714,
"end": 740,
"loc": {
"start": {
"line": 40,
"column": 10
},
"end": {
"line": 40,
"column": 36
}
},
"id": {
"type": "ObjectPattern",
"start": 714,
"end": 733,
"loc": {
"start": {
"line": 40,
"column": 10
},
"end": {
"line": 40,
"column": 29
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 716,
"end": 724,
"loc": {
"start": {
"line": 40,
"column": 12
},
"end": {
"line": 40,
"column": 20
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 716,
"end": 724,
"loc": {
"start": {
"line": 40,
"column": 12
},
"end": {
"line": 40,
"column": 20
},
"identifierName": "filename"
},
"name": "filename"
},
"value": {
"type": "Identifier",
"start": 716,
"end": 724,
"loc": {
"start": {
"line": 40,
"column": 12
},
"end": {
"line": 40,
"column": 20
},
"identifierName": "filename"
},
"name": "filename"
},
"extra": {
"shorthand": true
}
},
{
"type": "ObjectProperty",
"start": 726,
"end": 731,
"loc": {
"start": {
"line": 40,
"column": 22
},
"end": {
"line": 40,
"column": 27
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 726,
"end": 731,
"loc": {
"start": {
"line": 40,
"column": 22
},
"end": {
"line": 40,
"column": 27
},
"identifierName": "owner"
},
"name": "owner"
},
"value": {
"type": "Identifier",
"start": 726,
"end": 731,
"loc": {
"start": {
"line": 40,
"column": 22
},
"end": {
"line": 40,
"column": 27
},
"identifierName": "owner"
},
"name": "owner"
},
"extra": {
"shorthand": true
}
}
]
},
"init": {
"type": "ThisExpression",
"start": 736,
"end": 740,
"loc": {
"start": {
"line": 40,
"column": 32
},
"end": {
"line": 40,
"column": 36
}
}
}
}
],
"kind": "const"
},
{
"type": "ReturnStatement",
"start": 749,
"end": 1960,
"loc": {
"start": {
"line": 42,
"column": 4
},
"end": {
"line": 73,
"column": 10
}
},
"argument": {
"type": "CallExpression",
"start": 756,
"end": 1959,
"loc": {
"start": {
"line": 42,
"column": 11
},
"end": {
"line": 73,
"column": 9
}
},
"callee": {
"type": "MemberExpression",
"start": 756,
"end": 990,
"loc": {
"start": {
"line": 42,
"column": 11
},
"end": {
"line": 47,
"column": 11
}
},
"object": {
"type": "CallExpression",
"start": 756,
"end": 977,
"loc": {
"start": {
"line": 42,
"column": 11
},
"end": {
"line": 46,
"column": 7
}
},
"callee": {
"type": "MemberExpression",
"start": 756,
"end": 835,
"loc": {
"start": {
"line": 42,
"column": 11
},
"end": {
"line": 43,
"column": 11
}
},
"object": {
"type": "CallExpression",
"start": 756,
"end": 822,
"loc": {
"start": {
"line": 42,
"column": 11
},
"end": {
"line": 42,
"column": 77
}
},
"callee": {
"type": "MemberExpression",
"start": 756,
"end": 773,
"loc": {
"start": {
"line": 42,
"column": 11
},
"end": {
"line": 42,
"column": 28
}
},
"object": {
"type": "Identifier",
"start": 756,
"end": 761,
"loc": {
"start": {
"line": 42,
"column": 11
},
"end": {
"line": 42,
"column": 16
},
"identifierName": "owner"
},
"name": "owner"
},
"property": {
"type": "Identifier",
"start": 762,
"end": 773,
"loc": {
"start": {
"line": 42,
"column": 17
},
"end": {
"line": 42,
"column": 28
},
"identifierName": "fetchEngine"
},
"name": "fetchEngine"
},
"computed": false
},
"arguments": [
{
"type": "BinaryExpression",
"start": 774,
"end": 801,
"loc": {
"start": {
"line": 42,
"column": 29
},
"end": {
"line": 42,
"column": 56
}
},
"left": {
"type": "MemberExpression",
"start": 774,
"end": 790,
"loc": {
"start": {
"line": 42,
"column": 29
},
"end": {
"line": 42,
"column": 45
}
},
"object": {
"type": "Identifier",
"start": 774,
"end": 779,
"loc": {
"start": {
"line": 42,
"column": 29
},
"end": {
"line": 42,
"column": 34
},
"identifierName": "owner"
},
"name": "owner"
},
"property": {
"type": "Identifier",
"start": 780,
"end": 790,
"loc": {
"start": {
"line": 42,
"column": 35
},
"end": {
"line": 42,
"column": 45
},
"identifierName": "pathPrefix"
},
"name": "pathPrefix"
},
"computed": false
},
"operator": "+",
"right": {
"type": "Identifier",
"start": 793,
"end": 801,
"loc": {
"start": {
"line": 42,
"column": 48
},
"end": {
"line": 42,
"column": 56
},
"identifierName": "filename"
},
"name": "filename"
}
},
{
"type": "MemberExpression",
"start": 803,
"end": 821,
"loc": {
"start": {
"line": 42,
"column": 58
},
"end": {
"line": 42,
"column": 76
}
},
"object": {
"type": "Identifier",
"start": 803,
"end": 808,
"loc": {
"start": {
"line": 42,
"column": 58
},
"end": {
"line": 42,
"column": 63
},
"identifierName": "owner"
},
"name": "owner"
},
"property": {
"type": "Identifier",
"start": 809,
"end": 821,