@xailabs/altx
Version:
Flux flavor based on alt.js
1,497 lines (1,496 loc) • 352 kB
JSON
{
"type": "File",
"start": 0,
"end": 3208,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 88,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 3208,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 88,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 46
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 8,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 12
}
},
"imported": {
"type": "Identifier",
"start": 8,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 12
},
"identifierName": "bind"
},
"name": "bind"
},
"local": {
"type": "Identifier",
"start": 8,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 12
},
"identifierName": "bind"
},
"name": "bind"
}
}
],
"source": {
"type": "StringLiteral",
"start": 19,
"end": 45,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 45
}
},
"extra": {
"rawValue": "alt-utils/lib/decorators",
"raw": "'alt-utils/lib/decorators'"
},
"value": "alt-utils/lib/decorators"
}
},
{
"type": "ImportDeclaration",
"start": 48,
"end": 93,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 45
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 55,
"end": 68,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 20
}
},
"local": {
"type": "Identifier",
"start": 55,
"end": 68,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 20
},
"identifierName": "flattenArrays"
},
"name": "flattenArrays"
}
}
],
"source": {
"type": "StringLiteral",
"start": 74,
"end": 92,
"loc": {
"start": {
"line": 2,
"column": 26
},
"end": {
"line": 2,
"column": 44
}
},
"extra": {
"rawValue": "../utils/flatten",
"raw": "'../utils/flatten'"
},
"value": "../utils/flatten"
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Decorates a store with any number of action handlers.\r\n ",
"start": 97,
"end": 163,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 6,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 165,
"end": 518,
"loc": {
"start": {
"line": 7,
"column": 0
},
"end": {
"line": 13,
"column": 1
}
},
"declaration": {
"type": "FunctionDeclaration",
"start": 180,
"end": 518,
"loc": {
"start": {
"line": 7,
"column": 15
},
"end": {
"line": 13,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 189,
"end": 201,
"loc": {
"start": {
"line": 7,
"column": 24
},
"end": {
"line": 7,
"column": 36
},
"identifierName": "bindHandlers"
},
"name": "bindHandlers",
"leadingComments": null
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 202,
"end": 209,
"loc": {
"start": {
"line": 7,
"column": 37
},
"end": {
"line": 7,
"column": 44
},
"identifierName": "actions"
},
"name": "actions"
},
{
"type": "RestElement",
"start": 211,
"end": 222,
"loc": {
"start": {
"line": 7,
"column": 46
},
"end": {
"line": 7,
"column": 57
}
},
"argument": {
"type": "Identifier",
"start": 214,
"end": 222,
"loc": {
"start": {
"line": 7,
"column": 49
},
"end": {
"line": 7,
"column": 57
},
"identifierName": "handlers"
},
"name": "handlers"
}
}
],
"body": {
"type": "BlockStatement",
"start": 224,
"end": 518,
"loc": {
"start": {
"line": 7,
"column": 59
},
"end": {
"line": 13,
"column": 1
}
},
"body": [
{
"type": "ReturnStatement",
"start": 231,
"end": 515,
"loc": {
"start": {
"line": 8,
"column": 4
},
"end": {
"line": 12,
"column": 6
}
},
"argument": {
"type": "FunctionExpression",
"start": 238,
"end": 514,
"loc": {
"start": {
"line": 8,
"column": 11
},
"end": {
"line": 12,
"column": 5
}
},
"id": {
"type": "Identifier",
"start": 247,
"end": 260,
"loc": {
"start": {
"line": 8,
"column": 20
},
"end": {
"line": 8,
"column": 33
},
"identifierName": "decorateStore"
},
"name": "decorateStore"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 261,
"end": 271,
"loc": {
"start": {
"line": 8,
"column": 34
},
"end": {
"line": 8,
"column": 44
},
"identifierName": "storeClass"
},
"name": "storeClass"
}
],
"body": {
"type": "BlockStatement",
"start": 273,
"end": 514,
"loc": {
"start": {
"line": 8,
"column": 46
},
"end": {
"line": 12,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 372,
"end": 479,
"loc": {
"start": {
"line": 10,
"column": 8
},
"end": {
"line": 10,
"column": 115
}
},
"expression": {
"type": "CallExpression",
"start": 372,
"end": 478,
"loc": {
"start": {
"line": 10,
"column": 8
},
"end": {
"line": 10,
"column": 114
}
},
"callee": {
"type": "MemberExpression",
"start": 372,
"end": 403,
"loc": {
"start": {
"line": 10,
"column": 8
},
"end": {
"line": 10,
"column": 39
}
},
"object": {
"type": "CallExpression",
"start": 372,
"end": 395,
"loc": {
"start": {
"line": 10,
"column": 8
},
"end": {
"line": 10,
"column": 31
}
},
"callee": {
"type": "Identifier",
"start": 372,
"end": 385,
"loc": {
"start": {
"line": 10,
"column": 8
},
"end": {
"line": 10,
"column": 21
},
"identifierName": "flattenArrays"
},
"name": "flattenArrays",
"leadingComments": null
},
"arguments": [
{
"type": "Identifier",
"start": 386,
"end": 394,
"loc": {
"start": {
"line": 10,
"column": 22
},
"end": {
"line": 10,
"column": 30
},
"identifierName": "handlers"
},
"name": "handlers"
}
],
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 396,
"end": 403,
"loc": {
"start": {
"line": 10,
"column": 32
},
"end": {
"line": 10,
"column": 39
},
"identifierName": "forEach"
},
"name": "forEach"
},
"computed": false,
"leadingComments": null
},
"arguments": [
{
"type": "ArrowFunctionExpression",
"start": 404,
"end": 477,
"loc": {
"start": {
"line": 10,
"column": 40
},
"end": {
"line": 10,
"column": 113
}
},
"id": null,
"generator": false,
"expression": true,
"async": false,
"params": [
{
"type": "Identifier",
"start": 404,
"end": 411,
"loc": {
"start": {
"line": 10,
"column": 40
},
"end": {
"line": 10,
"column": 47
},
"identifierName": "handler"
},
"name": "handler"
}
],
"body": {
"type": "CallExpression",
"start": 415,
"end": 477,
"loc": {
"start": {
"line": 10,
"column": 51
},
"end": {
"line": 10,
"column": 113
}
},
"callee": {
"type": "Identifier",
"start": 415,
"end": 433,
"loc": {
"start": {
"line": 10,
"column": 51
},
"end": {
"line": 10,
"column": 69
},
"identifierName": "attachBoundHandler"
},
"name": "attachBoundHandler"
},
"arguments": [
{
"type": "Identifier",
"start": 434,
"end": 444,
"loc": {
"start": {
"line": 10,
"column": 70
},
"end": {
"line": 10,
"column": 80
},
"identifierName": "storeClass"
},
"name": "storeClass"
},
{
"type": "MemberExpression",
"start": 446,
"end": 467,
"loc": {
"start": {
"line": 10,
"column": 82
},
"end": {
"line": 10,
"column": 103
}
},
"object": {
"type": "Identifier",
"start": 446,
"end": 453,
"loc": {
"start": {
"line": 10,
"column": 82
},
"end": {
"line": 10,
"column": 89
},
"identifierName": "actions"
},
"name": "actions"
},
"property": {
"type": "MemberExpression",
"start": 454,
"end": 466,
"loc": {
"start": {
"line": 10,
"column": 90
},
"end": {
"line": 10,
"column": 102
}
},
"object": {
"type": "Identifier",
"start": 454,
"end": 461,
"loc": {
"start": {
"line": 10,
"column": 90
},
"end": {
"line": 10,
"column": 97
},
"identifierName": "handler"
},
"name": "handler"
},
"property": {
"type": "Identifier",
"start": 462,
"end": 466,
"loc": {
"start": {
"line": 10,
"column": 98
},
"end": {
"line": 10,
"column": 102
},
"identifierName": "name"
},
"name": "name"
},
"computed": false
},
"computed": true
},
{
"type": "Identifier",
"start": 469,
"end": 476,
"loc": {
"start": {
"line": 10,
"column": 105
},
"end": {
"line": 10,
"column": 112
},
"identifierName": "handler"
},
"name": "handler"
}
]
}
}
],
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentLine",
"value": " attach bound handler methods to the store class for each handler definition",
"start": 284,
"end": 362,
"loc": {
"start": {
"line": 9,
"column": 8
},
"end": {
"line": 9,
"column": 86
}
}
}
]
},
{
"type": "ReturnStatement",
"start": 489,
"end": 507,
"loc": {
"start": {
"line": 11,
"column": 8
},
"end": {
"line": 11,
"column": 26
}
},
"argument": {
"type": "Identifier",
"start": 496,
"end": 506,
"loc": {
"start": {
"line": 11,
"column": 15
},
"end": {
"line": 11,
"column": 25
},
"identifierName": "storeClass"
},
"name": "storeClass"
}
}
],
"directives": []
}
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Decorates a store with any number of action handlers.\r\n ",
"start": 97,
"end": 163,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 6,
"column": 3
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Attaches a single reducer handling to the store.\r\n *\r\n * A new handler method will be created on the store class.\r\n * The handler method invokes the reducer giving it the current store state.\r\n * It then sets the reducer result as the new store state.\r\n *\r\n * If a sideEffect function is defined, it will be called with the signature `{state, prevState, payload}`\r\n *\r\n * @param {object} storeClass - The class of the store to be decorated\r\n * @param {object} action - An altjs action\r\n * @param {object} handler - An handler object with `{name[, reducer, sideEffect]}`\r\n ",
"start": 520,
"end": 1102,
"loc": {
"start": {
"line": 14,
"column": 0
},
"end": {
"line": 26,
"column": 3
}
}
}
]
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Decorates a store with any number of action handlers.\r\n ",
"start": 97,
"end": 163,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 6,
"column": 3
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Attaches a single reducer handling to the store.\r\n *\r\n * A new handler method will be created on the store class.\r\n * The handler method invokes the reducer giving it the current store state.\r\n * It then sets the reducer result as the new store state.\r\n *\r\n * If a sideEffect function is defined, it will be called with the signature `{state, prevState, payload}`\r\n *\r\n * @param {object} storeClass - The class of the store to be decorated\r\n * @param {object} action - An altjs action\r\n * @param {object} handler - An handler object with `{name[, reducer, sideEffect]}`\r\n ",
"start": 520,
"end": 1102,
"loc": {
"start": {
"line": 14,
"column": 0
},
"end": {
"line": 26,
"column": 3
}
}
}
]
},
{
"type": "FunctionDeclaration",
"start": 1104,
"end": 3205,
"loc": {
"start": {
"line": 27,
"column": 0
},
"end": {
"line": 87,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 1113,
"end": 1131,
"loc": {
"start": {
"line": 27,
"column": 9
},
"end": {
"line": 27,
"column": 27
},
"identifierName": "attachBoundHandler"
},
"name": "attachBoundHandler",
"leadingComments": null
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 1132,
"end": 1142,
"loc": {
"start": {
"line": 27,
"column": 28
},
"end": {
"line": 27,
"column": 38
},
"identifierName": "storeClass"
},
"name": "storeClass"
},
{
"type": "Identifier",
"start": 1144,
"end": 1150,
"loc": {
"start": {
"line": 27,
"column": 40
},
"end": {
"line": 27,
"column": 46
},
"identifierName": "action"
},
"name": "action"
},
{
"type": "Identifier",
"start": 1152,
"end": 1159,
"loc": {
"start": {
"line": 27,
"column": 48
},
"end": {
"line": 27,
"column": 55
},
"identifierName": "handler"
},
"name": "handler"
}
],
"body": {
"type": "BlockStatement",
"start": 1161,
"end": 3205,
"loc": {
"start": {
"line": 27,
"column": 57
},
"end": {
"line": 87,
"column": 1
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 1195,
"end": 1241,
"loc": {
"start": {
"line": 30,
"column": 4
},
"end": {
"line": 30,
"column": 50
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 1201,
"end": 1240,
"loc": {
"start": {
"line": 30,
"column": 10
},
"end": {
"line": 30,
"column": 49
}
},
"id": {
"type": "Identifier",
"start": 1201,
"end": 1211,
"loc": {
"start": {
"line": 30,
"column": 10
},
"end": {
"line": 30,
"column": 20
},
"identifierName": "methodName"
},
"name": "methodName",
"leadingComments": null
},
"init": {
"type": "TemplateLiteral",
"start": 1214,
"end": 1240,
"loc": {
"start": {
"line": 30,
"column": 23
},
"end": {
"line": 30,
"column": 49
}
},
"expressions": [
{
"type": "MemberExpression",
"start": 1226,
"end": 1238,
"loc": {
"start": {
"line": 30,
"column": 35
},
"end": {
"line": 30,
"column": 47
}
},
"object": {
"type": "Identifier",
"start": 1226,
"end": 1233,
"loc": {
"start": {
"line": 30,
"column": 35
},
"end": {
"line": 30,
"column": 42
},
"identifierName": "handler"
},
"name": "handler"
},
"property": {
"type": "Identifier",
"start": 1234,
"end": 1238,
"loc": {
"start": {
"line": 30,
"column": 43
},
"end": {
"line": 30,
"column": 47
},
"identifierName": "name"
},
"name": "name"
},
"computed": false
}
],
"quasis": [
{
"type": "TemplateElement",
"start": 1215,
"end": 1224,
"loc": {
"start": {
"line": 30,
"column": 24
},
"end": {
"line": 30,
"column": 33
}
},
"value": {
"raw": "__handle_",
"cooked": "__handle_"
},
"tail": false
},
{
"type": "TemplateElement",
"start": 1239,
"end": 1239,
"loc": {
"start": {
"line": 30,
"column": 48
},
"end": {
"line": 30,
"column": 48
}
},
"value": {
"raw": "",
"cooked": ""
},
"tail": true
}
]
},
"leadingComments": null
}
],
"kind": "const",
"leadingComments": [
{
"type": "CommentLine",
"value": " name is required",
"start": 1168,
"end": 1187,
"loc": {
"start": {
"line": 28,
"column": 4
},
"end": {
"line": 28,
"column": 23
}
}
}
]
},
{
"type": "IfStatement",
"start": 1249,
"end": 1339,
"loc": {
"start": {
"line": 32,
"column": 4
},
"end": {
"line": 32,
"column": 94
}
},
"test": {
"type": "MemberExpression",
"start": 1253,
"end": 1285,
"loc": {
"start": {
"line": 32,
"column": 8
},
"end": {
"line": 32,
"column": 40
}
},
"object": {
"type": "MemberExpression",
"start": 1253,
"end": 1273,
"loc": {
"start": {
"line": 32,
"column": 8
},
"end": {
"line": 32,
"column": 28
}
},
"object": {
"type": "Identifier",
"start": 1253,
"end": 1263,
"loc": {
"start": {
"line": 32,
"column": 8
},
"end": {
"line": 32,
"column": 18
},
"identifierName": "storeClass"
},
"name": "storeClass"
},
"property": {
"type": "Identifier",
"start": 1264,
"end": 1273,
"loc": {
"start": {
"line": 32,
"column": 19
},
"end": {
"line": 32,
"column": 28
},
"identifierName": "prototype"
},
"name": "prototype"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 1274,
"end": 1284,
"loc": {
"start": {
"line": 32,
"column": 29
},
"end": {
"line": 32,
"column": 39
},
"identifierName": "methodName"
},
"name": "methodName"
},
"computed": true
},
"consequent": {
"type": "ThrowStatement",
"start": 1287,
"end": 1339,
"loc": {
"start": {
"line": 32,
"column": 42
},
"end": {
"line": 32,
"column": 94
}
},
"argument": {
"type": "NewExpression",
"start": 1293,
"end": 1338,
"loc": {
"start": {
"line": 32,
"column": 48
},
"end": {
"line": 32,
"column": 93
}
},
"callee": {
"type": "Identifier",
"start": 1297,
"end": 1302,
"loc": {
"start": {
"line": 32,
"column": 52
},
"end": {
"line": 32,
"column": 57
},
"identifierName": "Error"
},
"name": "Error"
},
"arguments": [
{
"type": "TemplateLiteral",
"start": 1303,
"end": 1337,
"loc": {
"start": {
"line": 32,
"column": 58
},
"end": {
"line": 32,
"column": 92
}
},
"expressions": [
{
"type": "Identifier",
"start": 1324,
"end": 1334,
"loc": {
"start": {
"line": 32,
"column": 79
},
"end": {
"line": 32,
"column": 89
},
"identifierName": "methodName"
},
"name": "methodName"
}
],
"quasis": [
{
"type": "TemplateElement",
"start": 1304,
"end": 1322,
"loc": {
"start": {
"line": 32,
"column": 59
},
"end": {
"line": 32,
"column": 77
}
},
"value": {
"raw": "Duplicate method \"",
"cooked": "Duplicate method \""
},
"tail": false
},
{
"type": "TemplateElement",
"start": 1335,
"end": 1336,
"loc": {
"start": {
"line": 32,
"column": 90
},
"end": {
"line": 32,
"column": 91
}
},
"value": {
"raw": "\"",
"cooked": "\""
},
"tail": true
}
]
}
]
},
"trailingComments": null
},
"alternate": null,
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Handles an action call and sets the next state of the store.\r\n *\r\n * @param {any} payload - the single argument that can be specified when calling an action.\r\n * If you need to use more than one argument, use an object with any properties you need.\r\n ",
"start": 1347,
"end": 1649,
"loc": {
"start": {
"line": 34,
"column": 4
},
"end": {
"line": 39,
"column": 7
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 1655,
"end": 3014,
"loc": {
"start": {
"line": 40,
"column": 4
},
"end": {
"line": 77,
"column": 6
}
},
"expression": {
"type": "AssignmentExpression",
"start": 1655,
"end": 3013,
"loc": {
"start": {
"line": 40,
"column": 4
},
"end": {
"line": 77,
"column": 5
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 1655,
"end": 1687,
"loc": {
"start": {
"line": 40,
"column": 4
},
"end": {
"line": 40,
"column": 36
}
},
"object": {
"type": "MemberExpression",
"start": 1655,
"end": 1675,
"loc": {
"start": {
"line": 40,
"column": 4
},
"end": {
"line": 40,
"column": 24
}
},
"object": {
"type": "Identifier",
"start": 1655,
"end": 1665,
"loc": {
"start": {
"line": 40,
"column": 4
},
"end": {
"line": 40,
"column": 14
},
"identifierName": "storeClass"
},
"name": "storeClass",
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 1666,
"end": 1675,
"loc": {
"start": {
"line": 40,
"column": 15
},
"end": {
"line": 40,
"column": 24
},
"identifierName": "prototype"
},
"name": "prototype"
},
"computed": false,
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 1676,
"end": 1686,
"loc": {
"start": {
"line": 40,
"column": 25
},
"end": {
"line": 40,
"column": 35
},
"identifierName": "methodName"
},
"name": "methodName"
},
"computed": true,
"leadingComments": null
},
"right": {
"type": "FunctionExpression",
"start": 1690,
"end": 3013,
"loc": {
"start": {
"line": 40,
"column": 39
},
"end": {
"line": 77,
"column": 5
}
},