checkly 0.0.0-pr.1006.b6b3be2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (314) hide show
  1. package/README.md +102 -0
  2. package/bin/run +5 -0
  3. package/bin/run.cmd +3 -0
  4. package/constructs.d.ts +1 -0
  5. package/constructs.js +2 -0
  6. package/dist/auth/index.d.ts +15 -0
  7. package/dist/auth/index.js +262 -0
  8. package/dist/auth/index.js.map +1 -0
  9. package/dist/commands/authCommand.d.ts +5 -0
  10. package/dist/commands/authCommand.js +37 -0
  11. package/dist/commands/authCommand.js.map +1 -0
  12. package/dist/commands/baseCommand.d.ts +13 -0
  13. package/dist/commands/baseCommand.js +48 -0
  14. package/dist/commands/baseCommand.js.map +1 -0
  15. package/dist/commands/deploy.d.ts +18 -0
  16. package/dist/commands/deploy.js +289 -0
  17. package/dist/commands/deploy.js.map +1 -0
  18. package/dist/commands/destroy.d.ts +10 -0
  19. package/dist/commands/destroy.js +84 -0
  20. package/dist/commands/destroy.js.map +1 -0
  21. package/dist/commands/env/add.d.ts +14 -0
  22. package/dist/commands/env/add.js +85 -0
  23. package/dist/commands/env/add.js.map +1 -0
  24. package/dist/commands/env/ls.d.ts +6 -0
  25. package/dist/commands/env/ls.js +44 -0
  26. package/dist/commands/env/ls.js.map +1 -0
  27. package/dist/commands/env/pull.d.ts +12 -0
  28. package/dist/commands/env/pull.js +99 -0
  29. package/dist/commands/env/pull.js.map +1 -0
  30. package/dist/commands/env/rm.d.ts +12 -0
  31. package/dist/commands/env/rm.js +82 -0
  32. package/dist/commands/env/rm.js.map +1 -0
  33. package/dist/commands/env/update.d.ts +14 -0
  34. package/dist/commands/env/update.js +88 -0
  35. package/dist/commands/env/update.js.map +1 -0
  36. package/dist/commands/help.d.ts +6 -0
  37. package/dist/commands/help.js +17 -0
  38. package/dist/commands/help.js.map +1 -0
  39. package/dist/commands/login.d.ts +13 -0
  40. package/dist/commands/login.js +134 -0
  41. package/dist/commands/login.js.map +1 -0
  42. package/dist/commands/logout.d.ts +9 -0
  43. package/dist/commands/logout.js +43 -0
  44. package/dist/commands/logout.js.map +1 -0
  45. package/dist/commands/runtimes.d.ts +6 -0
  46. package/dist/commands/runtimes.js +49 -0
  47. package/dist/commands/runtimes.js.map +1 -0
  48. package/dist/commands/switch.d.ts +9 -0
  49. package/dist/commands/switch.js +81 -0
  50. package/dist/commands/switch.js.map +1 -0
  51. package/dist/commands/sync-playwright.d.ts +10 -0
  52. package/dist/commands/sync-playwright.js +98 -0
  53. package/dist/commands/sync-playwright.js.map +1 -0
  54. package/dist/commands/test.d.ts +45 -0
  55. package/dist/commands/test.js +366 -0
  56. package/dist/commands/test.js.map +1 -0
  57. package/dist/commands/trigger.d.ts +37 -0
  58. package/dist/commands/trigger.js +242 -0
  59. package/dist/commands/trigger.js.map +1 -0
  60. package/dist/commands/whoami.d.ts +6 -0
  61. package/dist/commands/whoami.js +42 -0
  62. package/dist/commands/whoami.js.map +1 -0
  63. package/dist/config.d.ts +31 -0
  64. package/dist/config.js +8 -0
  65. package/dist/config.js.map +1 -0
  66. package/dist/constants.d.ts +7 -0
  67. package/dist/constants.js +10 -0
  68. package/dist/constants.js.map +1 -0
  69. package/dist/constructs/alert-channel-subscription.d.ts +44 -0
  70. package/dist/constructs/alert-channel-subscription.js +39 -0
  71. package/dist/constructs/alert-channel-subscription.js.map +1 -0
  72. package/dist/constructs/alert-channel.d.ts +53 -0
  73. package/dist/constructs/alert-channel.js +55 -0
  74. package/dist/constructs/alert-channel.js.map +1 -0
  75. package/dist/constructs/alert-escalation-policy.d.ts +34 -0
  76. package/dist/constructs/alert-escalation-policy.js +47 -0
  77. package/dist/constructs/alert-escalation-policy.js.map +1 -0
  78. package/dist/constructs/api-check.d.ts +187 -0
  79. package/dist/constructs/api-check.js +279 -0
  80. package/dist/constructs/api-check.js.map +1 -0
  81. package/dist/constructs/browser-check.d.ts +90 -0
  82. package/dist/constructs/browser-check.js +151 -0
  83. package/dist/constructs/browser-check.js.map +1 -0
  84. package/dist/constructs/check-group.d.ts +162 -0
  85. package/dist/constructs/check-group.js +208 -0
  86. package/dist/constructs/check-group.js.map +1 -0
  87. package/dist/constructs/check.d.ts +144 -0
  88. package/dist/constructs/check.js +133 -0
  89. package/dist/constructs/check.js.map +1 -0
  90. package/dist/constructs/construct.d.ts +17 -0
  91. package/dist/constructs/construct.js +22 -0
  92. package/dist/constructs/construct.js.map +1 -0
  93. package/dist/constructs/dashboard.d.ts +138 -0
  94. package/dist/constructs/dashboard.js +126 -0
  95. package/dist/constructs/dashboard.js.map +1 -0
  96. package/dist/constructs/email-alert-channel.d.ts +26 -0
  97. package/dist/constructs/email-alert-channel.js +37 -0
  98. package/dist/constructs/email-alert-channel.js.map +1 -0
  99. package/dist/constructs/environment-variable.d.ts +2 -0
  100. package/dist/constructs/environment-variable.js +3 -0
  101. package/dist/constructs/environment-variable.js.map +1 -0
  102. package/dist/constructs/frequency.d.ts +20 -0
  103. package/dist/constructs/frequency.js +26 -0
  104. package/dist/constructs/frequency.js.map +1 -0
  105. package/dist/constructs/heartbeat-check.d.ts +43 -0
  106. package/dist/constructs/heartbeat-check.js +61 -0
  107. package/dist/constructs/heartbeat-check.js.map +1 -0
  108. package/dist/constructs/http-header.d.ts +2 -0
  109. package/dist/constructs/http-header.js +3 -0
  110. package/dist/constructs/http-header.js.map +1 -0
  111. package/dist/constructs/index.d.ts +27 -0
  112. package/dist/constructs/index.js +44 -0
  113. package/dist/constructs/index.js.map +1 -0
  114. package/dist/constructs/key-value-pair.d.ts +6 -0
  115. package/dist/constructs/key-value-pair.js +3 -0
  116. package/dist/constructs/key-value-pair.js.map +1 -0
  117. package/dist/constructs/maintenance-window.d.ts +61 -0
  118. package/dist/constructs/maintenance-window.js +47 -0
  119. package/dist/constructs/maintenance-window.js.map +1 -0
  120. package/dist/constructs/multi-step-check.d.ts +65 -0
  121. package/dist/constructs/multi-step-check.js +153 -0
  122. package/dist/constructs/multi-step-check.js.map +1 -0
  123. package/dist/constructs/opsgenie-alert-channel.d.ts +45 -0
  124. package/dist/constructs/opsgenie-alert-channel.js +44 -0
  125. package/dist/constructs/opsgenie-alert-channel.js.map +1 -0
  126. package/dist/constructs/pagerduty-alert-channel.d.ts +39 -0
  127. package/dist/constructs/pagerduty-alert-channel.js +42 -0
  128. package/dist/constructs/pagerduty-alert-channel.js.map +1 -0
  129. package/dist/constructs/phone-call-alert-channel.d.ts +34 -0
  130. package/dist/constructs/phone-call-alert-channel.js +42 -0
  131. package/dist/constructs/phone-call-alert-channel.js.map +1 -0
  132. package/dist/constructs/playwright-config.d.ts +52 -0
  133. package/dist/constructs/playwright-config.js +3 -0
  134. package/dist/constructs/playwright-config.js.map +1 -0
  135. package/dist/constructs/private-location-check-assignment.d.ts +29 -0
  136. package/dist/constructs/private-location-check-assignment.js +35 -0
  137. package/dist/constructs/private-location-check-assignment.js.map +1 -0
  138. package/dist/constructs/private-location-group-assignment.d.ts +29 -0
  139. package/dist/constructs/private-location-group-assignment.js +35 -0
  140. package/dist/constructs/private-location-group-assignment.js.map +1 -0
  141. package/dist/constructs/private-location.d.ts +51 -0
  142. package/dist/constructs/private-location.js +61 -0
  143. package/dist/constructs/private-location.js.map +1 -0
  144. package/dist/constructs/project.d.ts +66 -0
  145. package/dist/constructs/project.js +155 -0
  146. package/dist/constructs/project.js.map +1 -0
  147. package/dist/constructs/query-param.d.ts +2 -0
  148. package/dist/constructs/query-param.js +3 -0
  149. package/dist/constructs/query-param.js.map +1 -0
  150. package/dist/constructs/ref.d.ts +5 -0
  151. package/dist/constructs/ref.js +13 -0
  152. package/dist/constructs/ref.js.map +1 -0
  153. package/dist/constructs/retry-strategy.d.ts +50 -0
  154. package/dist/constructs/retry-strategy.js +51 -0
  155. package/dist/constructs/retry-strategy.js.map +1 -0
  156. package/dist/constructs/slack-alert-channel.d.ts +26 -0
  157. package/dist/constructs/slack-alert-channel.js +40 -0
  158. package/dist/constructs/slack-alert-channel.js.map +1 -0
  159. package/dist/constructs/sms-alert-channel.d.ts +32 -0
  160. package/dist/constructs/sms-alert-channel.js +40 -0
  161. package/dist/constructs/sms-alert-channel.js.map +1 -0
  162. package/dist/constructs/validator-error.d.ts +2 -0
  163. package/dist/constructs/validator-error.js +7 -0
  164. package/dist/constructs/validator-error.js.map +1 -0
  165. package/dist/constructs/webhook-alert-channel.d.ts +67 -0
  166. package/dist/constructs/webhook-alert-channel.js +52 -0
  167. package/dist/constructs/webhook-alert-channel.js.map +1 -0
  168. package/dist/help/examples.d.ts +6 -0
  169. package/dist/help/examples.js +22 -0
  170. package/dist/help/examples.js.map +1 -0
  171. package/dist/help/help-extension.d.ts +7 -0
  172. package/dist/help/help-extension.js +59 -0
  173. package/dist/help/help-extension.js.map +1 -0
  174. package/dist/index.d.ts +3 -0
  175. package/dist/index.js +30 -0
  176. package/dist/index.js.map +1 -0
  177. package/dist/messages/common-messages.d.ts +5 -0
  178. package/dist/messages/common-messages.js +9 -0
  179. package/dist/messages/common-messages.js.map +1 -0
  180. package/dist/playwright/playwright-config-loader.d.ts +1 -0
  181. package/dist/playwright/playwright-config-loader.js +26 -0
  182. package/dist/playwright/playwright-config-loader.js.map +1 -0
  183. package/dist/playwright/playwright-config-template.d.ts +8 -0
  184. package/dist/playwright/playwright-config-template.js +78 -0
  185. package/dist/playwright/playwright-config-template.js.map +1 -0
  186. package/dist/reporters/abstract-list.d.ts +41 -0
  187. package/dist/reporters/abstract-list.js +171 -0
  188. package/dist/reporters/abstract-list.js.map +1 -0
  189. package/dist/reporters/ci.d.ts +12 -0
  190. package/dist/reporters/ci.js +34 -0
  191. package/dist/reporters/ci.js.map +1 -0
  192. package/dist/reporters/dot.d.ts +10 -0
  193. package/dist/reporters/dot.js +29 -0
  194. package/dist/reporters/dot.js.map +1 -0
  195. package/dist/reporters/github.d.ts +32 -0
  196. package/dist/reporters/github.js +119 -0
  197. package/dist/reporters/github.js.map +1 -0
  198. package/dist/reporters/json.d.ts +26 -0
  199. package/dist/reporters/json.js +101 -0
  200. package/dist/reporters/json.js.map +1 -0
  201. package/dist/reporters/list.d.ts +15 -0
  202. package/dist/reporters/list.js +85 -0
  203. package/dist/reporters/list.js.map +1 -0
  204. package/dist/reporters/reporter.d.ts +16 -0
  205. package/dist/reporters/reporter.js +29 -0
  206. package/dist/reporters/reporter.js.map +1 -0
  207. package/dist/reporters/util.d.ts +18 -0
  208. package/dist/reporters/util.js +325 -0
  209. package/dist/reporters/util.js.map +1 -0
  210. package/dist/rest/accounts.d.ts +12 -0
  211. package/dist/rest/accounts.js +15 -0
  212. package/dist/rest/accounts.js.map +1 -0
  213. package/dist/rest/api.d.ts +33 -0
  214. package/dist/rest/api.js +98 -0
  215. package/dist/rest/api.js.map +1 -0
  216. package/dist/rest/assets.d.ts +13 -0
  217. package/dist/rest/assets.js +30 -0
  218. package/dist/rest/assets.js.map +1 -0
  219. package/dist/rest/checkly-storage.d.ts +12 -0
  220. package/dist/rest/checkly-storage.js +15 -0
  221. package/dist/rest/checkly-storage.js.map +1 -0
  222. package/dist/rest/environment-variables.d.ts +17 -0
  223. package/dist/rest/environment-variables.js +25 -0
  224. package/dist/rest/environment-variables.js.map +1 -0
  225. package/dist/rest/heartbeat-checks.d.ts +11 -0
  226. package/dist/rest/heartbeat-checks.js +17 -0
  227. package/dist/rest/heartbeat-checks.js.map +1 -0
  228. package/dist/rest/locations.d.ts +11 -0
  229. package/dist/rest/locations.js +12 -0
  230. package/dist/rest/locations.js.map +1 -0
  231. package/dist/rest/private-locations.d.ts +10 -0
  232. package/dist/rest/private-locations.js +12 -0
  233. package/dist/rest/private-locations.js.map +1 -0
  234. package/dist/rest/projects.d.ts +46 -0
  235. package/dist/rest/projects.js +25 -0
  236. package/dist/rest/projects.js.map +1 -0
  237. package/dist/rest/runtimes.d.ts +16 -0
  238. package/dist/rest/runtimes.js +15 -0
  239. package/dist/rest/runtimes.js.map +1 -0
  240. package/dist/rest/test-sessions.d.ts +59 -0
  241. package/dist/rest/test-sessions.js +24 -0
  242. package/dist/rest/test-sessions.js.map +1 -0
  243. package/dist/rest/users.d.ts +12 -0
  244. package/dist/rest/users.js +12 -0
  245. package/dist/rest/users.js.map +1 -0
  246. package/dist/rest/util.d.ts +4 -0
  247. package/dist/rest/util.js +17 -0
  248. package/dist/rest/util.js.map +1 -0
  249. package/dist/services/abstract-check-runner.d.ts +60 -0
  250. package/dist/services/abstract-check-runner.js +225 -0
  251. package/dist/services/abstract-check-runner.js.map +1 -0
  252. package/dist/services/check-parser/collector.d.ts +33 -0
  253. package/dist/services/check-parser/collector.js +48 -0
  254. package/dist/services/check-parser/collector.js.map +1 -0
  255. package/dist/services/check-parser/errors.d.ts +8 -0
  256. package/dist/services/check-parser/errors.js +45 -0
  257. package/dist/services/check-parser/errors.js.map +1 -0
  258. package/dist/services/check-parser/package-files/index.d.ts +1 -0
  259. package/dist/services/check-parser/package-files/index.js +6 -0
  260. package/dist/services/check-parser/package-files/index.js.map +1 -0
  261. package/dist/services/check-parser/package-files/json-source-file.d.ts +13 -0
  262. package/dist/services/check-parser/package-files/json-source-file.js +34 -0
  263. package/dist/services/check-parser/package-files/json-source-file.js.map +1 -0
  264. package/dist/services/check-parser/package-files/loader.d.ts +7 -0
  265. package/dist/services/check-parser/package-files/loader.js +19 -0
  266. package/dist/services/check-parser/package-files/loader.js.map +1 -0
  267. package/dist/services/check-parser/package-files/package-json-file.d.ts +23 -0
  268. package/dist/services/check-parser/package-files/package-json-file.js +44 -0
  269. package/dist/services/check-parser/package-files/package-json-file.js.map +1 -0
  270. package/dist/services/check-parser/package-files/paths.d.ts +22 -0
  271. package/dist/services/check-parser/package-files/paths.js +108 -0
  272. package/dist/services/check-parser/package-files/paths.js.map +1 -0
  273. package/dist/services/check-parser/package-files/resolver.d.ts +32 -0
  274. package/dist/services/check-parser/package-files/resolver.js +186 -0
  275. package/dist/services/check-parser/package-files/resolver.js.map +1 -0
  276. package/dist/services/check-parser/package-files/source-file.d.ts +13 -0
  277. package/dist/services/check-parser/package-files/source-file.js +41 -0
  278. package/dist/services/check-parser/package-files/source-file.js.map +1 -0
  279. package/dist/services/check-parser/package-files/tsconfig-json-file.d.ts +68 -0
  280. package/dist/services/check-parser/package-files/tsconfig-json-file.js +119 -0
  281. package/dist/services/check-parser/package-files/tsconfig-json-file.js.map +1 -0
  282. package/dist/services/check-parser/parser.d.ts +32 -0
  283. package/dist/services/check-parser/parser.js +303 -0
  284. package/dist/services/check-parser/parser.js.map +1 -0
  285. package/dist/services/checkly-config-loader.d.ts +72 -0
  286. package/dist/services/checkly-config-loader.js +103 -0
  287. package/dist/services/checkly-config-loader.js.map +1 -0
  288. package/dist/services/config.d.ts +28 -0
  289. package/dist/services/config.js +99 -0
  290. package/dist/services/config.js.map +1 -0
  291. package/dist/services/project-parser.d.ts +21 -0
  292. package/dist/services/project-parser.js +192 -0
  293. package/dist/services/project-parser.js.map +1 -0
  294. package/dist/services/snapshot-service.d.ts +13 -0
  295. package/dist/services/snapshot-service.js +85 -0
  296. package/dist/services/snapshot-service.js.map +1 -0
  297. package/dist/services/socket-client.d.ts +4 -0
  298. package/dist/services/socket-client.js +88 -0
  299. package/dist/services/socket-client.js.map +1 -0
  300. package/dist/services/test-filters.d.ts +3 -0
  301. package/dist/services/test-filters.js +27 -0
  302. package/dist/services/test-filters.js.map +1 -0
  303. package/dist/services/test-runner.d.ts +24 -0
  304. package/dist/services/test-runner.js +91 -0
  305. package/dist/services/test-runner.js.map +1 -0
  306. package/dist/services/trigger-runner.d.ts +29 -0
  307. package/dist/services/trigger-runner.js +59 -0
  308. package/dist/services/trigger-runner.js.map +1 -0
  309. package/dist/services/util.d.ts +32 -0
  310. package/dist/services/util.js +244 -0
  311. package/dist/services/util.js.map +1 -0
  312. package/dist/tsconfig.tsbuildinfo +1 -0
  313. package/oclif.manifest.json +635 -0
  314. package/package.json +151 -0
