UNPKG

@xailabs/altx

Version:

Flux flavor based on alt.js

1,509 lines 79 kB
{ "type": "File", "start": 0, "end": 965, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 27, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 965, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 27, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ExportDefaultDeclaration", "start": 502, "end": 963, "loc": { "start": { "line": 12, "column": 0 }, "end": { "line": 26, "column": 1 } }, "declaration": { "type": "FunctionDeclaration", "start": 517, "end": 963, "loc": { "start": { "line": 12, "column": 15 }, "end": { "line": 26, "column": 1 } }, "id": { "type": "Identifier", "start": 526, "end": 547, "loc": { "start": { "line": 12, "column": 24 }, "end": { "line": 12, "column": 45 }, "identifierName": "createDefensiveObject" }, "name": "createDefensiveObject", "leadingComments": null }, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 548, "end": 554, "loc": { "start": { "line": 12, "column": 46 }, "end": { "line": 12, "column": 52 }, "identifierName": "target" }, "name": "target" } ], "body": { "type": "BlockStatement", "start": 556, "end": 963, "loc": { "start": { "line": 12, "column": 54 }, "end": { "line": 26, "column": 1 } }, "body": [ { "type": "VariableDeclaration", "start": 563, "end": 586, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 27 } }, "declarations": [ { "type": "VariableDeclarator", "start": 569, "end": 585, "loc": { "start": { "line": 13, "column": 10 }, "end": { "line": 13, "column": 26 } }, "id": { "type": "ObjectPattern", "start": 569, "end": 576, "loc": { "start": { "line": 13, "column": 10 }, "end": { "line": 13, "column": 17 } }, "properties": [ { "type": "ObjectProperty", "start": 570, "end": 575, "loc": { "start": { "line": 13, "column": 11 }, "end": { "line": 13, "column": 16 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 570, "end": 575, "loc": { "start": { "line": 13, "column": 11 }, "end": { "line": 13, "column": 16 }, "identifierName": "Proxy" }, "name": "Proxy" }, "value": { "type": "Identifier", "start": 570, "end": 575, "loc": { "start": { "line": 13, "column": 11 }, "end": { "line": 13, "column": 16 }, "identifierName": "Proxy" }, "name": "Proxy" }, "extra": { "shorthand": true } } ] }, "init": { "type": "Identifier", "start": 579, "end": 585, "loc": { "start": { "line": 13, "column": 20 }, "end": { "line": 13, "column": 26 }, "identifierName": "window" }, "name": "window" } } ], "kind": "const" }, { "type": "IfStatement", "start": 592, "end": 636, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 16, "column": 5 } }, "test": { "type": "UnaryExpression", "start": 596, "end": 602, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 14 } }, "operator": "!", "prefix": true, "argument": { "type": "Identifier", "start": 597, "end": 602, "loc": { "start": { "line": 14, "column": 9 }, "end": { "line": 14, "column": 14 }, "identifierName": "Proxy" }, "name": "Proxy" }, "extra": { "parenthesizedArgument": false } }, "consequent": { "type": "BlockStatement", "start": 604, "end": 636, "loc": { "start": { "line": 14, "column": 16 }, "end": { "line": 16, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 615, "end": 629, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 22 } }, "argument": { "type": "Identifier", "start": 622, "end": 628, "loc": { "start": { "line": 15, "column": 15 }, "end": { "line": 15, "column": 21 }, "identifierName": "target" }, "name": "target" } } ], "directives": [] }, "alternate": null }, { "type": "ReturnStatement", "start": 642, "end": 960, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 25, "column": 7 } }, "argument": { "type": "NewExpression", "start": 649, "end": 959, "loc": { "start": { "line": 17, "column": 11 }, "end": { "line": 25, "column": 6 } }, "callee": { "type": "Identifier", "start": 653, "end": 658, "loc": { "start": { "line": 17, "column": 15 }, "end": { "line": 17, "column": 20 }, "identifierName": "Proxy" }, "name": "Proxy" }, "arguments": [ { "type": "Identifier", "start": 659, "end": 665, "loc": { "start": { "line": 17, "column": 21 }, "end": { "line": 17, "column": 27 }, "identifierName": "target" }, "name": "target" }, { "type": "ObjectExpression", "start": 667, "end": 958, "loc": { "start": { "line": 17, "column": 29 }, "end": { "line": 25, "column": 5 } }, "properties": [ { "type": "ObjectProperty", "start": 678, "end": 951, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 24, "column": 9 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 678, "end": 681, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 11 }, "identifierName": "get" }, "name": "get" }, "value": { "type": "FunctionExpression", "start": 683, "end": 951, "loc": { "start": { "line": 18, "column": 13 }, "end": { "line": 24, "column": 9 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 692, "end": 698, "loc": { "start": { "line": 18, "column": 22 }, "end": { "line": 18, "column": 28 }, "identifierName": "target" }, "name": "target" }, { "type": "Identifier", "start": 700, "end": 708, "loc": { "start": { "line": 18, "column": 30 }, "end": { "line": 18, "column": 38 }, "identifierName": "property" }, "name": "property" } ], "body": { "type": "BlockStatement", "start": 710, "end": 951, "loc": { "start": { "line": 18, "column": 40 }, "end": { "line": 24, "column": 9 } }, "body": [ { "type": "IfStatement", "start": 725, "end": 940, "loc": { "start": { "line": 19, "column": 12 }, "end": { "line": 23, "column": 13 } }, "test": { "type": "BinaryExpression", "start": 729, "end": 747, "loc": { "start": { "line": 19, "column": 16 }, "end": { "line": 19, "column": 34 } }, "left": { "type": "Identifier", "start": 729, "end": 737, "loc": { "start": { "line": 19, "column": 16 }, "end": { "line": 19, "column": 24 }, "identifierName": "property" }, "name": "property" }, "operator": "in", "right": { "type": "Identifier", "start": 741, "end": 747, "loc": { "start": { "line": 19, "column": 28 }, "end": { "line": 19, "column": 34 }, "identifierName": "target" }, "name": "target" } }, "consequent": { "type": "BlockStatement", "start": 749, "end": 807, "loc": { "start": { "line": 19, "column": 36 }, "end": { "line": 21, "column": 13 } }, "body": [ { "type": "ReturnStatement", "start": 768, "end": 792, "loc": { "start": { "line": 20, "column": 16 }, "end": { "line": 20, "column": 40 } }, "argument": { "type": "MemberExpression", "start": 775, "end": 791, "loc": { "start": { "line": 20, "column": 23 }, "end": { "line": 20, "column": 39 } }, "object": { "type": "Identifier", "start": 775, "end": 781, "loc": { "start": { "line": 20, "column": 23 }, "end": { "line": 20, "column": 29 }, "identifierName": "target" }, "name": "target" }, "property": { "type": "Identifier", "start": 782, "end": 790, "loc": { "start": { "line": 20, "column": 30 }, "end": { "line": 20, "column": 38 }, "identifierName": "property" }, "name": "property" }, "computed": true } } ], "directives": [] }, "alternate": { "type": "BlockStatement", "start": 813, "end": 940, "loc": { "start": { "line": 21, "column": 19 }, "end": { "line": 23, "column": 13 } }, "body": [ { "type": "ThrowStatement", "start": 832, "end": 925, "loc": { "start": { "line": 22, "column": 16 }, "end": { "line": 22, "column": 109 } }, "argument": { "type": "NewExpression", "start": 838, "end": 924, "loc": { "start": { "line": 22, "column": 22 }, "end": { "line": 22, "column": 108 } }, "callee": { "type": "Identifier", "start": 842, "end": 856, "loc": { "start": { "line": 22, "column": 26 }, "end": { "line": 22, "column": 40 }, "identifierName": "ReferenceError" }, "name": "ReferenceError" }, "arguments": [ { "type": "TemplateLiteral", "start": 857, "end": 923, "loc": { "start": { "line": 22, "column": 41 }, "end": { "line": 22, "column": 107 } }, "expressions": [ { "type": "Identifier", "start": 912, "end": 920, "loc": { "start": { "line": 22, "column": 96 }, "end": { "line": 22, "column": 104 }, "identifierName": "property" }, "name": "property" } ], "quasis": [ { "type": "TemplateElement", "start": 858, "end": 910, "loc": { "start": { "line": 22, "column": 42 }, "end": { "line": 22, "column": 94 } }, "value": { "raw": "[defensive] Unable to access non-existing property '", "cooked": "[defensive] Unable to access non-existing property '" }, "tail": false }, { "type": "TemplateElement", "start": 921, "end": 922, "loc": { "start": { "line": 22, "column": 105 }, "end": { "line": 22, "column": 106 } }, "value": { "raw": "'", "cooked": "'" }, "tail": true } ] } ] } } ], "directives": [] } } ], "directives": [] } } } ] } ] } } ], "directives": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * Wraps the given object in a Proxy and throws an error when undefined properties are accessed.\r\n * Useful to prevent subtile bugs due to typos in property names.\r\n *\r\n * In unsupported browsers, the original target object is returned.\r\n *\r\n * @param {object} target - The target object\r\n * @return {Proxy|object} - Either a proxy that guards the target object, or the target object itself\r\n *\r\n * @see https://www.nczonline.net/blog/2014/04/22/creating-defensive-objects-with-es6-proxies/\r\n ", "start": 0, "end": 500, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 11, "column": 3 } } } ], "trailingComments": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * Wraps the given object in a Proxy and throws an error when undefined properties are accessed.\r\n * Useful to prevent subtile bugs due to typos in property names.\r\n *\r\n * In unsupported browsers, the original target object is returned.\r\n *\r\n * @param {object} target - The target object\r\n * @return {Proxy|object} - Either a proxy that guards the target object, or the target object itself\r\n *\r\n * @see https://www.nczonline.net/blog/2014/04/22/creating-defensive-objects-with-es6-proxies/\r\n ", "start": 0, "end": 500, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 11, "column": 3 } } } ] } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": "*\r\n * Wraps the given object in a Proxy and throws an error when undefined properties are accessed.\r\n * Useful to prevent subtile bugs due to typos in property names.\r\n *\r\n * In unsupported browsers, the original target object is returned.\r\n *\r\n * @param {object} target - The target object\r\n * @return {Proxy|object} - Either a proxy that guards the target object, or the target object itself\r\n *\r\n * @see https://www.nczonline.net/blog/2014/04/22/creating-defensive-objects-with-es6-proxies/\r\n ", "start": 0, "end": 500, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 11, "column": 3 } } } ], "tokens": [ { "type": "CommentBlock", "value": "*\r\n * Wraps the given object in a Proxy and throws an error when undefined properties are accessed.\r\n * Useful to prevent subtile bugs due to typos in property names.\r\n *\r\n * In unsupported browsers, the original target object is returned.\r\n *\r\n * @param {object} target - The target object\r\n * @return {Proxy|object} - Either a proxy that guards the target object, or the target object itself\r\n *\r\n * @see https://www.nczonline.net/blog/2014/04/22/creating-defensive-objects-with-es6-proxies/\r\n ", "start": 0, "end": 500, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 11, "column": 3 } } }, { "type": { "label": "export", "keyword": "export", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "export", "start": 502, "end": 508, "loc": { "start": { "line": 12, "column": 0 }, "end": { "line": 12, "column": 6 } } }, { "type": { "label": "default", "keyword": "default", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "default", "start": 509, "end": 516, "loc": { "start": { "line": 12, "column": 7 }, "end": { "line": 12, "column": 14 } } }, { "type": { "label": "function", "keyword": "function", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "function", "start": 517, "end": 525, "loc": { "start": { "line": 12, "column": 15 }, "end": { "line": 12, "column": 23 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "createDefensiveObject", "start": 526, "end": 547, "loc": { "start": { "line": 12, "column": 24 }, "end": { "line": 12, "column": 45 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 547, "end": 548, "loc": { "start": { "line": 12, "column": 45 }, "end": { "line": 12, "column": 46 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "target", "start": 548, "end": 554, "loc": { "start": { "line": 12, "column": 46 }, "end": { "line": 12, "column": 52 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 554, "end": 555, "loc": { "start": { "line": 12, "column": 52 }, "end": { "line": 12, "column": 53 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 556, "end": 557, "loc": { "start": { "line": 12, "column": 54 }, "end": { "line": 12, "column": 55 } } }, { "type": { "label": "const", "keyword": "const", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "const", "start": 563, "end": 568, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 9 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 569, "end": 570, "loc": { "start": { "line": 13, "column": 10 }, "end": { "line": 13, "column": 11 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "Proxy", "start": 570, "end": 575, "loc": { "start": { "line": 13, "column": 11 }, "end": { "line": 13, "column": 16 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 575, "end": 576, "loc": { "start": { "line": 13, "column": 16 }, "end": { "line": 13, "column": 17 } } }, { "type": { "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "=", "start": 577, "end": 578, "loc": { "start": { "line": 13, "column": 18 }, "end": { "line": 13, "column": 19 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "window", "start": 579, "end": 585, "loc": { "start": { "line": 13, "column": 20 }, "end": { "line": 13, "column": 26 } } }, { "type": { "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 585, "end": 586, "loc": { "start": { "line": 13, "column": 26 }, "end": { "line": 13, "column": 27 } } }, { "type": { "label": "if", "keyword": "if", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "if", "start": 592, "end": 594, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 6 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 595, "end": 596, "loc": { "start": { "line": 14, "column": 7 }, "end": { "line": 14, "column": 8 } } }, { "type": { "label": "prefix", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": true, "postfix": false, "binop": null, "updateContext": null }, "value": "!", "start": 596, "end": 597, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 9 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "Proxy", "start": 597, "end": 602, "loc": { "start": { "line": 14, "column": 9 }, "end": { "line": 14, "column": 14 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 602, "end": 603, "loc": { "start": { "line": 14, "column": 14 }, "end": { "line": 14, "column": 15 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 604, "end": 605, "loc": { "start": { "line": 14, "column": 16 }, "end": { "line": 14, "column": 17 } } }, { "type": { "label": "return", "keyword": "return", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "return", "start": 615, "end": 621, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 14 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "target", "start": 622, "end": 628, "loc": { "start": { "line": 15, "column": 15 }, "end": { "line": 15, "column": 21 } } }, { "type": { "label": ";", "beforeExpr": true, "startsExpr": false, "rightAs