roc
Version:
Build modern web applications easily
1,639 lines (1,638 loc) • 78.6 kB
JSON
{
"type": "Program",
"start": 0,
"end": 2025,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 69,
"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": 63,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 24
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 46,
"end": 50,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 11
}
},
"local": {
"type": "Identifier",
"start": 46,
"end": 50,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 11
}
},
"name": "path"
}
}
],
"importKind": "value",
"source": {
"type": "Literal",
"start": 56,
"end": 62,
"loc": {
"start": {
"line": 3,
"column": 17
},
"end": {
"line": 3,
"column": 23
}
},
"value": "path",
"rawValue": "path",
"raw": "'path'"
}
},
{
"type": "ImportDeclaration",
"start": 64,
"end": 84,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 20
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 71,
"end": 73,
"loc": {
"start": {
"line": 4,
"column": 7
},
"end": {
"line": 4,
"column": 9
}
},
"local": {
"type": "Identifier",
"start": 71,
"end": 73,
"loc": {
"start": {
"line": 4,
"column": 7
},
"end": {
"line": 4,
"column": 9
}
},
"name": "fs"
}
}
],
"importKind": "value",
"source": {
"type": "Literal",
"start": 79,
"end": 83,
"loc": {
"start": {
"line": 4,
"column": 15
},
"end": {
"line": 4,
"column": 19
}
},
"value": "fs",
"rawValue": "fs",
"raw": "'fs'"
},
"trailingComments": [
{
"type": "Block",
"value": "*\n* Makes a path absolute if not already is that.\n*\n* @param {string} filepath - The filepath to make absolute.\n* @param {string} [directory=process.cwd()] - The directory to resolve relative paths to. By default will use the\n* current working directory.\n*\n* @returns {string} - An absolute path.\n",
"start": 86,
"end": 391,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 14,
"column": 2
}
},
"range": [
86,
391
]
}
]
},
{
"type": "ExportNamedDeclaration",
"start": 392,
"end": 600,
"loc": {
"start": {
"line": 15,
"column": 0
},
"end": {
"line": 21,
"column": 1
}
},
"declaration": {
"type": "FunctionDeclaration",
"start": 399,
"end": 600,
"loc": {
"start": {
"line": 15,
"column": 7
},
"end": {
"line": 21,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 408,
"end": 423,
"loc": {
"start": {
"line": 15,
"column": 16
},
"end": {
"line": 15,
"column": 31
}
},
"name": "getAbsolutePath",
"leadingComments": null
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 424,
"end": 432,
"loc": {
"start": {
"line": 15,
"column": 32
},
"end": {
"line": 15,
"column": 40
}
},
"name": "filepath"
},
{
"type": "AssignmentPattern",
"start": 434,
"end": 459,
"loc": {
"start": {
"line": 15,
"column": 42
},
"end": {
"line": 15,
"column": 67
}
},
"operator": "=",
"left": {
"type": "Identifier",
"start": 434,
"end": 443,
"loc": {
"start": {
"line": 15,
"column": 42
},
"end": {
"line": 15,
"column": 51
}
},
"name": "directory"
},
"right": {
"type": "CallExpression",
"start": 446,
"end": 459,
"loc": {
"start": {
"line": 15,
"column": 54
},
"end": {
"line": 15,
"column": 67
}
},
"callee": {
"type": "MemberExpression",
"start": 446,
"end": 457,
"loc": {
"start": {
"line": 15,
"column": 54
},
"end": {
"line": 15,
"column": 65
}
},
"object": {
"type": "Identifier",
"start": 446,
"end": 453,
"loc": {
"start": {
"line": 15,
"column": 54
},
"end": {
"line": 15,
"column": 61
}
},
"name": "process"
},
"property": {
"type": "Identifier",
"start": 454,
"end": 457,
"loc": {
"start": {
"line": 15,
"column": 62
},
"end": {
"line": 15,
"column": 65
}
},
"name": "cwd"
},
"computed": false
},
"arguments": []
}
}
],
"body": {
"type": "BlockStatement",
"start": 461,
"end": 600,
"loc": {
"start": {
"line": 15,
"column": 69
},
"end": {
"line": 21,
"column": 1
}
},
"body": [
{
"type": "IfStatement",
"start": 467,
"end": 598,
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 20,
"column": 5
}
},
"test": {
"type": "Identifier",
"start": 471,
"end": 479,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 16
}
},
"name": "filepath"
},
"consequent": {
"type": "BlockStatement",
"start": 481,
"end": 598,
"loc": {
"start": {
"line": 16,
"column": 18
},
"end": {
"line": 20,
"column": 5
}
},
"body": [
{
"type": "ReturnStatement",
"start": 491,
"end": 592,
"loc": {
"start": {
"line": 17,
"column": 8
},
"end": {
"line": 19,
"column": 43
}
},
"argument": {
"type": "ConditionalExpression",
"start": 498,
"end": 591,
"loc": {
"start": {
"line": 17,
"column": 15
},
"end": {
"line": 19,
"column": 42
}
},
"test": {
"type": "CallExpression",
"start": 498,
"end": 523,
"loc": {
"start": {
"line": 17,
"column": 15
},
"end": {
"line": 17,
"column": 40
}
},
"callee": {
"type": "MemberExpression",
"start": 498,
"end": 513,
"loc": {
"start": {
"line": 17,
"column": 15
},
"end": {
"line": 17,
"column": 30
}
},
"object": {
"type": "Identifier",
"start": 498,
"end": 502,
"loc": {
"start": {
"line": 17,
"column": 15
},
"end": {
"line": 17,
"column": 19
}
},
"name": "path"
},
"property": {
"type": "Identifier",
"start": 503,
"end": 513,
"loc": {
"start": {
"line": 17,
"column": 20
},
"end": {
"line": 17,
"column": 30
}
},
"name": "isAbsolute"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 514,
"end": 522,
"loc": {
"start": {
"line": 17,
"column": 31
},
"end": {
"line": 17,
"column": 39
}
},
"name": "filepath"
}
]
},
"consequent": {
"type": "Identifier",
"start": 538,
"end": 546,
"loc": {
"start": {
"line": 18,
"column": 12
},
"end": {
"line": 18,
"column": 20
}
},
"name": "filepath"
},
"alternate": {
"type": "CallExpression",
"start": 561,
"end": 591,
"loc": {
"start": {
"line": 19,
"column": 12
},
"end": {
"line": 19,
"column": 42
}
},
"callee": {
"type": "MemberExpression",
"start": 561,
"end": 570,
"loc": {
"start": {
"line": 19,
"column": 12
},
"end": {
"line": 19,
"column": 21
}
},
"object": {
"type": "Identifier",
"start": 561,
"end": 565,
"loc": {
"start": {
"line": 19,
"column": 12
},
"end": {
"line": 19,
"column": 16
}
},
"name": "path"
},
"property": {
"type": "Identifier",
"start": 566,
"end": 570,
"loc": {
"start": {
"line": 19,
"column": 17
},
"end": {
"line": 19,
"column": 21
}
},
"name": "join"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 571,
"end": 580,
"loc": {
"start": {
"line": 19,
"column": 22
},
"end": {
"line": 19,
"column": 31
}
},
"name": "directory"
},
{
"type": "Identifier",
"start": 582,
"end": 590,
"loc": {
"start": {
"line": 19,
"column": 33
},
"end": {
"line": 19,
"column": 41
}
},
"name": "filepath"
}
]
}
}
}
]
},
"alternate": null
}
],
"trailingComments": null
},
"leadingComments": [
{
"type": "Block",
"value": "*\n* Makes a path absolute if not already is that.\n*\n* @param {string} filepath - The filepath to make absolute.\n* @param {string} [directory=process.cwd()] - The directory to resolve relative paths to. By default will use the\n* current working directory.\n*\n* @returns {string} - An absolute path.\n",
"start": 86,
"end": 391,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 14,
"column": 2
}
},
"range": [
86,
391
]
}
],
"trailingComments": [
{
"type": "Block",
"value": "*\n* Verifys if a file exists.\n*\n* @param {string} filepath - The filepath to check. Will make it absolute if not already using {@link getAbsolutePath}.\n* @param {string} [directory] - The directory to base the filepath on.\n*\n* @returns {boolean} - Whether or not it is a file.\n",
"start": 602,
"end": 883,
"loc": {
"start": {
"line": 23,
"column": 0
},
"end": {
"line": 30,
"column": 2
}
},
"range": [
602,
883
]
}
]
},
"specifiers": [],
"source": null,
"leadingComments": [
{
"type": "Block",
"value": "*\n* Makes a path absolute if not already is that.\n*\n* @param {string} filepath - The filepath to make absolute.\n* @param {string} [directory=process.cwd()] - The directory to resolve relative paths to. By default will use the\n* current working directory.\n*\n* @returns {string} - An absolute path.\n",
"start": 86,
"end": 391,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 14,
"column": 2
}
},
"range": [
86,
391
]
}
],
"trailingComments": [
{
"type": "Block",
"value": "*\n* Verifys if a file exists.\n*\n* @param {string} filepath - The filepath to check. Will make it absolute if not already using {@link getAbsolutePath}.\n* @param {string} [directory] - The directory to base the filepath on.\n*\n* @returns {boolean} - Whether or not it is a file.\n",
"start": 602,
"end": 883,
"loc": {
"start": {
"line": 23,
"column": 0
},
"end": {
"line": 30,
"column": 2
}
},
"range": [
602,
883
]
}
]
},
{
"type": "ExportNamedDeclaration",
"start": 884,
"end": 1095,
"loc": {
"start": {
"line": 31,
"column": 0
},
"end": {
"line": 38,
"column": 1
}
},
"declaration": {
"type": "FunctionDeclaration",
"start": 891,
"end": 1095,
"loc": {
"start": {
"line": 31,
"column": 7
},
"end": {
"line": 38,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 900,
"end": 910,
"loc": {
"start": {
"line": 31,
"column": 16
},
"end": {
"line": 31,
"column": 26
}
},
"name": "fileExists",
"leadingComments": null
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 911,
"end": 919,
"loc": {
"start": {
"line": 31,
"column": 27
},
"end": {
"line": 31,
"column": 35
}
},
"name": "filepath"
},
{
"type": "Identifier",
"start": 921,
"end": 930,
"loc": {
"start": {
"line": 31,
"column": 37
},
"end": {
"line": 31,
"column": 46
}
},
"name": "directory"
}
],
"body": {
"type": "BlockStatement",
"start": 932,
"end": 1095,
"loc": {
"start": {
"line": 31,
"column": 48
},
"end": {
"line": 38,
"column": 1
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 938,
"end": 986,
"loc": {
"start": {
"line": 32,
"column": 4
},
"end": {
"line": 32,
"column": 52
}
},
"expression": {
"type": "AssignmentExpression",
"start": 938,
"end": 985,
"loc": {
"start": {
"line": 32,
"column": 4
},
"end": {
"line": 32,
"column": 51
}
},
"operator": "=",
"left": {
"type": "Identifier",
"start": 938,
"end": 946,
"loc": {
"start": {
"line": 32,
"column": 4
},
"end": {
"line": 32,
"column": 12
}
},
"name": "filepath"
},
"right": {
"type": "CallExpression",
"start": 949,
"end": 985,
"loc": {
"start": {
"line": 32,
"column": 15
},
"end": {
"line": 32,
"column": 51
}
},
"callee": {
"type": "Identifier",
"start": 949,
"end": 964,
"loc": {
"start": {
"line": 32,
"column": 15
},
"end": {
"line": 32,
"column": 30
}
},
"name": "getAbsolutePath"
},
"arguments": [
{
"type": "Identifier",
"start": 965,
"end": 973,
"loc": {
"start": {
"line": 32,
"column": 31
},
"end": {
"line": 32,
"column": 39
}
},
"name": "filepath"
},
{
"type": "Identifier",
"start": 975,
"end": 984,
"loc": {
"start": {
"line": 32,
"column": 41
},
"end": {
"line": 32,
"column": 50
}
},
"name": "directory"
}
]
}
}
},
{
"type": "TryStatement",
"start": 991,
"end": 1093,
"loc": {
"start": {
"line": 33,
"column": 4
},
"end": {
"line": 37,
"column": 5
}
},
"block": {
"type": "BlockStatement",
"start": 995,
"end": 1049,
"loc": {
"start": {
"line": 33,
"column": 8
},
"end": {
"line": 35,
"column": 5
}
},
"body": [
{
"type": "ReturnStatement",
"start": 1005,
"end": 1043,
"loc": {
"start": {
"line": 34,
"column": 8
},
"end": {
"line": 34,
"column": 46
}
},
"argument": {
"type": "CallExpression",
"start": 1012,
"end": 1042,
"loc": {
"start": {
"line": 34,
"column": 15
},
"end": {
"line": 34,
"column": 45
}
},
"callee": {
"type": "MemberExpression",
"start": 1012,
"end": 1040,
"loc": {
"start": {
"line": 34,
"column": 15
},
"end": {
"line": 34,
"column": 43
}
},
"object": {
"type": "CallExpression",
"start": 1012,
"end": 1033,
"loc": {
"start": {
"line": 34,
"column": 15
},
"end": {
"line": 34,
"column": 36
}
},
"callee": {
"type": "MemberExpression",
"start": 1012,
"end": 1023,
"loc": {
"start": {
"line": 34,
"column": 15
},
"end": {
"line": 34,
"column": 26
}
},
"object": {
"type": "Identifier",
"start": 1012,
"end": 1014,
"loc": {
"start": {
"line": 34,
"column": 15
},
"end": {
"line": 34,
"column": 17
}
},
"name": "fs"
},
"property": {
"type": "Identifier",
"start": 1015,
"end": 1023,
"loc": {
"start": {
"line": 34,
"column": 18
},
"end": {
"line": 34,
"column": 26
}
},
"name": "statSync"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 1024,
"end": 1032,
"loc": {
"start": {
"line": 34,
"column": 27
},
"end": {
"line": 34,
"column": 35
}
},
"name": "filepath"
}
]
},
"property": {
"type": "Identifier",
"start": 1034,
"end": 1040,
"loc": {
"start": {
"line": 34,
"column": 37
},
"end": {
"line": 34,
"column": 43
}
},
"name": "isFile"
},
"computed": false
},
"arguments": []
}
}
]
},
"handler": {
"type": "CatchClause",
"start": 1050,
"end": 1093,
"loc": {
"start": {
"line": 35,
"column": 6
},
"end": {
"line": 37,
"column": 5
}
},
"param": {
"type": "Identifier",
"start": 1057,
"end": 1062,
"loc": {
"start": {
"line": 35,
"column": 13
},
"end": {
"line": 35,
"column": 18
}
},
"name": "error"
},
"body": {
"type": "BlockStatement",
"start": 1064,
"end": 1093,
"loc": {
"start": {
"line": 35,
"column": 20
},
"end": {
"line": 37,
"column": 5
}
},
"body": [
{
"type": "ReturnStatement",
"start": 1074,
"end": 1087,
"loc": {
"start": {
"line": 36,
"column": 8
},
"end": {
"line": 36,
"column": 21
}
},
"argument": {
"type": "Literal",
"start": 1081,
"end": 1086,
"loc": {
"start": {
"line": 36,
"column": 15
},
"end": {
"line": 36,
"column": 20
}
},
"value": false,
"rawValue": false,
"raw": "false"
}
}
]
}
},
"guardedHandlers": [],
"finalizer": null
}
],
"trailingComments": null
},
"leadingComments": [
{
"type": "Block",
"value": "*\n* Verifys if a file exists.\n*\n* @param {string} filepath - The filepath to check. Will make it absolute if not already using {@link getAbsolutePath}.\n* @param {string} [directory] - The directory to base the filepath on.\n*\n* @returns {boolean} - Whether or not it is a file.\n",
"start": 602,
"end": 883,
"loc": {
"start": {
"line": 23,
"column": 0
},
"end": {
"line": 30,
"column": 2
}
},
"range": [
602,
883
]
}
],
"trailingComments": [
{
"type": "Block",
"value": "*\n * Gets the Roc dependencies from a `package.json`.\n *\n * @param {Object} packageJson - A package.json file to fetch Roc dependencies from.\n *\n * @returns {string[]} - An array with Roc extensions that exists in the `package.json`.\n ",
"start": 1097,
"end": 1336,
"loc": {
"start": {
"line": 40,
"column": 0
},
"end": {
"line": 46,
"column": 3
}
},
"range": [
1097,
1336
]
}
]
},
"specifiers": [],
"source": null,
"leadingComments": [
{
"type": "Block",
"value": "*\n* Verifys if a file exists.\n*\n* @param {string} filepath - The filepath to check. Will make it absolute if not already using {@link getAbsolutePath}.\n* @param {string} [directory] - The directory to base the filepath on.\n*\n* @returns {boolean} - Whether or not it is a file.\n",
"start": 602,
"end": 883,
"loc": {
"start": {
"line": 23,
"column": 0
},
"end": {
"line": 30,
"column": 2
}
},
"range": [
602,
883
]
}
],
"trailingComments": [
{
"type": "Block",
"value": "*\n * Gets the Roc dependencies from a `package.json`.\n *\n * @param {Object} packageJson - A package.json file to fetch Roc dependencies from.\n *\n * @returns {string[]} - An array with Roc extensions that exists in the `package.json`.\n ",
"start": 1097,
"end": 1336,
"loc": {
"start": {
"line": 40,
"column": 0
},
"end": {
"line": 46,
"column": 3
}
},
"range": [
1097,
1336
]
}
]
},
{
"type": "ExportNamedDeclaration",
"start": 1337,
"end": 1576,
"loc": {
"start": {
"line": 47,
"column": 0
},
"end": {
"line": 53,
"column": 1
}
},
"declaration": {
"type": "FunctionDeclaration",
"start": 1344,
"end": 1576,
"loc": {
"start": {
"line": 47,
"column": 7
},
"end": {
"line": 53,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 1353,
"end": 1371,
"loc": {
"start": {
"line": 47,
"column": 16
},
"end": {
"line": 47,
"column": 34
}
},
"name": "getRocDependencies",
"leadingComments": null
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 1372,
"end": 1383,
"loc": {
"start": {
"line": 47,
"column": 35
},
"end": {
"line": 47,
"column": 46
}
},
"name": "packageJson"
}
],
"body": {
"type": "BlockStatement",
"start": 1385,
"end": 1576,
"loc": {
"start": {
"line": 47,
"column": 48
},
"end": {
"line": 53,
"column": 1
}
},
"body": [
{
"type": "ReturnStatement",
"start": 1391,
"end": 1574,
"loc": {
"start": {
"line": 48,
"column": 4
},
"end": {
"line": 52,
"column": 54
}
},
"argument": {
"type": "CallExpression",
"start": 1398,
"end": 1573,
"loc": {
"start": {
"line": 48,
"column": 11
},
"end": {
"line": 52,
"column": 53
}
},
"callee": {
"type": "MemberExpression",
"start": 1398,
"end": 1531,
"loc": {
"start": {
"line": 48,
"column": 11
},
"end": {
"line": 52,
"column": 11
}
},
"object": {
"type": "ArrayExpression",
"start": 1398,
"end": 1519,
"loc": {
"start": {
"line": 48,
"column": 11
},
"end": {
"line": 51,
"column": 5
}
},
"elements": [
{
"type": "SpreadElement",
"start": 1408,
"end": 1454,
"loc": {
"start": {
"line": 49,
"column": 8
},
"end": {
"line": 49,
"column": 54
}
},
"argument": {
"type": "CallExpression",
"start": 1411,
"end": 1454,
"loc": {
"start": {
"line": 49,
"column": 11
},
"end": {
"line": 49,
"column": 54
}
},
"callee": {
"type": "MemberExpression",
"start": 1411,
"end": 1422,
"loc": {
"start": {
"line": 49,
"column": 11
},
"end": {
"line": 49,
"column": 22
}
},
"object": {
"type": "Identifier",
"start": 1411,
"end": 1417,
"loc": {
"start": {
"line": 49,
"column": 11
},
"end": {
"line": 49,
"column": 17
}
},
"name": "Object"
},
"property": {
"type": "Identifier",
"start": 1418,
"end": 1422,
"loc": {
"start": {
"line": 49,
"column": 18
},
"end": {
"line": 49,
"column": 22
}
},
"name": "keys"
},
"computed": false
},
"arguments": [
{
"type": "LogicalExpression",
"start": 1423,
"end": 1453,
"loc": {
"start": {
"line": 49,
"column": 23
},
"end": {
"line": 49,
"column": 53
}
},
"left": {
"type": "MemberExpression",
"start": 1423,
"end": 1447,
"loc": {
"start": {
"line": 49,
"column": 23
},
"end": {
"line": 49,
"column": 47
}
},
"object": {
"type": "Identifier",
"start": 1423,
"end": 1434,
"loc": {
"start": {
"line": 49,
"column": 23
},
"end": {
"line": 49,
"column": 34
}
},
"name": "packageJson"
},
"property": {
"type": "Identifier",
"start": 1435,
"end": 1447,
"loc": {
"start": {
"line": 49,
"column": 35
},
"end": {
"line": 49,
"column": 47
}
},
"name": "dependencies"
},
"computed": false
},
"operator": "||",
"right": {
"type": "ObjectExpression",
"start": 1451,
"end": 1453,
"loc": {
"start": {
"line": 49,
"column": 51
},
"end": {
"line": 49,
"column": 53
}
},
"properties": []
}
}
]
}
},
{
"type": "SpreadElement",
"start": 1464,
"end": 1513,
"loc": {
"start": {
"line": 50,
"column": 8
},
"end": {
"line": 50,
"column": 57
}
},
"argument": {
"type": "CallExpression",
"start": 1467,
"end": 1513,
"loc": {
"start": {
"line": 50,
"column": 11
},
"end": {
"line": 50,
"column": 57