UNPKG

@eastsideco/escshopify

Version:

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

1,421 lines 834 kB
{ "type": "File", "start": 0, "end": 5386, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 143, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 5386, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 143, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 37, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 37 } }, "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": 36, "loc": { "start": { "line": 1, "column": 21 }, "end": { "line": 1, "column": 36 } }, "extra": { "rawValue": "./logLevel.js", "raw": "'./logLevel.js'" }, "value": "./logLevel.js" } }, { "type": "ImportDeclaration", "start": 38, "end": 68, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 30 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 45, "end": 51, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 13 } }, "local": { "type": "Identifier", "start": 45, "end": 51, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 13 }, "identifierName": "Logger" }, "name": "Logger" } } ], "source": { "type": "StringLiteral", "start": 57, "end": 67, "loc": { "start": { "line": 2, "column": 19 }, "end": { "line": 2, "column": 29 } }, "extra": { "rawValue": "./Logger", "raw": "'./Logger'" }, "value": "./Logger" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Basic logger that logs to the environment console.\n ", "start": 71, "end": 132, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 7, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 133, "end": 5385, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 142, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 148, "end": 5385, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 142, "column": 1 } }, "id": { "type": "Identifier", "start": 154, "end": 167, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 34 }, "identifierName": "ConsoleLogger" }, "name": "ConsoleLogger", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 176, "end": 182, "loc": { "start": { "line": 8, "column": 43 }, "end": { "line": 8, "column": 49 }, "identifierName": "Logger" }, "name": "Logger" }, "body": { "type": "ClassBody", "start": 183, "end": 5385, "loc": { "start": { "line": 8, "column": 50 }, "end": { "line": 142, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 241, "end": 437, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 20, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 241, "end": 252, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 15 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 255, "end": 437, "loc": { "start": { "line": 13, "column": 18 }, "end": { "line": 20, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 265, "end": 273, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 16 } }, "expression": { "type": "CallExpression", "start": 265, "end": 272, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 15 } }, "callee": { "type": "Super", "start": 265, "end": 270, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 13 } } }, "arguments": [] }, "trailingComments": [ { "type": "CommentBlock", "value": "* @type {Number} ", "start": 283, "end": 304, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 16, "column": 29 } } } ] }, { "type": "ExpressionStatement", "start": 313, "end": 341, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 36 } }, "expression": { "type": "AssignmentExpression", "start": 313, "end": 340, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 35 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 313, "end": 323, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 18 } }, "object": { "type": "ThisExpression", "start": 313, "end": 317, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 318, "end": 323, "loc": { "start": { "line": 17, "column": 13 }, "end": { "line": 17, "column": 18 }, "identifierName": "level" }, "name": "level" }, "computed": false, "leadingComments": null }, "right": { "type": "MemberExpression", "start": 326, "end": 340, "loc": { "start": { "line": 17, "column": 21 }, "end": { "line": 17, "column": 35 } }, "object": { "type": "Identifier", "start": 326, "end": 334, "loc": { "start": { "line": 17, "column": 21 }, "end": { "line": 17, "column": 29 }, "identifierName": "logLevel" }, "name": "logLevel" }, "property": { "type": "Identifier", "start": 335, "end": 340, "loc": { "start": { "line": 17, "column": 30 }, "end": { "line": 17, "column": 35 }, "identifierName": "DEBUG" }, "name": "DEBUG" }, "computed": false }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "* @type {Number} ", "start": 283, "end": 304, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 16, "column": 29 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "* @type {Boolean} ", "start": 350, "end": 372, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 30 } } } ] }, { "type": "ExpressionStatement", "start": 381, "end": 431, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 58 } }, "expression": { "type": "AssignmentExpression", "start": 381, "end": 430, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 57 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 381, "end": 401, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 28 } }, "object": { "type": "ThisExpression", "start": 381, "end": 385, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 386, "end": 401, "loc": { "start": { "line": 19, "column": 13 }, "end": { "line": 19, "column": 28 }, "identifierName": "useFancyStyling" }, "name": "useFancyStyling" }, "computed": false, "leadingComments": null }, "right": { "type": "CallExpression", "start": 404, "end": 430, "loc": { "start": { "line": 19, "column": 31 }, "end": { "line": 19, "column": 57 } }, "callee": { "type": "MemberExpression", "start": 404, "end": 428, "loc": { "start": { "line": 19, "column": 31 }, "end": { "line": 19, "column": 55 } }, "object": { "type": "ThisExpression", "start": 404, "end": 408, "loc": { "start": { "line": 19, "column": 31 }, "end": { "line": 19, "column": 35 } } }, "property": { "type": "Identifier", "start": 409, "end": 428, "loc": { "start": { "line": 19, "column": 36 }, "end": { "line": 19, "column": 55 }, "identifierName": "_canUseFancyStyling" }, "name": "_canUseFancyStyling" }, "computed": false }, "arguments": [] }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "* @type {Boolean} ", "start": 350, "end": 372, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 30 } } } ] } ], "directives": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Create a new ConsoleLogger.\n ", "start": 190, "end": 236, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 12, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 443, "end": 1134, "loc": { "start": { "line": 22, "column": 4 }, "end": { "line": 35, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 443, "end": 462, "loc": { "start": { "line": 22, "column": 4 }, "end": { "line": 22, "column": 23 }, "identifierName": "_canUseFancyStyling" }, "name": "_canUseFancyStyling" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 465, "end": 1134, "loc": { "start": { "line": 22, "column": 26 }, "end": { "line": 35, "column": 5 } }, "body": [ { "type": "VariableDeclaration", "start": 475, "end": 492, "loc": { "start": { "line": 23, "column": 8 }, "end": { "line": 23, "column": 25 } }, "declarations": [ { "type": "VariableDeclarator", "start": 479, "end": 491, "loc": { "start": { "line": 23, "column": 12 }, "end": { "line": 23, "column": 24 } }, "id": { "type": "Identifier", "start": 479, "end": 486, "loc": { "start": { "line": 23, "column": 12 }, "end": { "line": 23, "column": 19 }, "identifierName": "browser" }, "name": "browser" }, "init": { "type": "ObjectExpression", "start": 489, "end": 491, "loc": { "start": { "line": 23, "column": 22 }, "end": { "line": 23, "column": 24 } }, "properties": [] } } ], "kind": "var" }, { "type": "ExpressionStatement", "start": 501, "end": 558, "loc": { "start": { "line": 24, "column": 8 }, "end": { "line": 24, "column": 65 } }, "expression": { "type": "AssignmentExpression", "start": 501, "end": 557, "loc": { "start": { "line": 24, "column": 8 }, "end": { "line": 24, "column": 64 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 501, "end": 518, "loc": { "start": { "line": 24, "column": 8 }, "end": { "line": 24, "column": 25 } }, "object": { "type": "Identifier", "start": 501, "end": 508, "loc": { "start": { "line": 24, "column": 8 }, "end": { "line": 24, "column": 15 }, "identifierName": "browser" }, "name": "browser" }, "property": { "type": "Identifier", "start": 509, "end": 518, "loc": { "start": { "line": 24, "column": 16 }, "end": { "line": 24, "column": 25 }, "identifierName": "isFirefox" }, "name": "isFirefox" }, "computed": false }, "right": { "type": "CallExpression", "start": 521, "end": 557, "loc": { "start": { "line": 24, "column": 28 }, "end": { "line": 24, "column": 64 } }, "callee": { "type": "MemberExpression", "start": 521, "end": 536, "loc": { "start": { "line": 24, "column": 28 }, "end": { "line": 24, "column": 43 } }, "object": { "type": "RegExpLiteral", "start": 521, "end": 531, "loc": { "start": { "line": 24, "column": 28 }, "end": { "line": 24, "column": 38 } }, "extra": { "raw": "/firefox/i" }, "pattern": "firefox", "flags": "i" }, "property": { "type": "Identifier", "start": 532, "end": 536, "loc": { "start": { "line": 24, "column": 39 }, "end": { "line": 24, "column": 43 }, "identifierName": "test" }, "name": "test" }, "computed": false }, "arguments": [ { "type": "MemberExpression", "start": 537, "end": 556, "loc": { "start": { "line": 24, "column": 44 }, "end": { "line": 24, "column": 63 } }, "object": { "type": "Identifier", "start": 537, "end": 546, "loc": { "start": { "line": 24, "column": 44 }, "end": { "line": 24, "column": 53 }, "identifierName": "navigator" }, "name": "navigator" }, "property": { "type": "Identifier", "start": 547, "end": 556, "loc": { "start": { "line": 24, "column": 54 }, "end": { "line": 24, "column": 63 }, "identifierName": "userAgent" }, "name": "userAgent" }, "computed": false } ] } } }, { "type": "ExpressionStatement", "start": 567, "end": 604, "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 45 } }, "expression": { "type": "AssignmentExpression", "start": 567, "end": 603, "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 44 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 567, "end": 579, "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 20 } }, "object": { "type": "Identifier", "start": 567, "end": 574, "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 15 }, "identifierName": "browser" }, "name": "browser" }, "property": { "type": "Identifier", "start": 575, "end": 579, "loc": { "start": { "line": 25, "column": 16 }, "end": { "line": 25, "column": 20 }, "identifierName": "isIE" }, "name": "isIE" }, "computed": false }, "right": { "type": "MemberExpression", "start": 582, "end": 603, "loc": { "start": { "line": 25, "column": 23 }, "end": { "line": 25, "column": 44 } }, "object": { "type": "Identifier", "start": 582, "end": 590, "loc": { "start": { "line": 25, "column": 23 }, "end": { "line": 25, "column": 31 }, "identifierName": "document" }, "name": "document" }, "property": { "type": "Identifier", "start": 591, "end": 603, "loc": { "start": { "line": 25, "column": 32 }, "end": { "line": 25, "column": 44 }, "identifierName": "documentMode" }, "name": "documentMode" }, "computed": false } } }, { "type": "VariableDeclaration", "start": 614, "end": 631, "loc": { "start": { "line": 27, "column": 8 }, "end": { "line": 27, "column": 25 } }, "declarations": [ { "type": "VariableDeclarator", "start": 618, "end": 630, "loc": { "start": { "line": 27, "column": 12 }, "end": { "line": 27, "column": 24 } }, "id": { "type": "Identifier", "start": 618, "end": 625, "loc": { "start": { "line": 27, "column": 12 }, "end": { "line": 27, "column": 19 }, "identifierName": "support" }, "name": "support" }, "init": { "type": "ObjectExpression", "start": 628, "end": 630, "loc": { "start": { "line": 27, "column": 22 }, "end": { "line": 27, "column": 24 } }, "properties": [] } } ], "kind": "var" }, { "type": "ExpressionStatement", "start": 640, "end": 731, "loc": { "start": { "line": 28, "column": 8 }, "end": { "line": 28, "column": 99 } }, "expression": { "type": "AssignmentExpression", "start": 640, "end": 730, "loc": { "start": { "line": 28, "column": 8 }, "end": { "line": 28, "column": 98 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 640, "end": 660, "loc": { "start": { "line": 28, "column": 8 }, "end": { "line": 28, "column": 28 } }, "object": { "type": "Identifier", "start": 640, "end": 647, "loc": { "start": { "line": 28, "column": 8 }, "end": { "line": 28, "column": 15 }, "identifierName": "support" }, "name": "support" }, "property": { "type": "Identifier", "start": 648, "end": 660, "loc": { "start": { "line": 28, "column": 16 }, "end": { "line": 28, "column": 28 }, "identifierName": "consoleApply" }, "name": "consoleApply" }, "computed": false }, "right": { "type": "LogicalExpression", "start": 663, "end": 730, "loc": { "start": { "line": 28, "column": 31 }, "end": { "line": 28, "column": 98 } }, "left": { "type": "UnaryExpression", "start": 663, "end": 676, "loc": { "start": { "line": 28, "column": 31 }, "end": { "line": 28, "column": 44 } }, "operator": "!", "prefix": true, "argument": { "type": "MemberExpression", "start": 664, "end": 676, "loc": { "start": { "line": 28, "column": 32 }, "end": { "line": 28, "column": 44 } }, "object": { "type": "Identifier", "start": 664, "end": 671, "loc": { "start": { "line": 28, "column": 32 }, "end": { "line": 28, "column": 39 }, "identifierName": "browser" }, "name": "browser" }, "property": { "type": "Identifier", "start": 672, "end": 676, "loc": { "start": { "line": 28, "column": 40 }, "end": { "line": 28, "column": 44 }, "identifierName": "isIE" }, "name": "isIE" }, "computed": false }, "extra": { "parenthesizedArgument": false } }, "operator": "||", "right": { "type": "LogicalEx