UNPKG

@eastsideco/escshopify

Version:

WIP JS library for Shopify, containing a variety of useful functionality.

1,564 lines (1,563 loc) 173 kB
{ "type": "File", "start": 0, "end": 697, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 37, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 697, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 37, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 45, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 45 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 7, "end": 15, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 15 } }, "local": { "type": "Identifier", "start": 7, "end": 15, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 15 }, "identifierName": "logLevel" }, "name": "logLevel" } } ], "source": { "type": "StringLiteral", "start": 21, "end": 44, "loc": { "start": { "line": 1, "column": 21 }, "end": { "line": 1, "column": 44 } }, "extra": { "rawValue": "./loggers/logLevel.js", "raw": "'./loggers/logLevel.js'" }, "value": "./loggers/logLevel.js" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Provides well-formatted logging with log level filtering.\n ", "start": 47, "end": 115, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 5, "column": 3 } } } ] }, { "type": "Identifier", "start": 116, "end": 541, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 27, "column": 1 } }, "id": { "type": "Identifier", "start": 122, "end": 125, "loc": { "start": { "line": 6, "column": 6 }, "end": { "line": 6, "column": 9 }, "identifierName": "Log" }, "name": "Log", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 126, "end": 541, "loc": { "start": { "line": 6, "column": 10 }, "end": { "line": 27, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 132, "end": 180, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 9, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 132, "end": 143, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 15 }, "identifierName": "constructor" }, "name": "constructor" }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 146, "end": 180, "loc": { "start": { "line": 7, "column": 18 }, "end": { "line": 9, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 156, "end": 174, "loc": { "start": { "line": 8, "column": 8 }, "end": { "line": 8, "column": 26 } }, "expression": { "type": "AssignmentExpression", "start": 156, "end": 173, "loc": { "start": { "line": 8, "column": 8 }, "end": { "line": 8, "column": 25 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 156, "end": 168, "loc": { "start": { "line": 8, "column": 8 }, "end": { "line": 8, "column": 20 } }, "object": { "type": "ThisExpression", "start": 156, "end": 160, "loc": { "start": { "line": 8, "column": 8 }, "end": { "line": 8, "column": 12 } } }, "property": { "type": "Identifier", "start": 161, "end": 168, "loc": { "start": { "line": 8, "column": 13 }, "end": { "line": 8, "column": 20 }, "identifierName": "loggers" }, "name": "loggers" }, "computed": false }, "right": { "type": "ArrayExpression", "start": 171, "end": 173, "loc": { "start": { "line": 8, "column": 23 }, "end": { "line": 8, "column": 25 } }, "elements": [] } } } ], "directives": [] } }, { "type": "ClassMethod", "start": 186, "end": 246, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 13, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 186, "end": 195, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 11, "column": 13 }, "identifierName": "addLogger" }, "name": "addLogger" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 196, "end": 202, "loc": { "start": { "line": 11, "column": 14 }, "end": { "line": 11, "column": 20 }, "identifierName": "logger" }, "name": "logger" } ], "body": { "type": "BlockStatement", "start": 204, "end": 246, "loc": { "start": { "line": 11, "column": 22 }, "end": { "line": 13, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 214, "end": 240, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 34 } }, "expression": { "type": "CallExpression", "start": 214, "end": 239, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 33 } }, "callee": { "type": "MemberExpression", "start": 214, "end": 231, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 25 } }, "object": { "type": "MemberExpression", "start": 214, "end": 226, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 20 } }, "object": { "type": "ThisExpression", "start": 214, "end": 218, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 12 } } }, "property": { "type": "Identifier", "start": 219, "end": 226, "loc": { "start": { "line": 12, "column": 13 }, "end": { "line": 12, "column": 20 }, "identifierName": "loggers" }, "name": "loggers" }, "computed": false }, "property": { "type": "Identifier", "start": 227, "end": 231, "loc": { "start": { "line": 12, "column": 21 }, "end": { "line": 12, "column": 25 }, "identifierName": "push" }, "name": "push" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 232, "end": 238, "loc": { "start": { "line": 12, "column": 26 }, "end": { "line": 12, "column": 32 }, "identifierName": "logger" }, "name": "logger" } ] } } ], "directives": [] } }, { "type": "ClassMethod", "start": 253, "end": 379, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 20, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 253, "end": 257, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 8 }, "identifierName": "send" }, "name": "send" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 258, "end": 263, "loc": { "start": { "line": 16, "column": 9 }, "end": { "line": 16, "column": 14 }, "identifierName": "level" }, "name": "level" }, { "type": "Identifier", "start": 265, "end": 268, "loc": { "start": { "line": 16, "column": 16 }, "end": { "line": 16, "column": 19 }, "identifierName": "tag" }, "name": "tag" }, { "type": "Identifier", "start": 270, "end": 274, "loc": { "start": { "line": 16, "column": 21 }, "end": { "line": 16, "column": 25 }, "identifierName": "text" }, "name": "text" } ], "body": { "type": "BlockStatement", "start": 276, "end": 379, "loc": { "start": { "line": 16, "column": 27 }, "end": { "line": 20, "column": 5 } }, "body": [ { "type": "ForOfStatement", "start": 286, "end": 373, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 19, "column": 9 } }, "left": { "type": "VariableDeclaration", "start": 291, "end": 301, "loc": { "start": { "line": 17, "column": 13 }, "end": { "line": 17, "column": 23 } }, "declarations": [ { "type": "VariableDeclarator", "start": 295, "end": 301, "loc": { "start": { "line": 17, "column": 17 }, "end": { "line": 17, "column": 23 } }, "id": { "type": "Identifier", "start": 295, "end": 301, "loc": { "start": { "line": 17, "column": 17 }, "end": { "line": 17, "column": 23 }, "identifierName": "logger" }, "name": "logger" }, "init": null } ], "kind": "let" }, "right": { "type": "MemberExpression", "start": 305, "end": 317, "loc": { "start": { "line": 17, "column": 27 }, "end": { "line": 17, "column": 39 } }, "object": { "type": "ThisExpression", "start": 305, "end": 309, "loc": { "start": { "line": 17, "column": 27 }, "end": { "line": 17, "column": 31 } } }, "property": { "type": "Identifier", "start": 310, "end": 317, "loc": { "start": { "line": 17, "column": 32 }, "end": { "line": 17, "column": 39 }, "identifierName": "loggers" }, "name": "loggers" }, "computed": false }, "body": { "type": "BlockStatement", "start": 319, "end": 373, "loc": { "start": { "line": 17, "column": 41 }, "end": { "line": 19, "column": 9 } }, "body": [ { "type": "ExpressionStatement", "start": 333, "end": 363, "loc": { "start": { "line": 18, "column": 12 }, "end": { "line": 18, "column": 42 } }, "expression": { "type": "CallExpression", "start": 333, "end": 362, "loc": { "start": { "line": 18, "column": 12 }, "end": { "line": 18, "column": 41 } }, "callee": { "type": "MemberExpression", "start": 333, "end": 344, "loc": { "start": { "line": 18, "column": 12 }, "end": { "line": 18, "column": 23 } }, "object": { "type": "Identifier", "start": 333, "end": 339, "loc": { "start": { "line": 18, "column": 12 }, "end": { "line": 18, "column": 18 }, "identifierName": "logger" }, "name": "logger" }, "property": { "type": "Identifier", "start": 340, "end": 344, "loc": { "start": { "line": 18, "column": 19 }, "end": { "line": 18, "column": 23 }, "identifierName": "send" }, "name": "send" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 345, "end": 350, "loc": { "start": { "line": 18, "column": 24 }, "end": { "line": 18, "column": 29 }, "identifierName": "level" }, "name": "level" }, { "type": "Identifier", "start": 352, "end": 355, "loc": { "start": { "line": 18, "column": 31 }, "end": { "line": 18, "column": 34 }, "identifierName": "tag" }, "name": "tag" }, { "type": "Identifier", "start": 357, "end": 361, "loc": { "start": { "line": 18, "column": 36 }, "end": { "line": 18, "column": 40 }, "identifierName": "text" }, "name": "text" } ] } } ], "directives": [] } } ], "directives": [] } }, { "type": "ClassMethod", "start": 385, "end": 539, "loc": { "start": { "line": 22, "column": 4 }, "end": { "line": 26, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 385, "end": 395, "loc": { "start": { "line": 22, "column": 4 }, "end": { "line": 22, "column": 14 }, "identifierName": "sendObject" }, "name": "sendObject" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 396, "end": 401, "loc": { "start": { "line": 22, "column": 15 }, "end": { "line": 22, "column": 20 }, "identifierName": "level" }, "name": "level" }, { "type": "Identifier", "start": 403, "end": 406, "loc": { "start": { "line": 22, "column": 22 }, "end": { "line": 22, "column": 25 }, "identifierName": "tag" }, "name": "tag" }, { "type": "Identifier", "start": 408, "end": 412, "loc": { "start": { "line": 22, "column": 27 }, "end": { "line": 22, "column": 31 }, "identifierName": "text" }, "name": "text" }, { "type": "Identifier", "start": 414, "end": 420, "loc": { "start": { "line": 22, "column": 33 }, "end": { "line": 22, "column": 39 }, "identifierName": "object" }, "name": "object" } ], "body": { "type": "BlockStatement", "start": 422, "end": 539, "loc": { "start": { "line": 22, "column": 41 }, "end": { "line": 26, "column": 5 } }, "body": [ { "type": "ForOfStatement", "start": 432, "end": 533, "loc": { "start": { "line": 23, "column": 8 }, "end": { "line": 25, "column": 9 } }, "left": { "type": "VariableDeclaration", "start": 437, "end": 447, "loc": { "start": { "line": 23, "column": 13 }, "end": { "line": 23, "column": 23 } }, "declarations": [ { "type": "VariableDeclarator", "start": 441, "end": 447, "loc": { "start": { "line": 23, "column": 17 }, "end": { "line": 23, "column": 23 } }, "id": { "type": "Identifier", "start": 441, "end": 447, "loc": { "start": { "line": 23, "column": 17 }, "end": { "line": 23, "column": 23 }, "identifierName": "logger" }, "name": "logger" }, "init": null } ], "kind": "let" }, "right": { "type": "MemberExpression", "start": 451, "end": 463, "loc": { "start": { "line": 23, "column": 27 }, "end": { "line": 23, "column": 39 } }, "object": { "type": "ThisExpression", "start": 451, "end": 455, "loc": { "start": { "line": 23, "column": 27 }, "end": { "line": 23, "column": 31 } } }, "property": { "type": "Identifier", "start": 456, "end": 463, "loc": { "start": { "line": 23, "column": 32 }, "end": { "line": 23, "column": 39 }, "identifierName": "loggers" }, "name": "loggers" }, "computed": false }, "body": { "type": "BlockStatement", "start": 465, "end": 533, "loc": { "start": { "line": 23, "column": 41 }, "end": { "line": 25, "column": 9 } }, "body": [ { "type": "ExpressionStatement", "start": 479, "end": 523, "loc": { "start": { "line": 24, "column": 12 }, "end": { "line": 24, "column": 56 } }, "expression": { "type": "CallExpression", "start": 479, "end": 522, "loc": { "start": { "line": 24, "column": 12 }, "end": { "line": 24, "column": 55 } }, "callee": { "type": "MemberExpression", "start": 479, "end": 496, "loc": { "start": { "line": 24, "column": 12 }, "end": { "line": 24, "column": 29 } }, "object": { "type": "Identifier", "start": 479, "end": 485, "loc": { "start": { "line": 24, "column": 12 }, "end": { "line": 24, "column": 18 }, "identifierName": "logger" }, "name": "logger" }, "property": { "type": "Identifier", "start": 486, "end": 496, "loc": { "start": { "line": 24, "column": 19 }, "end": { "line": 24, "column": 29 }, "identifierName": "sendObject" }, "name": "sendObject" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 497, "end": 502, "loc": { "start": { "line": 24, "column": 30 }, "end": { "line": 24, "column": 35 }, "identifierName": "level" }, "name": "level" }, { "type": "Identifier", "start": 504, "end": 507, "loc": { "start": { "line": 24, "column": 37 }, "end": { "line": 24, "column": 40 }, "identifierName": "tag" }, "name": "tag" }, { "type": "Identifier", "start": 509, "end": 513, "loc": { "start": { "line": 24, "column": 42 }, "end": { "line": 24, "column": 46 }, "identifierName": "text" }, "name": "text" }, { "type": "Identifier", "start": 515, "end": 521, "loc": { "start": { "line": 24, "column": 48 }, "end": { "line": 24, "column": 54 }, "identifierName": "object" }, "name": "object" } ] } } ], "directives": [] } } ], "directives": [] } } ], "trailingComments": null }, "leadingComments": [], "trailingComments": [], "name": "_" }, { "type": "VariableDeclaration", "start": 572, "end": 605, "loc": { "start": { "line": 31, "column": 0 }, "end": { "line": 31, "column": 33 } }, "declarations": [ { "type": "VariableDeclarator", "start": 576, "end": 604, "loc": { "start": { "line": 31, "column": 4 }, "end": { "line": 31, "column": 32 } }, "id": { "type": "Identifier", "start": 576, "end": 584, "loc": { "start": { "line": 31, "column": 4 }, "end": { "line": 31, "column": 12 }, "identifierName": "levelMap" }, "name": "levelMap", "leadingComments": null }, "init": { "type": "CallExpression", "start": 587, "end": 604, "loc": { "start": { "line": 31, "column": 15 }, "end": { "line": 31, "column": 32 } }, "callee": { "type": "MemberExpression", "start": 587, "end": 602, "loc": { "start": { "line": 31, "column": 15 }, "end": { "line": 31, "column": 30 } }, "object": { "type": "Identifier", "start": 587, "end": 595, "loc": { "start": { "line": 31, "column": 15 }, "end": { "line": 31, "column": 23 }, "identifierName": "logLevel" }, "name": "logLevel" }, "property": { "type": "Identifier", "start": 596, "end": 602, "loc": { "start": { "line": 31, "column": 24 }, "end": { "line": 31, "column": 30 }, "identifierName": "getMap" }, "name": "getMap" }, "computed": false }, "arguments": [] }, "leadingComments": null } ], "kind": "var", "leadingComments": [ { "type": "CommentLine", "value": " Expose log levels on Log", "start": 544, "end": 571, "loc": { "start": { "line": 30, "column": 0 }, "end": { "line": 30, "column": 27 } } } ] }, { "type": "ForInStatement", "start": 606, "end": 675, "loc": { "start": { "line": 32, "column": 0 }, "end": { "line": 34, "column": 1 } }, "left": { "type": "VariableDeclaration", "start": 611, "end": 618, "loc": { "start": { "line": 32, "column": 5 }, "end": { "line": 32, "column": 12 } }, "declarations": [ { "type": "VariableDeclarator", "start": 615, "end": 618, "loc": { "start": { "line": 32, "column": 9 }, "end": { "line": 32, "column": 12 } }, "id": { "type": "Identifier", "start": 615, "end": 618, "loc": { "start": { "line": 32, "column": 9 }, "end": { "line": 32, "column": 12 }, "identifierName": "key" }, "name": "key" }, "init": null } ], "kind": "var" }, "right": { "type": "Identifier", "start": 622, "end": 630, "loc": { "start": { "line": 32, "column": 16 }, "end": { "line": 32, "column": 24 }, "identifierName": "levelMap" }, "name": "levelMap" }, "body": { "type": "BlockStatement", "start": 632, "end": 675, "loc": { "start": { "line": 32, "column": 26 }, "end": { "line": 34, "column": 1 } }, "body": [ { "type": "ExpressionStatement", "start": 638, "end": 673, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 33, "column": 39 } }, "expression": {