UNPKG

roc

Version:

Build modern web applications easily

877 lines 24.9 kB
{ "type": "Program", "start": 0, "end": 724, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 21, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 37, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 37 } }, "specifiers": [], "source": { "type": "Literal", "start": 7, "end": 36, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 36 } }, "value": "source-map-support/register", "rawValue": "source-map-support/register", "raw": "'source-map-support/register'" } }, { "type": "ImportDeclaration", "start": 39, "end": 73, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 34 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 48, "end": 56, "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 17 } }, "imported": { "type": "Identifier", "start": 48, "end": 56, "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 17 } }, "name": "isObject" }, "local": { "type": "Identifier", "start": 48, "end": 56, "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 17 } }, "name": "isObject" } } ], "importKind": "value", "source": { "type": "Literal", "start": 64, "end": 72, "loc": { "start": { "line": 3, "column": 25 }, "end": { "line": 3, "column": 33 } }, "value": "lodash", "rawValue": "lodash", "raw": "'lodash'" } }, { "type": "ImportDeclaration", "start": 74, "end": 153, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 79 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 83, "end": 93, "loc": { "start": { "line": 4, "column": 9 }, "end": { "line": 4, "column": 19 } }, "imported": { "type": "Identifier", "start": 83, "end": 93, "loc": { "start": { "line": 4, "column": 9 }, "end": { "line": 4, "column": 19 } }, "name": "fileExists" }, "local": { "type": "Identifier", "start": 83, "end": 93, "loc": { "start": { "line": 4, "column": 9 }, "end": { "line": 4, "column": 19 } }, "name": "fileExists" } }, { "type": "ImportSpecifier", "start": 95, "end": 113, "loc": { "start": { "line": 4, "column": 21 }, "end": { "line": 4, "column": 39 } }, "imported": { "type": "Identifier", "start": 95, "end": 113, "loc": { "start": { "line": 4, "column": 21 }, "end": { "line": 4, "column": 39 } }, "name": "getRocDependencies" }, "local": { "type": "Identifier", "start": 95, "end": 113, "loc": { "start": { "line": 4, "column": 21 }, "end": { "line": 4, "column": 39 } }, "name": "getRocDependencies" } }, { "type": "ImportSpecifier", "start": 115, "end": 129, "loc": { "start": { "line": 4, "column": 41 }, "end": { "line": 4, "column": 55 } }, "imported": { "type": "Identifier", "start": 115, "end": 129, "loc": { "start": { "line": 4, "column": 41 }, "end": { "line": 4, "column": 55 } }, "name": "getPackageJson" }, "local": { "type": "Identifier", "start": 115, "end": 129, "loc": { "start": { "line": 4, "column": 41 }, "end": { "line": 4, "column": 55 } }, "name": "getPackageJson" } } ], "importKind": "value", "source": { "type": "Literal", "start": 137, "end": 152, "loc": { "start": { "line": 4, "column": 63 }, "end": { "line": 4, "column": 78 } }, "value": "../../helpers", "rawValue": "../../helpers", "raw": "'../../helpers'" }, "trailingComments": [ { "type": "Block", "value": "*\n * Validates if a directory seems to be a Roc application project.\n * A valid Roc project should have a package.json file that contains some dependecy that match 'roc-*' or\n * a `roc.config.js` file.\n *\n * @param {string} directory - The directory to validate.\n *\n * @returns {boolean} - Whether or not it is a valid Roc project.\n ", "start": 155, "end": 492, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 14, "column": 3 } }, "range": [ 155, 492 ] } ] }, { "type": "ExportNamedDeclaration", "start": 493, "end": 723, "loc": { "start": { "line": 15, "column": 0 }, "end": { "line": 20, "column": 1 } }, "declaration": { "type": "FunctionDeclaration", "start": 500, "end": 723, "loc": { "start": { "line": 15, "column": 7 }, "end": { "line": 20, "column": 1 } }, "id": { "type": "Identifier", "start": 509, "end": 524, "loc": { "start": { "line": 15, "column": 16 }, "end": { "line": 15, "column": 31 } }, "name": "validRocProject", "leadingComments": null }, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 525, "end": 534, "loc": { "start": { "line": 15, "column": 32 }, "end": { "line": 15, "column": 41 } }, "name": "directory" } ], "body": { "type": "BlockStatement", "start": 536, "end": 723, "loc": { "start": { "line": 15, "column": 43 }, "end": { "line": 20, "column": 1 } }, "body": [ { "type": "VariableDeclaration", "start": 542, "end": 588, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 50 } }, "declarations": [ { "type": "VariableDeclarator", "start": 548, "end": 587, "loc": { "start": { "line": 16, "column": 10 }, "end": { "line": 16, "column": 49 } }, "id": { "type": "Identifier", "start": 548, "end": 559, "loc": { "start": { "line": 16, "column": 10 }, "end": { "line": 16, "column": 21 } }, "name": "packageJson" }, "init": { "type": "CallExpression", "start": 562, "end": 587, "loc": { "start": { "line": 16, "column": 24 }, "end": { "line": 16, "column": 49 } }, "callee": { "type": "Identifier", "start": 562, "end": 576, "loc": { "start": { "line": 16, "column": 24 }, "end": { "line": 16, "column": 38 } }, "name": "getPackageJson" }, "arguments": [ { "type": "Identifier", "start": 577, "end": 586, "loc": { "start": { "line": 16, "column": 39 }, "end": { "line": 16, "column": 48 } }, "name": "directory" } ] } } ], "kind": "const" }, { "type": "ReturnStatement", "start": 594, "end": 721, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 19, "column": 92 } }, "argument": { "type": "UnaryExpression", "start": 601, "end": 720, "loc": { "start": { "line": 18, "column": 11 }, "end": { "line": 19, "column": 91 } }, "operator": "!", "prefix": true, "argument": { "type": "LogicalExpression", "start": 603, "end": 719, "loc": { "start": { "line": 18, "column": 13 }, "end": { "line": 19, "column": 90 } }, "left": { "type": "UnaryExpression", "start": 603, "end": 625, "loc": { "start": { "line": 18, "column": 13 }, "end": { "line": 18, "column": 35 } }, "operator": "!", "prefix": true, "argument": { "type": "CallExpression", "start": 604, "end": 625, "loc": { "start": { "line": 18, "column": 14 }, "end": { "line": 18, "column": 35 } }, "callee": { "type": "Identifier", "start": 604, "end": 612, "loc": { "start": { "line": 18, "column": 14 }, "end": { "line": 18, "column": 22 } }, "name": "isObject" }, "arguments": [ { "type": "Identifier", "start": 613, "end": 624, "loc": { "start": { "line": 18, "column": 23 }, "end": { "line": 18, "column": 34 } }, "name": "packageJson" } ] } }, "operator": "||", "right": { "type": "LogicalExpression", "start": 637, "end": 719, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 90 } }, "left": { "type": "UnaryExpression", "start": 637, "end": 676, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 47 } }, "operator": "!", "prefix": true, "argument": { "type": "CallExpression", "start": 638, "end": 676, "loc": { "start": { "line": 19, "column": 9 }, "end": { "line": 19, "column": 47 } }, "callee": { "type": "Identifier", "start": 638, "end": 648, "loc": { "start": { "line": 19, "column": 9 }, "end": { "line": 19, "column": 19 } }, "name": "fileExists" }, "arguments": [ { "type": "Literal", "start": 649, "end": 664, "loc": { "start": { "line": 19, "column": 20 }, "end": { "line": 19, "column": 35 } }, "value": "roc.config.js", "rawValue": "roc.config.js", "raw": "'roc.config.js'" }, { "type": "Identifier", "start": 666, "end": 675, "loc": { "start": { "line": 19, "column": 37 }, "end": { "line": 19, "column": 46 } }, "name": "directory" } ] } }, "operator": "&&", "right": { "type": "UnaryExpression", "start": 680, "end": 719, "loc": { "start": { "line": 19, "column": 51 }, "end": { "line": 19, "column": 90 } }, "operator": "!", "prefix": true, "argument": { "type": "MemberExpression", "start": 681, "end": 719, "loc": { "start": { "line": 19, "column": 52 }, "end": { "line": 19, "column": 90 } }, "object": { "type": "CallExpression", "start": 681, "end": 712, "loc": { "start": { "line": 19, "column": 52 }, "end": { "line": 19, "column": 83 } }, "callee": { "type": "Identifier", "start": 681, "end": 699, "loc": { "start": { "line": 19, "column": 52 }, "end": { "line": 19, "column": 70 } }, "name": "getRocDependencies" }, "arguments": [ { "type": "Identifier", "start": 700, "end": 711, "loc": { "start": { "line": 19, "column": 71 }, "end": { "line": 19, "column": 82 } }, "name": "packageJson" } ] }, "property": { "type": "Identifier", "start": 713, "end": 719, "loc": { "start": { "line": 19, "column": 84 }, "end": { "line": 19, "column": 90 } }, "name": "length" }, "computed": false } } }, "parenthesizedExpression": true } } } ] }, "leadingComments": [ { "type": "Block", "value": "*\n * Validates if a directory seems to be a Roc application project.\n * A valid Roc project should have a package.json file that contains some dependecy that match 'roc-*' or\n * a `roc.config.js` file.\n *\n * @param {string} directory - The directory to validate.\n *\n * @returns {boolean} - Whether or not it is a valid Roc project.\n ", "start": 155, "end": 492, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 14, "column": 3 } }, "range": [ 155, 492 ] } ], "trailingComments": [] }, "specifiers": [], "source": null, "leadingComments": [ { "type": "Block", "value": "*\n * Validates if a directory seems to be a Roc application project.\n * A valid Roc project should have a package.json file that contains some dependecy that match 'roc-*' or\n * a `roc.config.js` file.\n *\n * @param {string} directory - The directory to validate.\n *\n * @returns {boolean} - Whether or not it is a valid Roc project.\n ", "start": 155, "end": 492, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 14, "column": 3 } }, "range": [ 155, 492 ] } ] } ] }