@xailabs/altx
Version:
Flux flavor based on alt.js
1,596 lines (1,595 loc) • 198 kB
JSON
{
"type": "File",
"start": 0,
"end": 1396,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 47,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 1396,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 47,
"column": 1
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 146,
"end": 168,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 22
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 153,
"end": 156,
"loc": {
"start": {
"line": 6,
"column": 7
},
"end": {
"line": 6,
"column": 10
}
},
"local": {
"type": "Identifier",
"start": 153,
"end": 156,
"loc": {
"start": {
"line": 6,
"column": 7
},
"end": {
"line": 6,
"column": 10
},
"identifierName": "Alt"
},
"name": "Alt",
"leadingComments": null
},
"leadingComments": null
}
],
"source": {
"type": "StringLiteral",
"start": 162,
"end": 167,
"loc": {
"start": {
"line": 6,
"column": 16
},
"end": {
"line": 6,
"column": 21
}
},
"extra": {
"rawValue": "alt",
"raw": "'alt'"
},
"value": "alt"
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * This is the alt instance that holds the state of the entire application.\r\n * All stores and actions are created on this instance.\r\n ",
"start": 0,
"end": 142,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 4,
"column": 3
}
}
}
]
},
{
"type": "VariableDeclaration",
"start": 172,
"end": 185,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 8,
"column": 13
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 176,
"end": 184,
"loc": {
"start": {
"line": 8,
"column": 4
},
"end": {
"line": 8,
"column": 12
}
},
"id": {
"type": "Identifier",
"start": 176,
"end": 184,
"loc": {
"start": {
"line": 8,
"column": 4
},
"end": {
"line": 8,
"column": 12
},
"identifierName": "instance"
},
"name": "instance"
},
"init": null
}
],
"kind": "let"
},
{
"type": "ExpressionStatement",
"start": 189,
"end": 215,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 10,
"column": 26
}
},
"expression": {
"type": "CallExpression",
"start": 189,
"end": 214,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 10,
"column": 25
}
},
"callee": {
"type": "Identifier",
"start": 189,
"end": 203,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 10,
"column": 14
},
"identifierName": "setAltInstance"
},
"name": "setAltInstance"
},
"arguments": [
{
"type": "NewExpression",
"start": 204,
"end": 213,
"loc": {
"start": {
"line": 10,
"column": 15
},
"end": {
"line": 10,
"column": 24
}
},
"callee": {
"type": "Identifier",
"start": 208,
"end": 211,
"loc": {
"start": {
"line": 10,
"column": 19
},
"end": {
"line": 10,
"column": 22
},
"identifierName": "Alt"
},
"name": "Alt"
},
"arguments": []
}
]
}
},
{
"type": "ExportNamedDeclaration",
"start": 219,
"end": 315,
"loc": {
"start": {
"line": 12,
"column": 0
},
"end": {
"line": 15,
"column": 1
}
},
"specifiers": [],
"source": null,
"declaration": {
"type": "FunctionDeclaration",
"start": 226,
"end": 315,
"loc": {
"start": {
"line": 12,
"column": 7
},
"end": {
"line": 15,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 235,
"end": 249,
"loc": {
"start": {
"line": 12,
"column": 16
},
"end": {
"line": 12,
"column": 30
},
"identifierName": "setAltInstance"
},
"name": "setAltInstance"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 250,
"end": 253,
"loc": {
"start": {
"line": 12,
"column": 31
},
"end": {
"line": 12,
"column": 34
},
"identifierName": "alt"
},
"name": "alt"
}
],
"body": {
"type": "BlockStatement",
"start": 255,
"end": 315,
"loc": {
"start": {
"line": 12,
"column": 36
},
"end": {
"line": 15,
"column": 1
}
},
"body": [
{
"type": "IfStatement",
"start": 262,
"end": 295,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 37
}
},
"test": {
"type": "Identifier",
"start": 266,
"end": 274,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 16
},
"identifierName": "instance"
},
"name": "instance"
},
"consequent": {
"type": "ExpressionStatement",
"start": 276,
"end": 295,
"loc": {
"start": {
"line": 13,
"column": 18
},
"end": {
"line": 13,
"column": 37
}
},
"expression": {
"type": "CallExpression",
"start": 276,
"end": 294,
"loc": {
"start": {
"line": 13,
"column": 18
},
"end": {
"line": 13,
"column": 36
}
},
"callee": {
"type": "Identifier",
"start": 276,
"end": 284,
"loc": {
"start": {
"line": 13,
"column": 18
},
"end": {
"line": 13,
"column": 26
},
"identifierName": "teardown"
},
"name": "teardown"
},
"arguments": [
{
"type": "Identifier",
"start": 285,
"end": 293,
"loc": {
"start": {
"line": 13,
"column": 27
},
"end": {
"line": 13,
"column": 35
},
"identifierName": "instance"
},
"name": "instance"
}
]
}
},
"alternate": null
},
{
"type": "ExpressionStatement",
"start": 301,
"end": 312,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 15
}
},
"expression": {
"type": "CallExpression",
"start": 301,
"end": 311,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 14
}
},
"callee": {
"type": "Identifier",
"start": 301,
"end": 306,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 9
},
"identifierName": "setup"
},
"name": "setup"
},
"arguments": [
{
"type": "Identifier",
"start": 307,
"end": 310,
"loc": {
"start": {
"line": 14,
"column": 10
},
"end": {
"line": 14,
"column": 13
},
"identifierName": "alt"
},
"name": "alt"
}
]
}
}
],
"directives": []
},
"leadingComments": [],
"trailingComments": []
}
},
{
"type": "ExportNamedDeclaration",
"start": 317,
"end": 376,
"loc": {
"start": {
"line": 16,
"column": 0
},
"end": {
"line": 18,
"column": 1
}
},
"specifiers": [],
"source": null,
"declaration": {
"type": "FunctionDeclaration",
"start": 324,
"end": 376,
"loc": {
"start": {
"line": 16,
"column": 7
},
"end": {
"line": 18,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 333,
"end": 347,
"loc": {
"start": {
"line": 16,
"column": 16
},
"end": {
"line": 16,
"column": 30
},
"identifierName": "getAltInstance"
},
"name": "getAltInstance"
},
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 350,
"end": 376,
"loc": {
"start": {
"line": 16,
"column": 33
},
"end": {
"line": 18,
"column": 1
}
},
"body": [
{
"type": "ReturnStatement",
"start": 357,
"end": 373,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 20
}
},
"argument": {
"type": "Identifier",
"start": 364,
"end": 372,
"loc": {
"start": {
"line": 17,
"column": 11
},
"end": {
"line": 17,
"column": 19
},
"identifierName": "instance"
},
"name": "instance"
}
}
],
"directives": []
},
"leadingComments": [],
"trailingComments": []
}
},
{
"type": "VariableDeclaration",
"start": 384,
"end": 416,
"loc": {
"start": {
"line": 22,
"column": 0
},
"end": {
"line": 22,
"column": 32
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 390,
"end": 415,
"loc": {
"start": {
"line": 22,
"column": 6
},
"end": {
"line": 22,
"column": 31
}
},
"id": {
"type": "Identifier",
"start": 390,
"end": 394,
"loc": {
"start": {
"line": 22,
"column": 6
},
"end": {
"line": 22,
"column": 10
},
"identifierName": "root"
},
"name": "root"
},
"init": {
"type": "LogicalExpression",
"start": 398,
"end": 414,
"loc": {
"start": {
"line": 22,
"column": 14
},
"end": {
"line": 22,
"column": 30
}
},
"left": {
"type": "Identifier",
"start": 398,
"end": 404,
"loc": {
"start": {
"line": 22,
"column": 14
},
"end": {
"line": 22,
"column": 20
},
"identifierName": "global"
},
"name": "global"
},
"operator": "||",
"right": {
"type": "Identifier",
"start": 408,
"end": 414,
"loc": {
"start": {
"line": 22,
"column": 24
},
"end": {
"line": 22,
"column": 30
},
"identifierName": "window"
},
"name": "window"
},
"extra": {
"parenthesized": true,
"parenStart": 397
}
}
}
],
"kind": "const"
},
{
"type": "FunctionDeclaration",
"start": 420,
"end": 1204,
"loc": {
"start": {
"line": 24,
"column": 0
},
"end": {
"line": 42,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 429,
"end": 434,
"loc": {
"start": {
"line": 24,
"column": 9
},
"end": {
"line": 24,
"column": 14
},
"identifierName": "setup"
},
"name": "setup"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 435,
"end": 438,
"loc": {
"start": {
"line": 24,
"column": 15
},
"end": {
"line": 24,
"column": 18
},
"identifierName": "alt"
},
"name": "alt"
}
],
"body": {
"type": "BlockStatement",
"start": 440,
"end": 1204,
"loc": {
"start": {
"line": 24,
"column": 20
},
"end": {
"line": 42,
"column": 1
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 447,
"end": 462,
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 25,
"column": 19
}
},
"expression": {
"type": "AssignmentExpression",
"start": 447,
"end": 461,
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 25,
"column": 18
}
},
"operator": "=",
"left": {
"type": "Identifier",
"start": 447,
"end": 455,
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 25,
"column": 12
},
"identifierName": "instance"
},
"name": "instance"
},
"right": {
"type": "Identifier",
"start": 458,
"end": 461,
"loc": {
"start": {
"line": 25,
"column": 15
},
"end": {
"line": 25,
"column": 18
},
"identifierName": "alt"
},
"name": "alt"
}
}
},
{
"type": "IfStatement",
"start": 468,
"end": 1201,
"loc": {
"start": {
"line": 26,
"column": 4
},
"end": {
"line": 41,
"column": 5
}
},
"test": {
"type": "BinaryExpression",
"start": 472,
"end": 509,
"loc": {
"start": {
"line": 26,
"column": 8
},
"end": {
"line": 26,
"column": 45
}
},
"left": {
"type": "MemberExpression",
"start": 472,
"end": 492,
"loc": {
"start": {
"line": 26,
"column": 8
},
"end": {
"line": 26,
"column": 28
}
},
"object": {
"type": "MemberExpression",
"start": 472,
"end": 483,
"loc": {
"start": {
"line": 26,
"column": 8
},
"end": {
"line": 26,
"column": 19
}
},
"object": {
"type": "Identifier",
"start": 472,
"end": 479,
"loc": {
"start": {
"line": 26,
"column": 8
},
"end": {
"line": 26,
"column": 15
},
"identifierName": "process"
},
"name": "process"
},
"property": {
"type": "Identifier",
"start": 480,
"end": 483,
"loc": {
"start": {
"line": 26,
"column": 16
},
"end": {
"line": 26,
"column": 19
},
"identifierName": "env"
},
"name": "env"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 484,
"end": 492,
"loc": {
"start": {
"line": 26,
"column": 20
},
"end": {
"line": 26,
"column": 28
},
"identifierName": "NODE_ENV"
},
"name": "NODE_ENV"
},
"computed": false
},
"operator": "!==",
"right": {
"type": "StringLiteral",
"start": 497,
"end": 509,
"loc": {
"start": {
"line": 26,
"column": 33
},
"end": {
"line": 26,
"column": 45
}
},
"extra": {
"rawValue": "production",
"raw": "'production'"
},
"value": "production"
}
},
"consequent": {
"type": "BlockStatement",
"start": 511,
"end": 1201,
"loc": {
"start": {
"line": 26,
"column": 47
},
"end": {
"line": 41,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 627,
"end": 674,
"loc": {
"start": {
"line": 30,
"column": 8
},
"end": {
"line": 30,
"column": 55
}
},
"expression": {
"type": "CallExpression",
"start": 627,
"end": 673,
"loc": {
"start": {
"line": 30,
"column": 8
},
"end": {
"line": 30,
"column": 54
}
},
"callee": {
"type": "CallExpression",
"start": 627,
"end": 663,
"loc": {
"start": {
"line": 30,
"column": 8
},
"end": {
"line": 30,
"column": 44
}
},
"callee": {
"type": "Identifier",
"start": 627,
"end": 634,
"loc": {
"start": {
"line": 30,
"column": 8
},
"end": {
"line": 30,
"column": 15
},
"identifierName": "require"
},
"name": "require",
"leadingComments": null
},
"arguments": [
{
"type": "StringLiteral",
"start": 635,
"end": 662,
"loc": {
"start": {
"line": 30,
"column": 16
},
"end": {
"line": 30,
"column": 43
}
},
"extra": {
"rawValue": "alt-utils/lib/chromeDebug",
"raw": "'alt-utils/lib/chromeDebug'"
},
"value": "alt-utils/lib/chromeDebug"
}
],
"leadingComments": null
},
"arguments": [
{
"type": "Identifier",
"start": 664,
"end": 672,
"loc": {
"start": {
"line": 30,
"column": 45
},
"end": {
"line": 30,
"column": 53
},
"identifierName": "instance"
},
"name": "instance"
}
],
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentLine",
"value": " Debugging with chrome devtools",
"start": 524,
"end": 557,
"loc": {
"start": {
"line": 28,
"column": 8
},
"end": {
"line": 28,
"column": 41
}
}
},
{
"type": "CommentLine",
"value": " @see https://github.com/goatslacker/alt-devtool",
"start": 567,
"end": 617,
"loc": {
"start": {
"line": 29,
"column": 8
},
"end": {
"line": 29,
"column": 58
}
}
}
],
"trailingComments": [
{
"type": "CommentLine",
"value": " sometimes, chromeDebug just doesn't update until an action is dispatched.",
"start": 686,
"end": 762,
"loc": {
"start": {
"line": 32,
"column": 8
},
"end": {
"line": 32,
"column": 84
}
}
},
{
"type": "CommentLine",
"value": " we use a dummy action to do just that",
"start": 772,
"end": 812,
"loc": {
"start": {
"line": 33,
"column": 8
},
"end": {
"line": 33,
"column": 48
}
}
}
]
},
{
"type": "VariableDeclaration",
"start": 822,
"end": 896,
"loc": {
"start": {
"line": 34,
"column": 8
},
"end": {
"line": 34,
"column": 82
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 828,
"end": 895,
"loc": {
"start": {
"line": 34,
"column": 14
},
"end": {
"line": 34,
"column": 81
}
},
"id": {
"type": "Identifier",
"start": 828,
"end": 841,
"loc": {
"start": {
"line": 34,
"column": 14
},
"end": {
"line": 34,
"column": 27
},
"identifierName": "refreshAction"
},
"name": "refreshAction",
"leadingComments": null
},
"init": {
"type": "MemberExpression",
"start": 844,
"end": 895,
"loc": {
"start": {
"line": 34,
"column": 30
},
"end": {
"line": 34,
"column": 81
}
},
"object": {
"type": "CallExpression",
"start": 844,
"end": 883,
"loc": {
"start": {
"line": 34,
"column": 30
},
"end": {
"line": 34,
"column": 69
}
},
"callee": {
"type": "MemberExpression",
"start": 844,
"end": 868,
"loc": {
"start": {
"line": 34,
"column": 30
},
"end": {
"line": 34,
"column": 54
}
},
"object": {
"type": "Identifier",
"start": 844,
"end": 852,
"loc": {
"start": {
"line": 34,
"column": 30
},
"end": {
"line": 34,
"column": 38
},
"identifierName": "instance"
},
"name": "instance"
},
"property": {
"type": "Identifier",
"start": 853,
"end": 868,
"loc": {
"start": {
"line": 34,
"column": 39
},
"end": {
"line": 34,
"column": 54
},
"identifierName": "generateActions"
},
"name": "generateActions"
},
"computed": false
},
"arguments": [
{
"type": "StringLiteral",
"start": 869,
"end": 882,
"loc": {
"start": {
"line": 34,
"column": 55
},
"end": {
"line": 34,
"column": 68
}
},
"extra": {
"rawValue": "__refresh__",
"raw": "'__refresh__'"
},
"value": "__refresh__"
}
]
},
"property": {
"type": "Identifier",
"start": 884,
"end": 895,
"loc": {
"start": {
"line": 34,
"column": 70
},
"end": {
"line": 34,
"column": 81
},
"identifierName": "__refresh__"
},
"name": "__refresh__"
},
"computed": false
},
"leadingComments": null
}
],
"kind": "const",
"leadingComments": [
{
"type": "CommentLine",
"value": " sometimes, chromeDebug just doesn't update until an action is dispatched.",
"start": 686,
"end": 762,
"loc": {
"start": {
"line": 32,
"column": 8
},
"end": {
"line": 32,
"column": 84
}
}
},
{
"type": "CommentLine",
"value": " we use a dummy action to do just that",
"start": 772,
"end": 812,
"loc": {
"start": {
"line": 33,
"column": 8
},
"end": {
"line": 33,
"column": 48
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 906,
"end": 1094,
"loc": {
"start": {
"line": 35,
"column": 8
},
"end": {
"line": 39,
"column": 10
}
},
"expression": {
"type": "AssignmentExpression",
"start": 906,
"end": 1093,
"loc": {
"start": {
"line": 35,
"column": 8
},
"end": {
"line": 39,
"column": 9
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 906,
"end": 928,
"loc": {
"start": {
"line": 35,
"column": 8
},
"end": {
"line": 35,
"column": 30
}
},
"object": {
"type": "Identifier",
"start": 906,
"end": 914,
"loc": {
"start": {
"line": 35,
"column": 8
},
"end": {
"line": 35,
"column": 16
},
"identifierName": "instance"
},
"name": "instance"
},
"property": {
"type": "Identifier",
"start": 915,
"end": 928,
"loc": {
"start": {
"line": 35,
"column": 17
},
"end": {
"line": 35,
"column": 30
},
"identifierName": "handleMessage"
},
"name": "handleMessage"
},
"computed": false
},
"right": {
"type": "ArrowFunctionExpression",
"start": 931,
"end": 1093,
"loc": {
"start": {
"line": 35,
"column": 33
},
"end": {
"line": 39,
"column": 9
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 932,
"end": 933,
"loc": {
"start": {
"line": 35,
"column": 34
},
"end": {
"line": 35,
"column": 35
},
"identifierName": "e"
},
"name": "e"
}
],
"body": {
"type": "BlockStatement",
"start": 938,
"end": 1093,
"loc": {
"start": {
"line": 35,
"column": 40
},
"end": {
"line": 39,
"column": 9
}
},
"body": [
{
"type": "IfStatement",
"start": 953,
"end": 1082,
"loc": {
"start": {
"line": 36,
"column": 12
},
"end": {
"line": 38,
"column": 13
}
},
"test": {
"type": "LogicalExpression",
"start": 957,
"end": 1024,
"loc": {
"start": {
"line": 36,
"column": 16
},
"end": {
"line": 36,
"column": 83
}
},
"left": {
"type": "LogicalExpression",
"start": 957,
"end": 988,
"loc": {
"start": {
"line": 36,
"column": 16
},
"end": {
"line": 36,
"column": 47
}
},
"left": {
"type": "MemberExpression",
"start": 957,
"end": 963,
"loc": {
"start": {
"line": 36,
"column": 16
},
"end": {
"line": 36,
"column": 22
}
},
"object": {
"type": "Identifier",
"start": 957,
"end": 958,
"loc": {
"start": {
"line": 36,
"column": 16
},
"end": {
"line": 36,
"column": 17
},
"identifierName": "e"
},
"name": "e"
},
"property": {
"type": "Identifier",
"start": 959,
"end": 963,
"loc": {
"start": {
"line": 36,
"column": 18
},
"end": {
"line": 36,
"column": 22
},