@@ -0,0 +1,186 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PackageFilesResolver = void 0;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const source_file_1 = require("./source-file");
9
+ const package_json_file_1 = require("./package-json-file");
10
+ const tsconfig_json_file_1 = require("./tsconfig-json-file");
11
+ const paths_1 = require("./paths");
12
+ const loader_1 = require("./loader");
13
+ class PackageFilesResolver {
14
+ constructor() {
15
+ this.packageJsonCache = new loader_1.FileLoader(package_json_file_1.PackageJsonFile.loadFromFilePath);
16
+ this.tsconfigJsonCache = new loader_1.FileLoader(tsconfig_json_file_1.TSConfigFile.loadFromFilePath);
17
+ }
18
+ loadPackageFiles(filePath, options) {
19
+ const files = {};
20
+ let currentPath = filePath;
21
+ while (true) {
22
+ const prevPath = currentPath;
23
+ currentPath = node_path_1.default.dirname(prevPath);
24
+ // Bail out if we reach root.
25
+ if (prevPath === currentPath) {
26
+ break;
27
+ }
28
+ if (files.packageJson === undefined) {
29
+ files.packageJson = this.packageJsonCache.load(package_json_file_1.PackageJsonFile.filePath(currentPath));
30
+ }
31
+ if (files.tsconfigJson === undefined) {
32
+ files.tsconfigJson = this.tsconfigJsonCache.load(tsconfig_json_file_1.TSConfigFile.filePath(currentPath));
33
+ }
34
+ // Stop if we've found all files.
35
+ if (files.packageJson !== undefined && files.tsconfigJson !== undefined) {
36
+ break;
37
+ }
38
+ // Stop if we reach the user-specified root directory.
39
+ // TODO: I don't like a string comparison for this but it'll do for now.
40
+ if (currentPath === (options === null || options === void 0 ? void 0 : options.root)) {
41
+ break;
42
+ }
43
+ }
44
+ return files;
45
+ }
46
+ resolveSourceFile(sourceFile) {
47
+ if (sourceFile.meta.basename === package_json_file_1.PackageJsonFile.FILENAME) {
48
+ const packageJson = this.packageJsonCache.load(sourceFile.meta.filePath);
49
+ if (packageJson === undefined) {
50
+ // This should never happen unless the package.json is invalid or
51
+ // something.
52
+ return [sourceFile];
53
+ }
54
+ // Go through each main path. A fallback path is included. If we can
55
+ // find a tsconfig for the main file, look it up and attempt to find
56
+ // the original TypeScript sources roughly the same way tsc does it.
57
+ for (const mainPath of packageJson.mainPaths) {
58
+ const { tsconfigJson } = this.loadPackageFiles(mainPath, {
59
+ root: packageJson.basePath,
60
+ });
61
+ if (tsconfigJson === undefined) {
62
+ const mainSourceFile = source_file_1.SourceFile.loadFromFilePath(mainPath);
63
+ if (mainSourceFile === undefined) {
64
+ continue;
65
+ }
66
+ return [sourceFile, mainSourceFile];
67
+ }
68
+ const candidatePaths = tsconfigJson.collectLookupPaths(mainPath);
69
+ for (const candidatePath of candidatePaths) {
70
+ const mainSourceFile = source_file_1.SourceFile.loadFromFilePath(candidatePath);
71
+ if (mainSourceFile === undefined) {
72
+ continue;
73
+ }
74
+ return [sourceFile, mainSourceFile];
75
+ }
76
+ }
77
+ // TODO: Is this even useful without any code files?
78
+ return [sourceFile];
79
+ }
80
+ return [sourceFile];
81
+ }
82
+ resolveDependenciesForFilePath(filePath, dependencies, suffixes) {
83
+ const resolved = {
84
+ external: [],
85
+ missing: [],
86
+ local: [],
87
+ };
88
+ const dirname = node_path_1.default.dirname(filePath);
89
+ const { packageJson, tsconfigJson } = this.loadPackageFiles(filePath);
90
+ for (const dep of dependencies) {
91
+ if ((0, paths_1.isLocalPath)(dep)) {
92
+ const relativeDepPath = node_path_1.default.resolve(dirname, dep);
93
+ const sourceFile = source_file_1.SourceFile.loadFromFilePath(relativeDepPath, suffixes);
94
+ if (sourceFile !== undefined) {
95
+ const resolvedFiles = this.resolveSourceFile(sourceFile);
96
+ let found = false;
97
+ for (const resolvedFile of resolvedFiles) {
98
+ resolved.local.push({
99
+ sourceFile: resolvedFile,
100
+ origin: 'relative-path',
101
+ });
102
+ found = true;
103
+ }
104
+ if (found) {
105
+ continue;
106
+ }
107
+ }
108
+ resolved.missing.push({
109
+ spec: dep,
110
+ filePath: relativeDepPath,
111
+ });
112
+ continue;
113
+ }
114
+ if (tsconfigJson !== undefined) {
115
+ const resolvedPaths = tsconfigJson.resolvePath(dep);
116
+ if (resolvedPaths.length > 0) {
117
+ let found = false;
118
+ for (const resolvedPath of resolvedPaths) {
119
+ const relativePath = node_path_1.default.resolve(tsconfigJson.basePath, resolvedPath);
120
+ const sourceFile = source_file_1.SourceFile.loadFromFilePath(relativePath, suffixes);
121
+ if (sourceFile !== undefined) {
122
+ const resolvedFiles = this.resolveSourceFile(sourceFile);
123
+ for (const resolvedFile of resolvedFiles) {
124
+ resolved.local.push({
125
+ sourceFile: resolvedFile,
126
+ origin: 'tsconfig-resolved-path',
127
+ });
128
+ found = true;
129
+ }
130
+ if (found) {
131
+ // We're trying to find the first match out of many possible
132
+ // candidates. Stop once we find a match.
133
+ break;
134
+ }
135
+ }
136
+ }
137
+ if (found) {
138
+ continue;
139
+ }
140
+ }
141
+ if (tsconfigJson.baseUrl !== undefined) {
142
+ const relativePath = node_path_1.default.resolve(tsconfigJson.basePath, tsconfigJson.baseUrl, dep);
143
+ const sourceFile = source_file_1.SourceFile.loadFromFilePath(relativePath, suffixes);
144
+ if (sourceFile !== undefined) {
145
+ const resolvedFiles = this.resolveSourceFile(sourceFile);
146
+ let found = false;
147
+ for (const resolvedFile of resolvedFiles) {
148
+ resolved.local.push({
149
+ sourceFile: resolvedFile,
150
+ origin: 'tsconfig-baseurl-relative-path',
151
+ });
152
+ found = true;
153
+ }
154
+ if (found) {
155
+ continue;
156
+ }
157
+ }
158
+ }
159
+ }
160
+ if (packageJson !== undefined) {
161
+ if (packageJson.supportsPackageRelativePaths()) {
162
+ const relativePath = node_path_1.default.resolve(packageJson.basePath, dep);
163
+ const sourceFile = source_file_1.SourceFile.loadFromFilePath(relativePath, suffixes);
164
+ if (sourceFile !== undefined) {
165
+ const resolvedFiles = this.resolveSourceFile(sourceFile);
166
+ let found = false;
167
+ for (const resolvedFile of resolvedFiles) {
168
+ resolved.local.push({
169
+ sourceFile: resolvedFile,
170
+ origin: 'package-relative-path',
171
+ });
172
+ found = true;
173
+ }
174
+ if (found) {
175
+ continue;
176
+ }
177
+ }
178
+ }
179
+ }
180
+ resolved.external.push(dep);
181
+ }
182
+ return resolved;
183
+ }
184
+ }
185
+ exports.PackageFilesResolver = PackageFilesResolver;
186
+ //# sourceMappingURL=resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../../../src/services/check-parser/package-files/resolver.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAE5B,+CAA0C;AAC1C,2DAAqD;AACrD,6DAAmD;AACnD,mCAAqC;AACrC,qCAAqC;AA0BrC,MAAa,oBAAoB;IAAjC;QACE,qBAAgB,GAAG,IAAI,mBAAU,CAAC,mCAAe,CAAC,gBAAgB,CAAC,CAAA;QACnE,sBAAiB,GAAG,IAAI,mBAAU,CAAC,iCAAY,CAAC,gBAAgB,CAAC,CAAA;IAsMnE,CAAC;IApMC,gBAAgB,CAAE,QAAgB,EAAE,OAA2B;QAC7D,MAAM,KAAK,GAAiB,EAAE,CAAA;QAE9B,IAAI,WAAW,GAAG,QAAQ,CAAA;QAE1B,OAAO,IAAI,EAAE,CAAC;YACZ,MAAM,QAAQ,GAAG,WAAW,CAAA;YAE5B,WAAW,GAAG,mBAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;YAEpC,6BAA6B;YAC7B,IAAI,QAAQ,KAAK,WAAW,EAAE,CAAC;gBAC7B,MAAK;YACP,CAAC;YAED,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;gBACpC,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,mCAAe,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAA;YACvF,CAAC;YAED,IAAI,KAAK,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;gBACrC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,iCAAY,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAA;YACtF,CAAC;YAED,iC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AAE,uBAAuB;6BAChC,CAAC,CAAA;4BACF,KAAK,GAAG,IAAI,CAAA;wBACd,CAAC;wBACD,IAAI,KAAK,EAAE,CAAC;4BACV,SAAQ;wBACV,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;YAED,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAC7B,CAAC;QAED,OAAO,QAAQ,CAAA;IACjB,CAAC;CACF;AAxMD,oDAwMC"}
@@ -0,0 +1,13 @@
1
+ export declare class FileMeta {
2
+ filePath: string;
3
+ dirname: string;
4
+ basename: string;
5
+ private constructor();
6
+ static fromFilePath(filePath: string): FileMeta;
7
+ }
8
+ export declare class SourceFile {
9
+ contents: string;
10
+ meta: FileMeta;
11
+ private constructor();
12
+ static loadFromFilePath(filePath: string, suffixes?: string[]): SourceFile | undefined;
13
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SourceFile = exports.FileMeta = void 0;
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ class FileMeta {
10
+ constructor(filePath, dirname, basename) {
11
+ this.filePath = filePath;
12
+ this.dirname = dirname;
13
+ this.basename = basename;
14
+ }
15
+ static fromFilePath(filePath) {
16
+ return new FileMeta(filePath, node_path_1.default.dirname(filePath), node_path_1.default.basename(filePath));
17
+ }
18
+ }
19
+ exports.FileMeta = FileMeta;
20
+ class SourceFile {
21
+ constructor(meta, contents) {
22
+ this.meta = meta;
23
+ this.contents = contents;
24
+ }
25
+ static loadFromFilePath(filePath, suffixes) {
26
+ for (const suffix of ['', ...suffixes !== null && suffixes !== void 0 ? suffixes : []]) {
27
+ try {
28
+ const suffixFilePath = filePath + suffix;
29
+ const contents = node_fs_1.default.readFileSync(suffixFilePath, {
30
+ encoding: 'utf8',
31
+ });
32
+ const meta = FileMeta.fromFilePath(suffixFilePath);
33
+ return new SourceFile(meta, contents);
34
+ }
35
+ catch (err) {
36
+ }
37
+ }
38
+ }
39
+ }
40
+ exports.SourceFile = SourceFile;
41
+ //# sourceMappingURL=source-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-file.js","sourceRoot":"","sources":["../../../../src/services/check-parser/package-files/source-file.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAwB;AACxB,0DAA4B;AAE5B,MAAa,QAAQ;IAKnB,YAAqB,QAAgB,EAAE,OAAe,EAAE,QAAgB;QACtE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAED,MAAM,CAAC,YAAY,CAAE,QAAgB;QACnC,OAAO,IAAI,QAAQ,CACjB,QAAQ,EACR,mBAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EACtB,mBAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACxB,CAAA;IACH,CAAC;CACF;AAlBD,4BAkBC;AAED,MAAa,UAAU;IAIrB,YAAqB,IAAc,EAAE,QAAgB;QACnD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAE,QAAgB,EAAE,QAAmB;QAC5D,KAAK,MAAM,MAAM,IAAI,CAAC,EAAE,EAAE,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,EAAE,CAAC,EAAE,CAAC;YAC7C,IAAI,CAAC;gBACH,MAAM,cAAc,GAAG,QAAQ,GAAG,MAAM,CAAA;gBAExC,MAAM,QAAQ,GAAG,iBAAE,CAAC,YAAY,CAAC,cAAc,EAAE;oBAC/C,QAAQ,EAAE,MAAM;iBACjB,CAAC,CAAA;gBAEF,MAAM,IAAI,GAAG,QAAQ,CAAC,YAAY,CAAC,cAAc,CAAC,CAAA;gBAElD,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;YACvC,CAAC;YAAC,OAAO,GAAQ,EAAE,CAAC;YACpB,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAzBD,gCAyBC"}
@@ -0,0 +1,68 @@
1
+ import { JsonSourceFile } from './json-source-file';
2
+ import { PathResolver } from './paths';
3
+ import type { LoadFile } from './loader';
4
+ type Module = 'none' | 'commonjs' | 'amd' | 'system' | 'es6' | 'es2015' | 'es2020' | 'es2022' | 'esnext' | 'node16' | 'nodenext' | 'preserve';
5
+ type ModuleResolution = 'classic' | 'node10' | 'node' | 'node16' | 'nodenext' | 'bundler';
6
+ type Paths = Record<string, Array<string>>;
7
+ interface CompilerOptions {
8
+ module?: Module;
9
+ moduleResolution?: ModuleResolution;
10
+ baseUrl?: string;
11
+ paths?: Paths;
12
+ /**
13
+ * If set, .js files will be emitted into this directory.
14
+ *
15
+ * If not set, .js files are placed right next to .ts files in the same
16
+ * folder.
17
+ *
18
+ * @see https://www.typescriptlang.org/tsconfig/#outDir
19
+ */
20
+ outDir?: string;
21
+ /**
22
+ * If not set, rootDir is inferred to be the longest common path of all
23
+ * non-declaration input files, unless `composite: true`, in which case
24
+ * the inferred root is the directory containing the tsconfig.json file.
25
+ *
26
+ * @see https://www.typescriptlang.org/tsconfig/#rootDir
27
+ */
28
+ rootDir?: string;
29
+ /**
30
+ * Allow multiple directions to act as a single root. Source files will be
31
+ * able to refer to files in other roots as if they were present in the same
32
+ * root.
33
+ *
34
+ * @see https://www.typescriptlang.org/tsconfig/#rootDirs
35
+ */
36
+ rootDirs?: string[];
37
+ /**
38
+ * If true, the default rootDir is the directory containing the
39
+ * tsconfig.json file.
40
+ *
41
+ * @see https://www.typescriptlang.org/tsconfig/#composite
42
+ */
43
+ composite?: boolean;
44
+ }
45
+ export interface Schema {
46
+ compilerOptions?: CompilerOptions;
47
+ }
48
+ export type Options = {
49
+ jsonSourceFileLoader?: LoadFile<JsonSourceFile<Schema>>;
50
+ };
51
+ export declare class TSConfigFile {
52
+ static FILENAME: string;
53
+ jsonFile: JsonSourceFile<Schema>;
54
+ basePath: string;
55
+ moduleResolution: string;
56
+ baseUrl?: string;
57
+ pathResolver: PathResolver;
58
+ private constructor();
59
+ get meta(): import("./source-file").FileMeta;
60
+ static loadFromJsonSourceFile(jsonFile: JsonSourceFile<Schema>): TSConfigFile | undefined;
61
+ static loadFromFilePath(filePath: string, options?: Options): TSConfigFile | undefined;
62
+ static filePath(dirPath: string): string;
63
+ supportsPackageRelativePaths(): boolean;
64
+ resolvePath(importPath: string): string[];
65
+ private extifyLookupPaths;
66
+ collectLookupPaths(filePath: string): string[];
67
+ }
68
+ export {};
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.TSConfigFile = void 0;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const json_source_file_1 = require("./json-source-file");
9
+ const paths_1 = require("./paths");
10
+ const JSExtensions = ['.js', '.mjs', '.cjs'];
11
+ /**
12
+ * @see https://www.typescriptlang.org/docs/handbook/modules/reference.html#file-extension-substitution
13
+ */
14
+ const extensionMappings = {
15
+ '.js': ['.ts', '.tsx', '.js', '.jsx'],
16
+ '.mjs': ['.mts', '.mjs'],
17
+ '.cjs': ['.cts', '.cjs'],
18
+ };
19
+ class TSConfigFile {
20
+ constructor(jsonFile) {
21
+ var _a, _b, _c, _d, _e, _f, _g;
22
+ this.jsonFile = jsonFile;
23
+ this.basePath = jsonFile.meta.dirname;
24
+ this.moduleResolution = (_c = (_b = (_a = jsonFile.data.compilerOptions) === null || _a === void 0 ? void 0 : _a.moduleResolution) === null || _b === void 0 ? void 0 : _b.toLocaleLowerCase()) !== null && _c !== void 0 ? _c : 'unspecified';
25
+ const baseUrl = (_d = jsonFile.data.compilerOptions) === null || _d === void 0 ? void 0 : _d.baseUrl;
26
+ if (baseUrl !== undefined) {
27
+ this.baseUrl = node_path_1.default.resolve(this.jsonFile.meta.dirname, baseUrl);
28
+ }
29
+ this.pathResolver = paths_1.PathResolver.createFromPaths((_e = this.baseUrl) !== null && _e !== void 0 ? _e : '.', (_g = (_f = jsonFile.data.compilerOptions) === null || _f === void 0 ? void 0 : _f.paths) !== null && _g !== void 0 ? _g : {});
30
+ }
31
+ get meta() {
32
+ return this.jsonFile.meta;
33
+ }
34
+ static loadFromJsonSourceFile(jsonFile) {
35
+ return new TSConfigFile(jsonFile);
36
+ }
37
+ static loadFromFilePath(filePath, options) {
38
+ const { jsonSourceFileLoader } = {
39
+ jsonSourceFileLoader: (json_source_file_1.JsonSourceFile.loadFromFilePath),
40
+ ...options,
41
+ };
42
+ const jsonFile = jsonSourceFileLoader(filePath);
43
+ if (jsonFile === undefined) {
44
+ return;
45
+ }
46
+ return new TSConfigFile(jsonFile);
47
+ }
48
+ static filePath(dirPath) {
49
+ return node_path_1.default.join(dirPath, TSConfigFile.FILENAME);
50
+ }
51
+ // This doesn't seem to actally be what TS does despite the docs claiming so.
52
+ supportsPackageRelativePaths() {
53
+ switch (this.moduleResolution) {
54
+ case 'node':
55
+ return true;
56
+ case 'node10':
57
+ return true;
58
+ }
59
+ return false;
60
+ }
61
+ resolvePath(importPath) {
62
+ return this.pathResolver.resolve(importPath);
63
+ }
64
+ extifyLookupPaths(filePaths) {
65
+ return filePaths.flatMap(filePath => {
66
+ let extensions = extensionMappings['.js'];
67
+ let extlessPath = filePath;
68
+ for (const ext of JSExtensions) {
69
+ if (filePath.endsWith(ext)) {
70
+ extensions = extensionMappings[ext];
71
+ extlessPath = filePath.substring(0, filePath.length - ext.length);
72
+ }
73
+ }
74
+ return extensions.map(ext => node_path_1.default.resolve(this.basePath, extlessPath + ext));
75
+ });
76
+ }
77
+ collectLookupPaths(filePath) {
78
+ var _a;
79
+ let { outDir, rootDir, rootDirs, composite, } = (_a = this.jsonFile.data.compilerOptions) !== null && _a !== void 0 ? _a : {};
80
+ const candidates = [];
81
+ if (outDir === undefined) {
82
+ candidates.push(filePath);
83
+ return this.extifyLookupPaths(candidates); // Nothing more we can do.
84
+ }
85
+ if (composite === undefined) {
86
+ composite = false;
87
+ }
88
+ // Inferred rootDir is tsconfig directory if composite === true.
89
+ if (rootDir === undefined && composite) {
90
+ rootDir = '.';
91
+ }
92
+ // If we still don't have a root, we should calculate the longest common
93
+ // path among input files, but that's a lot of effort. Assume tsconfig
94
+ // directory and hope for the best.
95
+ if (rootDir === undefined) {
96
+ rootDir = '.';
97
+ }
98
+ const absoluteOutDir = node_path_1.default.resolve(this.basePath, outDir);
99
+ const relativePath = node_path_1.default.relative(absoluteOutDir, filePath);
100
+ // If the file is outside outDir, then assume we're looking for
101
+ // something that wasn't compiled using this tsconfig (or at all), and
102
+ // stop looking.
103
+ if (relativePath.startsWith('..')) {
104
+ candidates.push(filePath);
105
+ return this.extifyLookupPaths(candidates);
106
+ }
107
+ candidates.push(node_path_1.default.resolve(this.basePath, rootDir, relativePath));
108
+ // Assume that our inferred (or user specified) rootDir is enough to cover
109
+ // the same conditions we'd have to infer rootDirs, and only add rootDirs
110
+ // if they're actually set.
111
+ for (const multiRootDir of rootDirs !== null && rootDirs !== void 0 ? rootDirs : []) {
112
+ candidates.push(node_path_1.default.resolve(this.basePath, multiRootDir, relativePath));
113
+ }
114
+ return this.extifyLookupPaths(candidates);
115
+ }
116
+ }
117
+ exports.TSConfigFile = TSConfigFile;
118
+ TSConfigFile.FILENAME = 'tsconfig.json';
119
+ //# sourceMappingURL=tsconfig-json-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tsconfig-json-file.js","sourceRoot":"","sources":["../../../../src/services/check-parser/package-files/tsconfig-json-file.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAE5B,yDAAmD;AACnD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AAC,QAAQ,CAAC,CAAA;YACzB,OAAO,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAA;QAC3C,CAAC;QAED,UAAU,CAAC,IAAI,CAAC,mBAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAA;QAEnE,0EAA0E;QAC1E,yEAAyE;QACzE,2BAA2B;QAC3B,KAAK,MAAM,YAAY,IAAI,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,EAAE,EAAE,CAAC;YAC1C,UAAU,CAAC,IAAI,CAAC,mBAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,CAAA;QAC1E,CAAC;QAED,OAAO,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAA;IAC3C,CAAC;;AArIH,oCAsIC;AArIQ,qBAAQ,GAAG,eAAe,CAAA"}
@@ -0,0 +1,32 @@
1
+ type Module = {
2
+ dependencies: Array<string>;
3
+ };
4
+ type ParserOptions = {
5
+ supportedNpmModules?: Array<string>;
6
+ checkUnsupportedModules?: boolean;
7
+ };
8
+ export declare class Parser {
9
+ supportedModules: Set<string>;
10
+ checkUnsupportedModules: boolean;
11
+ constructor(options: ParserOptions);
12
+ parse(entrypoint: string): {
13
+ entrypoint: {
14
+ filePath: string;
15
+ content: string;
16
+ };
17
+ dependencies: {
18
+ filePath: string;
19
+ content: string;
20
+ }[];
21
+ };
22
+ static parseDependencies(filePath: string, contents: string): {
23
+ module: Module;
24
+ error?: any;
25
+ };
26
+ static jsNodeVisitor(dependencies: Set<string>): any;
27
+ static tsNodeVisitor(tsParser: any, dependencies: Set<string>): any;
28
+ static isRequireExpression(node: any): boolean;
29
+ static getRequireStringArg(node: any): string | null;
30
+ static registerDependency(importArg: string | null, dependencies: Set<string>): void;
31
+ }
32
+ export {};