UNPKG

backed-cli

Version:

The official command line interface for Backed

1,475 lines (1,474 loc) 1.36 MB
{ "type": "File", "start": 0, "end": 4874, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 150, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 4874, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 150, "column": 0 } }, "sourceType": "module", "body": [ { "type": "VariableDeclaration", "start": 14, "end": 49, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 35 } }, "declarations": [ { "type": "VariableDeclarator", "start": 20, "end": 48, "loc": { "start": { "line": 2, "column": 6 }, "end": { "line": 2, "column": 34 } }, "id": { "type": "Identifier", "start": 20, "end": 27, "loc": { "start": { "line": 2, "column": 6 }, "end": { "line": 2, "column": 13 }, "identifierName": "express" }, "name": "express" }, "init": { "type": "CallExpression", "start": 30, "end": 48, "loc": { "start": { "line": 2, "column": 16 }, "end": { "line": 2, "column": 34 } }, "callee": { "type": "Identifier", "start": 30, "end": 37, "loc": { "start": { "line": 2, "column": 16 }, "end": { "line": 2, "column": 23 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 38, "end": 47, "loc": { "start": { "line": 2, "column": 24 }, "end": { "line": 2, "column": 33 } }, "extra": { "rawValue": "express", "raw": "'express'" }, "value": "express" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 50, "end": 79, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 29 } }, "declarations": [ { "type": "VariableDeclarator", "start": 56, "end": 78, "loc": { "start": { "line": 3, "column": 6 }, "end": { "line": 3, "column": 28 } }, "id": { "type": "Identifier", "start": 56, "end": 60, "loc": { "start": { "line": 3, "column": 6 }, "end": { "line": 3, "column": 10 }, "identifierName": "http" }, "name": "http" }, "init": { "type": "CallExpression", "start": 63, "end": 78, "loc": { "start": { "line": 3, "column": 13 }, "end": { "line": 3, "column": 28 } }, "callee": { "type": "Identifier", "start": 63, "end": 70, "loc": { "start": { "line": 3, "column": 13 }, "end": { "line": 3, "column": 20 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 71, "end": 77, "loc": { "start": { "line": 3, "column": 21 }, "end": { "line": 3, "column": 27 } }, "extra": { "rawValue": "http", "raw": "'http'" }, "value": "http" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 80, "end": 109, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 29 } }, "declarations": [ { "type": "VariableDeclarator", "start": 86, "end": 108, "loc": { "start": { "line": 4, "column": 6 }, "end": { "line": 4, "column": 28 } }, "id": { "type": "Identifier", "start": 86, "end": 90, "loc": { "start": { "line": 4, "column": 6 }, "end": { "line": 4, "column": 10 }, "identifierName": "glob" }, "name": "glob" }, "init": { "type": "CallExpression", "start": 93, "end": 108, "loc": { "start": { "line": 4, "column": 13 }, "end": { "line": 4, "column": 28 } }, "callee": { "type": "Identifier", "start": 93, "end": 100, "loc": { "start": { "line": 4, "column": 13 }, "end": { "line": 4, "column": 20 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 101, "end": 107, "loc": { "start": { "line": 4, "column": 21 }, "end": { "line": 4, "column": 27 } }, "extra": { "rawValue": "glob", "raw": "'glob'" }, "value": "glob" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 110, "end": 137, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 27 } }, "declarations": [ { "type": "VariableDeclarator", "start": 116, "end": 136, "loc": { "start": { "line": 5, "column": 6 }, "end": { "line": 5, "column": 26 } }, "id": { "type": "Identifier", "start": 116, "end": 119, "loc": { "start": { "line": 5, "column": 6 }, "end": { "line": 5, "column": 9 }, "identifierName": "opn" }, "name": "opn" }, "init": { "type": "CallExpression", "start": 122, "end": 136, "loc": { "start": { "line": 5, "column": 12 }, "end": { "line": 5, "column": 26 } }, "callee": { "type": "Identifier", "start": 122, "end": 129, "loc": { "start": { "line": 5, "column": 12 }, "end": { "line": 5, "column": 19 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 130, "end": 135, "loc": { "start": { "line": 5, "column": 20 }, "end": { "line": 5, "column": 25 } }, "extra": { "rawValue": "opn", "raw": "'opn'" }, "value": "opn" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 139, "end": 161, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 7, "column": 22 } }, "declarations": [ { "type": "VariableDeclarator", "start": 145, "end": 160, "loc": { "start": { "line": 7, "column": 6 }, "end": { "line": 7, "column": 21 } }, "id": { "type": "Identifier", "start": 145, "end": 148, "loc": { "start": { "line": 7, "column": 6 }, "end": { "line": 7, "column": 9 }, "identifierName": "app" }, "name": "app" }, "init": { "type": "CallExpression", "start": 151, "end": 160, "loc": { "start": { "line": 7, "column": 12 }, "end": { "line": 7, "column": 21 } }, "callee": { "type": "Identifier", "start": 151, "end": 158, "loc": { "start": { "line": 7, "column": 12 }, "end": { "line": 7, "column": 19 }, "identifierName": "express" }, "name": "express" }, "arguments": [] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 162, "end": 200, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 8, "column": 38 } }, "declarations": [ { "type": "VariableDeclarator", "start": 168, "end": 199, "loc": { "start": { "line": 8, "column": 6 }, "end": { "line": 8, "column": 37 } }, "id": { "type": "Identifier", "start": 168, "end": 174, "loc": { "start": { "line": 8, "column": 6 }, "end": { "line": 8, "column": 12 }, "identifierName": "server" }, "name": "server" }, "init": { "type": "CallExpression", "start": 177, "end": 199, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 8, "column": 37 } }, "callee": { "type": "MemberExpression", "start": 177, "end": 194, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 8, "column": 32 } }, "object": { "type": "Identifier", "start": 177, "end": 181, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 8, "column": 19 }, "identifierName": "http" }, "name": "http" }, "property": { "type": "Identifier", "start": 182, "end": 194, "loc": { "start": { "line": 8, "column": 20 }, "end": { "line": 8, "column": 32 }, "identifierName": "createServer" }, "name": "createServer" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 195, "end": 198, "loc": { "start": { "line": 8, "column": 33 }, "end": { "line": 8, "column": 36 }, "identifierName": "app" }, "name": "app" } ] } } ], "kind": "const", "trailingComments": [ { "type": "CommentLine", "value": " TODO: find better way to reload", "start": 201, "end": 235, "loc": { "start": { "line": 9, "column": 0 }, "end": { "line": 9, "column": 34 } } }, { "type": "CommentLine", "value": " const reload = require('reload');", "start": 236, "end": 272, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 10, "column": 36 } } }, { "type": "CommentLine", "value": " const reloadServer = reload(server, app);", "start": 273, "end": 317, "loc": { "start": { "line": 11, "column": 0 }, "end": { "line": 11, "column": 44 } } } ] }, { "type": "VariableDeclaration", "start": 318, "end": 358, "loc": { "start": { "line": 12, "column": 0 }, "end": { "line": 12, "column": 40 } }, "declarations": [ { "type": "VariableDeclarator", "start": 324, "end": 357, "loc": { "start": { "line": 12, "column": 6 }, "end": { "line": 12, "column": 39 } }, "id": { "type": "Identifier", "start": 324, "end": 330, "loc": { "start": { "line": 12, "column": 6 }, "end": { "line": 12, "column": 12 }, "identifierName": "logger" }, "name": "logger", "leadingComments": null }, "init": { "type": "CallExpression", "start": 333, "end": 357, "loc": { "start": { "line": 12, "column": 15 }, "end": { "line": 12, "column": 39 } }, "callee": { "type": "Identifier", "start": 333, "end": 340, "loc": { "start": { "line": 12, "column": 15 }, "end": { "line": 12, "column": 22 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 341, "end": 356, "loc": { "start": { "line": 12, "column": 23 }, "end": { "line": 12, "column": 38 } }, "extra": { "rawValue": "backed-logger", "raw": "'backed-logger'" }, "value": "backed-logger" } ] }, "leadingComments": null } ], "kind": "const", "leadingComments": [ { "type": "CommentLine", "value": " TODO: find better way to reload", "start": 201, "end": 235, "loc": { "start": { "line": 9, "column": 0 }, "end": { "line": 9, "column": 34 } } }, { "type": "CommentLine", "value": " const reload = require('reload');", "start": 236, "end": 272, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 10, "column": 36 } } }, { "type": "CommentLine", "value": " const reloadServer = reload(server, app);", "start": 273, "end": 317, "loc": { "start": { "line": 11, "column": 0 }, "end": { "line": 11, "column": 44 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * glob file path\n * @param {string} string\n ", "start": 360, "end": 411, "loc": { "start": { "line": 14, "column": 0 }, "end": { "line": 17, "column": 3 } } } ] }, { "type": "VariableDeclaration", "start": 412, "end": 645, "loc": { "start": { "line": 18, "column": 0 }, "end": { "line": 29, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", "start": 418, "end": 644, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 29, "column": 1 } }, "id": { "type": "Identifier", "start": 418, "end": 421, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 18, "column": 9 }, "identifierName": "src" }, "name": "src", "leadingComments": null }, "init": { "type": "ArrowFunctionExpression", "start": 424, "end": 644, "loc": { "start": { "line": 18, "column": 12 }, "end": { "line": 29, "column": 1 } }, "id": { "type": "Identifier", "start": 418, "end": 421, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 18, "column": 9 }, "identifierName": "src" }, "name": "src", "leadingComments": null }, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 424, "end": 430, "loc": { "start": { "line": 18, "column": 12 }, "end": { "line": 18, "column": 18 }, "identifierName": "string" }, "name": "string" } ], "body": { "type": "BlockStatement", "start": 434, "end": 644, "loc": { "start": { "line": 18, "column": 22 }, "end": { "line": 29, "column": 1 } }, "body": [ { "type": "ReturnStatement", "start": 438, "end": 642, "loc": { "start": { "line": 19, "column": 2 }, "end": { "line": 28, "column": 5 } }, "argument": { "type": "NewExpression", "start": 445, "end": 641, "loc": { "start": { "line": 19, "column": 9 }, "end": { "line": 28, "column": 4 } }, "callee": { "type": "Identifier", "start": 449, "end": 456, "loc": { "start": { "line": 19, "column": 13 }, "end": { "line": 19, "column": 20 }, "identifierName": "Promise" }, "name": "Promise" }, "arguments": [ { "type": "ArrowFunctionExpression", "start": 457, "end": 640, "loc": { "start": { "line": 19, "column": 21 }, "end": { "line": 28, "column": 3 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 458, "end": 465, "loc": { "start": { "line": 19, "column": 22 }, "end": { "line": 19, "column": 29 }, "identifierName": "resolve" }, "name": "resolve" }, { "type": "Identifier", "start": 467, "end": 473, "loc": { "start": { "line": 19, "column": 31 }, "end": { "line": 19, "column": 37 }, "identifierName": "reject" }, "name": "reject" } ], "body": { "type": "BlockStatement", "start": 478, "end": 640, "loc": { "start": { "line": 19, "column": 42 }, "end": { "line": 28, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 484, "end": 636, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 27, "column": 7 } }, "expression": { "type": "CallExpression", "start": 484, "end": 635, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 27, "column": 6 } }, "callee": { "type": "Identifier", "start": 484, "end": 488, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 20, "column": 8 }, "identifierName": "glob" }, "name": "glob" }, "arguments": [ { "type": "Identifier", "start": 489, "end": 495, "loc": { "start": { "line": 20, "column": 9 }, "end": { "line": 20, "column": 15 }, "identifierName": "string" }, "name": "string" }, { "type": "ArrowFunctionExpression", "start": 497, "end": 634, "loc": { "start": { "line": 20, "column": 17 }, "end": { "line": 27, "column": 5 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 498, "end": 503, "loc": { "start": { "line": 20, "column": 18 }, "end": { "line": 20, "column": 23 }, "identifierName": "error" }, "name": "error" }, { "type": "Identifier", "start": 505, "end": 510, "loc": { "start": { "line": 20, "column": 25 }, "end": { "line": 20, "column": 30 }, "identifierName": "files" }, "name": "files" } ], "body": { "type": "BlockStatement", "start": 515, "end": 634, "loc": { "start": { "line": 20, "column": 35 }, "end": { "line": 27, "column": 5 } }, "body": [ { "type": "IfStatement", "start": 523, "end": 566, "loc": { "start": { "line": 21, "column": 6 }, "end": { "line": 23, "column": 7 } }, "test": { "type": "Identifier", "start": 527, "end": 532, "loc": { "start": { "line": 21, "column": 10 }, "end": { "line": 21, "column": 15 }, "identifierName": "error" }, "name": "error" }, "consequent": { "type": "BlockStatement", "start": 534, "end": 566, "loc": { "start": { "line": 21, "column": 17 }, "end": { "line": 23, "column": 7 } }, "body": [ { "type": "ExpressionStatement", "start": 544, "end": 558, "loc": { "start": { "line": 22, "column": 8 }, "end": { "line": 22, "column": 22 } }, "expression": { "type": "CallExpression", "start": 544, "end": 557, "loc": { "start": { "line": 22, "column": 8 }, "end": { "line": 22, "column": 21 } }, "callee": { "type": "Identifier", "start": 544, "end": 550, "loc": { "start": { "line": 22, "column": 8 }, "end": { "line": 22, "column": 14 }, "identifierName": "reject" }, "name": "reject" }, "arguments": [ { "type": "Identifier", "start": 551, "end": 556, "loc": { "start": { "line": 22, "column": 15 }, "end": { "line": 22, "column": 20 }, "identifierName": "error" }, "name": "error" } ] } } ], "directives": [] }, "alternate": null }, { "type": "IfStatement", "start": 573, "end": 628, "loc": { "start": { "line": 24, "column": 6 }, "end": { "line": 26, "column": 7 } }, "test": { "type": "BinaryExpression", "start": 577, "end": 593, "loc": { "start": { "line": 24, "column": 10 }, "end": { "line": 24, "column": 26 } }, "left": { "type": "MemberExpression", "start": 577, "end": 589, "loc": { "start": { "line": 24, "column": 10 }, "end": { "line": 24, "column": 22 } }, "object": { "type": "Identifier", "start": 577, "end": 582, "loc": { "start": { "line": 24, "column": 10 }, "end": { "line": 24, "column": 15 }, "identifierName": "files" }, "name": "files" }, "property": { "type": "Identifier", "start": 583, "end": 589, "loc": { "start": { "line": 24, "column": 16 }, "end": { "line": 24, "column": 22 }, "identifierName": "length" }, "name": "length" }, "computed": false }, "operator": ">", "right": { "type": "NumericLiteral", "start": 592, "end": 593, "loc": { "start": { "line": 24, "column": 25 }, "end": { "line": 24, "column": 26 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } }, "consequent": { "type": "BlockStatement", "start": 595, "end": 628, "loc": { "start": { "line": 24,