UNPKG

awv3

Version:
1,741 lines (1,740 loc) 1.42 MB
{ "type": "Program", "start": 0, "end": 14233, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 412, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 130, "end": 156, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 26 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 137, "end": 142, "loc": { "start": { "line": 5, "column": 7 }, "end": { "line": 5, "column": 12 } }, "local": { "type": "Identifier", "start": 137, "end": 142, "loc": { "start": { "line": 5, "column": 7 }, "end": { "line": 5, "column": 12 } }, "name": "THREE", "leadingComments": null }, "leadingComments": null } ], "importKind": "value", "source": { "type": "Literal", "start": 148, "end": 155, "loc": { "start": { "line": 5, "column": 18 }, "end": { "line": 5, "column": 25 } }, "value": "three", "rawValue": "three", "raw": "'three'" }, "leadingComments": [ { "type": "CommentLine", "value": " TODO", "start": 0, "end": 7, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 7 } }, "range": [ 0, 7 ] }, { "type": "CommentLine", "value": " 1. doesn't need to be coupled to canvas AT ALL", "start": 9, "end": 58, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 49 } }, "range": [ 9, 58 ] }, { "type": "CommentLine", "value": " 2. Canvas events should be renamed to broardcasts to make sense", "start": 60, "end": 126, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 66 } }, "range": [ 60, 126 ] } ] }, { "type": "ImportDeclaration", "start": 158, "end": 197, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 39 } }, "specifiers": [ { "type": "ImportNamespaceSpecifier", "start": 165, "end": 175, "loc": { "start": { "line": 6, "column": 7 }, "end": { "line": 6, "column": 17 } }, "local": { "type": "Identifier", "start": 170, "end": 175, "loc": { "start": { "line": 6, "column": 12 }, "end": { "line": 6, "column": 17 } }, "name": "Error" } } ], "importKind": "value", "source": { "type": "Literal", "start": 181, "end": 196, "loc": { "start": { "line": 6, "column": 23 }, "end": { "line": 6, "column": 38 } }, "value": "../core/error", "rawValue": "../core/error", "raw": "'../core/error'" } }, { "type": "ImportDeclaration", "start": 199, "end": 251, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 7, "column": 52 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 208, "end": 212, "loc": { "start": { "line": 7, "column": 9 }, "end": { "line": 7, "column": 13 } }, "imported": { "type": "Identifier", "start": 208, "end": 212, "loc": { "start": { "line": 7, "column": 9 }, "end": { "line": 7, "column": 13 } }, "name": "guid" }, "local": { "type": "Identifier", "start": 208, "end": 212, "loc": { "start": { "line": 7, "column": 9 }, "end": { "line": 7, "column": 13 } }, "name": "guid" } }, { "type": "ImportSpecifier", "start": 214, "end": 225, "loc": { "start": { "line": 7, "column": 15 }, "end": { "line": 7, "column": 26 } }, "imported": { "type": "Identifier", "start": 214, "end": 225, "loc": { "start": { "line": 7, "column": 15 }, "end": { "line": 7, "column": 26 } }, "name": "Performance" }, "local": { "type": "Identifier", "start": 214, "end": 225, "loc": { "start": { "line": 7, "column": 15 }, "end": { "line": 7, "column": 26 } }, "name": "Performance" } } ], "importKind": "value", "source": { "type": "Literal", "start": 233, "end": 250, "loc": { "start": { "line": 7, "column": 34 }, "end": { "line": 7, "column": 51 } }, "value": "../core/helpers", "rawValue": "../core/helpers", "raw": "'../core/helpers'" } }, { "type": "ImportDeclaration", "start": 253, "end": 299, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 8, "column": 46 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 260, "end": 273, "loc": { "start": { "line": 8, "column": 7 }, "end": { "line": 8, "column": 20 } }, "local": { "type": "Identifier", "start": 260, "end": 273, "loc": { "start": { "line": 8, "column": 7 }, "end": { "line": 8, "column": 20 } }, "name": "WorkerFactory" } } ], "importKind": "value", "source": { "type": "Literal", "start": 279, "end": 298, "loc": { "start": { "line": 8, "column": 26 }, "end": { "line": 8, "column": 45 } }, "value": "../worker/factory", "rawValue": "../worker/factory", "raw": "'../worker/factory'" } }, { "type": "ImportDeclaration", "start": 301, "end": 340, "loc": { "start": { "line": 9, "column": 0 }, "end": { "line": 9, "column": 39 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 308, "end": 315, "loc": { "start": { "line": 9, "column": 7 }, "end": { "line": 9, "column": 14 } }, "local": { "type": "Identifier", "start": 308, "end": 315, "loc": { "start": { "line": 9, "column": 7 }, "end": { "line": 9, "column": 14 } }, "name": "Object3" } } ], "importKind": "value", "source": { "type": "Literal", "start": 321, "end": 339, "loc": { "start": { "line": 9, "column": 20 }, "end": { "line": 9, "column": 38 } }, "value": "../three/object3", "rawValue": "../three/object3", "raw": "'../three/object3'" } }, { "type": "ImportDeclaration", "start": 342, "end": 393, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 10, "column": 51 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 349, "end": 366, "loc": { "start": { "line": 10, "column": 7 }, "end": { "line": 10, "column": 24 } }, "local": { "type": "Identifier", "start": 349, "end": 366, "loc": { "start": { "line": 10, "column": 7 }, "end": { "line": 10, "column": 24 } }, "name": "MeshPhongMaterial" } } ], "importKind": "value", "source": { "type": "Literal", "start": 372, "end": 392, "loc": { "start": { "line": 10, "column": 30 }, "end": { "line": 10, "column": 50 } }, "value": "../materials/phong", "rawValue": "../materials/phong", "raw": "'../materials/phong'" } }, { "type": "ImportDeclaration", "start": 395, "end": 435, "loc": { "start": { "line": 11, "column": 0 }, "end": { "line": 11, "column": 40 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 402, "end": 410, "loc": { "start": { "line": 11, "column": 7 }, "end": { "line": 11, "column": 15 } }, "local": { "type": "Identifier", "start": 402, "end": 410, "loc": { "start": { "line": 11, "column": 7 }, "end": { "line": 11, "column": 15 } }, "name": "Defaults" } } ], "importKind": "value", "source": { "type": "Literal", "start": 416, "end": 434, "loc": { "start": { "line": 11, "column": 21 }, "end": { "line": 11, "column": 39 } }, "value": "../core/defaults", "rawValue": "../core/defaults", "raw": "'../core/defaults'" } }, { "type": "ImportDeclaration", "start": 437, "end": 493, "loc": { "start": { "line": 12, "column": 0 }, "end": { "line": 12, "column": 56 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 446, "end": 455, "loc": { "start": { "line": 12, "column": 9 }, "end": { "line": 12, "column": 18 } }, "imported": { "type": "Identifier", "start": 446, "end": 455, "loc": { "start": { "line": 12, "column": 9 }, "end": { "line": 12, "column": 18 } }, "name": "parseMesh" }, "local": { "type": "Identifier", "start": 446, "end": 455, "loc": { "start": { "line": 12, "column": 9 }, "end": { "line": 12, "column": 18 } }, "name": "parseMesh" } }, { "type": "ImportSpecifier", "start": 457, "end": 466, "loc": { "start": { "line": 12, "column": 20 }, "end": { "line": 12, "column": 29 } }, "imported": { "type": "Identifier", "start": 457, "end": 466, "loc": { "start": { "line": 12, "column": 20 }, "end": { "line": 12, "column": 29 } }, "name": "parseLine" }, "local": { "type": "Identifier", "start": 457, "end": 466, "loc": { "start": { "line": 12, "column": 20 }, "end": { "line": 12, "column": 29 } }, "name": "parseLine" } } ], "importKind": "value", "source": { "type": "Literal", "start": 474, "end": 492, "loc": { "start": { "line": 12, "column": 37 }, "end": { "line": 12, "column": 55 } }, "value": "../core/geometry", "rawValue": "../core/geometry", "raw": "'../core/geometry'" }, "trailingComments": [ { "type": "CommentLine", "value": " options.pool = THREE.Object3D", "start": 497, "end": 529, "loc": { "start": { "line": 14, "column": 0 }, "end": { "line": 14, "column": 32 } }, "range": [ 497, 529 ] }, { "type": "CommentLine", "value": " options.factory = function()", "start": 531, "end": 562, "loc": { "start": { "line": 15, "column": 0 }, "end": { "line": 15, "column": 31 } }, "range": [ 531, 562 ] }, { "type": "CommentLine", "value": " options.", "start": 564, "end": 575, "loc": { "start": { "line": 16, "column": 0 }, "end": { "line": 16, "column": 11 } }, "range": [ 564, 575 ] }, { "type": "CommentLine", "value": " when a pool exists operations can be fulfilled without needing a complex factory", "start": 577, "end": 660, "loc": { "start": { "line": 17, "column": 0 }, "end": { "line": 17, "column": 83 } }, "range": [ 577, 660 ] }, { "type": "CommentLine", "value": " this applies to assemblies, or even connected classcad transmissions", "start": 662, "end": 733, "loc": { "start": { "line": 18, "column": 0 }, "end": { "line": 18, "column": 71 } }, "range": [ 662, 733 ] }, { "type": "CommentLine", "value": " operations should always be awaited, the geometry parser should return promises as well", "start": 735, "end": 825, "loc": { "start": { "line": 19, "column": 0 }, "end": { "line": 19, "column": 90 } }, "range": [ 735, 825 ] }, { "type": "CommentLine", "value": " structural elements should be visible and uncompressed, only geometry should go to the worker", "start": 827, "end": 923, "loc": { "start": { "line": 20, "column": 0 }, "end": { "line": 20, "column": 96 } }, "range": [ 827, 923 ] }, { "type": "CommentLine", "value": " if the structure is laid out clear it can be processed in sequence", "start": 925, "end": 994, "loc": { "start": { "line": 21, "column": 0 }, "end": { "line": 21, "column": 69 } }, "range": [ 925, 994 ] } ] }, { "type": "ExportDefaultDeclaration", "start": 998, "end": 3211, "loc": { "start": { "line": 23, "column": 0 }, "end": { "line": 76, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 1013, "end": 3211, "loc": { "start": { "line": 23, "column": 15 }, "end": { "line": 76, "column": 1 } }, "id": { "type": "Identifier", "start": 1019, "end": 1025, "loc": { "start": { "line": 23, "column": 21 }, "end": { "line": 23, "column": 27 } }, "name": "Parser", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 1026, "end": 3211, "loc": { "start": { "line": 23, "column": 28 }, "end": { "line": 76, "column": 1 } }, "body": [ { "type": "MethodDefinition", "start": 1033, "end": 1071, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 26, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 1033, "end": 1044, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 24, "column": 15 } }, "name": "constructor" }, "static": false, "kind": "constructor", "value": { "type": "FunctionExpression", "start": 1044, "end": 1071, "loc": { "start": { "line": 24, "column": 15 }, "end": { "line": 26, "column": 5 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 1047, "end": 1071, "loc": { "start": { "line": 24, "column": 18 }, "end": { "line": 26, "column": 5 } }, "body": [], "leadingComments": [ { "type": "CommentLine", "value": " ...", "start": 1058, "end": 1064, "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 14 } }, "range": [ 1058, 1064 ] } ], "innerComments": [ { "type": "CommentLine", "value": " ...", "start": 1058, "end": 1064, "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 14 } }, "range": [ 1058, 1064 ] } ] } } }, { "type": "MethodDefinition", "start": 1079, "end": 2511, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 59, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 1085, "end": 1091, "loc": { "start": { "line": 28, "column": 10 }, "end": { "line": 28, "column": 16 } }, "name": "stream" }, "static": false, "kind": "method", "value": { "type": "FunctionExpression", "start": 1091, "end": 2511, "loc": { "start": { "line": 28, "column": 16 }, "end": { "line": 59, "column": 5 } }, "id": null, "generator": false, "expression": false, "async": true, "params": [ { "type": "AssignmentPattern", "start": 1092, "end": 1124, "loc": { "start": { "line": 28, "column": 17 }, "end": { "line": 28, "column": 49 } }, "operator": "=", "left": { "type": "Identifier", "start": 1092, "end": 1095, "loc": { "start": { "line": 28, "column": 17 }, "end": { "line": 28, "column": 20 } }, "name": "url" }, "right": { "type": "CallExpression", "start": 1098, "end": 1124, "loc": { "start": { "line": 28, "column": 23 }, "end": { "line": 28, "column": 49 } }, "callee": { "type": "MemberExpression", "start": 1098, "end": 1107, "loc": { "start": { "line": 28, "column": 23 }, "end": { "line": 28, "column": 32 } }, "object": { "type": "Identifier", "start": 1098, "end": 1103, "loc": { "start": { "line": 28, "column": 23 }, "end": { "line": 28, "column": 28 } }, "name": "Error" }, "property": { "type": "Identifier", "start": 1104, "end": 1107, "loc": { "start": { "line": 28, "column": 29 }, "end": { "line": 28, "column": 32 } }, "name": "log" }, "computed": false }, "arguments": [ { "type": "Literal", "start": 1108, "end": 1123, "loc": { "start": { "line": 28, "column": 33 }, "end": { "line": 28, "column": 48 } }, "value": "Url undefined", "rawValue": "Url undefined", "raw": "\"Url undefined\"" } ] } }, { "type": "AssignmentPattern", "start": 1126, "end": 1138, "loc": { "start": { "line": 28, "column": 51 }, "end": { "line": 28, "column": 63 } }, "operator": "=", "left": { "type": "Identifier", "start": 1126, "end": 1133, "loc": { "start": { "line": 28, "column": 51 }, "end": { "line": 28, "column": 58 } }, "name": "options" }, "right": { "type": "ObjectExpression", "start": 1136, "end": 1138, "loc": { "start": { "line": 28, "column": 61 }, "end": { "line": 28, "column": 63 } }, "properties": [] } } ], "body": { "type": "BlockStatement", "start": 1140, "end": 2511, "loc": { "start": { "line": 28, "column": 65 }, "end": { "line": 59, "column": 5 } }, "body": [ { "type": "VariableDeclaration", "start": 1188, "end": 1236, "loc": { "start": { "line": 31, "column": 8 }, "end": { "line": 31, "column": 56 } }, "declarations": [ { "type": "VariableDeclarator", "start": 1192, "end": 1235, "loc": { "start": { "line": 31, "column": 12 }, "end": { "line": 31, "column": 55 } }, "id": { "type": "Identifier", "start": 1192, "end": 1200, "loc": { "start": { "line": 31, "column": 12 }, "end": { "line": 31, "column": 20 } }, "name": "requests", "leadingComments": null }, "init": { "type": "ConditionalExpression", "start": 1203, "end": 1235, "loc": { "start": { "line": 31, "column": 23 }, "end": { "line": 31, "column": 55 } }, "test": { "type": "CallExpression", "start": 1203, "end": 1221, "loc": { "start": { "line": 31, "column": 23 }, "end": { "line": 31, "column": 41 } }, "callee": { "type": "MemberExpression", "start": 1203, "end": 1216, "loc": { "start": { "line": 31, "column": 23 }, "end": { "line": 31, "column": 36 } }, "object": { "type": "Identifier", "start": 1203, "end": 1208, "loc": { "start": { "line": 31, "column": 23 }, "end": { "line": 31, "column": 28 } }, "name": "Array" }, "property": { "type": "Identifier", "start": 1209, "end": 1216, "loc": { "start": { "line": 31, "column": 29 }, "end": { "line": 31, "column": 36 } }, "name": "isArray" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 1217, "end": 1220, "loc": { "start": { "line": 31, "column": 37 }, "end": { "line": 31, "column": 40 } }, "name": "url" } ] }, "consequent": { "type": "Identifier", "start": 1224, "end": 1227, "loc": { "start": { "line": 31, "column": 44 }, "end": { "line": 31, "column": 47 } }, "name": "url" }, "alternate": { "type": "ArrayExpression", "start": 1230, "end": 1235, "loc": { "start": { "line": 31, "column": 50 }, "end": { "line": 31, "column": 55 } }, "elements": [ { "type": "Identifier", "start": 1231, "end": 1234, "loc": { "start": { "line": 31, "column": 51 }, "end": { "line": 31, "column": 54 } }, "name": "url" } ] } }, "leadingComments": null } ], "kind": "let", "leadingComments": [ { "type": "CommentLine", "value": " Always assume an array", "start": 1153, "end": 1178, "loc": { "start": { "line": 30, "column": 8 }, "end": { "line": 30, "column": 33 } }, "range": [ 1153, 1178 ] } ], "trailingComments": [ { "type": "CommentLine", "value": " Map request-array into an array of promises and await them through Promises.all", "start": 1248, "end": 1330, "loc": { "start": { "line": 33, "column": 8 }, "end": { "line": 33, "column": 90 } }, "range": [ 1248, 1330 ] } ] }, { "type": "VariableDeclaration", "start": 1340, "end": 2175, "loc": { "start": { "line": 34, "column": 8 }, "end": { "line": 51, "column": 12 } }, "declarations": [ { "type": "VariableDeclarator", "start": 1344, "end": 2174, "loc": { "start": { "line": 34, "column": 12 }, "end": { "line": 51, "column": 11 } }, "id": { "type": "Identifier", "start": 1344, "end": 1351, "loc": { "start": { "line": 34, "column": 12 }, "end": { "line": 34, "column": 19 } }, "name": "results", "leadingComments": null }, "init": { "type": "AwaitExpression", "start": 1354, "end": 2174, "loc": { "start": { "line": 34, "column": 22 }, "end": { "line": 51, "column": 11 } }, "all": false, "argument": { "type": "CallExpression", "start": 1360, "end": 2174, "loc": { "start": { "line": 34, "column": 28 }, "end": { "line": 51, "column": 11 } }, "callee": { "type": "MemberExpression", "start": 1360, "end": 1371, "loc": { "start": { "line": 34, "column": 28 }, "end": { "line": 34, "column": 39 } }, "object": { "type": "Identifier", "start": 1360, "end": 1367, "loc": { "start": { "line": 34, "column": 28 }, "end": { "line": 34, "column": 35 } }, "name": "Promise" }, "property": { "type": "Identifier", "start": 1368, "end": 1371, "loc": { "start": { "line": 34, "column": 36 }, "end": { "line": 34, "column": 39 } }, "name": "all" }, "computed": false }, "arguments": [ { "type": "CallExpression", "start": 1372, "end": 2173, "loc": { "start": { "line": 34, "column": 40 }, "end": { "line": 51, "column": 10 } }, "callee": { "type": "MemberExpression", "start": 1372, "end": 1384, "loc": { "start": { "line": 34, "column": 40 }, "end": { "line": 34, "column": 52 } }, "object": { "type": "Identifier", "start": 1372, "end": 1380, "loc": { "start": { "line": 34, "column": 40 }, "end": { "line": 34, "column": 48 } }, "name": "requests" }, "property": { "type": "Identifier", "start": 1381, "end": 1384, "loc": { "start": { "line": 34, "column": 49 }, "end": { "line": 34, "column": 52 } }, "name": "map" }, "computed": false }, "arguments": [ { "type": "ArrowFunctionExpression", "start": 1385,