checkly 0.0.0-pr.1006.2fb1ffc

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 (317) 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/jsconfig-json-file.d.ts +17 -0
  262. package/dist/services/check-parser/package-files/jsconfig-json-file.js +46 -0
  263. package/dist/services/check-parser/package-files/jsconfig-json-file.js.map +1 -0
  264. package/dist/services/check-parser/package-files/json-source-file.d.ts +10 -0
  265. package/dist/services/check-parser/package-files/json-source-file.js +38 -0
  266. package/dist/services/check-parser/package-files/json-source-file.js.map +1 -0
  267. package/dist/services/check-parser/package-files/loader.d.ts +7 -0
  268. package/dist/services/check-parser/package-files/loader.js +19 -0
  269. package/dist/services/check-parser/package-files/loader.js.map +1 -0
  270. package/dist/services/check-parser/package-files/package-json-file.d.ts +20 -0
  271. package/dist/services/check-parser/package-files/package-json-file.js +48 -0
  272. package/dist/services/check-parser/package-files/package-json-file.js.map +1 -0
  273. package/dist/services/check-parser/package-files/paths.d.ts +80 -0
  274. package/dist/services/check-parser/package-files/paths.js +177 -0
  275. package/dist/services/check-parser/package-files/paths.js.map +1 -0
  276. package/dist/services/check-parser/package-files/resolver.d.ts +70 -0
  277. package/dist/services/check-parser/package-files/resolver.js +290 -0
  278. package/dist/services/check-parser/package-files/resolver.js.map +1 -0
  279. package/dist/services/check-parser/package-files/source-file.d.ts +15 -0
  280. package/dist/services/check-parser/package-files/source-file.js +54 -0
  281. package/dist/services/check-parser/package-files/source-file.js.map +1 -0
  282. package/dist/services/check-parser/package-files/tsconfig-json-file.d.ts +68 -0
  283. package/dist/services/check-parser/package-files/tsconfig-json-file.js +127 -0
  284. package/dist/services/check-parser/package-files/tsconfig-json-file.js.map +1 -0
  285. package/dist/services/check-parser/parser.d.ts +32 -0
  286. package/dist/services/check-parser/parser.js +313 -0
  287. package/dist/services/check-parser/parser.js.map +1 -0
  288. package/dist/services/checkly-config-loader.d.ts +72 -0
  289. package/dist/services/checkly-config-loader.js +103 -0
  290. package/dist/services/checkly-config-loader.js.map +1 -0
  291. package/dist/services/config.d.ts +28 -0
  292. package/dist/services/config.js +99 -0
  293. package/dist/services/config.js.map +1 -0
  294. package/dist/services/project-parser.d.ts +21 -0
  295. package/dist/services/project-parser.js +192 -0
  296. package/dist/services/project-parser.js.map +1 -0
  297. package/dist/services/snapshot-service.d.ts +13 -0
  298. package/dist/services/snapshot-service.js +85 -0
  299. package/dist/services/snapshot-service.js.map +1 -0
  300. package/dist/services/socket-client.d.ts +4 -0
  301. package/dist/services/socket-client.js +88 -0
  302. package/dist/services/socket-client.js.map +1 -0
  303. package/dist/services/test-filters.d.ts +3 -0
  304. package/dist/services/test-filters.js +27 -0
  305. package/dist/services/test-filters.js.map +1 -0
  306. package/dist/services/test-runner.d.ts +24 -0
  307. package/dist/services/test-runner.js +91 -0
  308. package/dist/services/test-runner.js.map +1 -0
  309. package/dist/services/trigger-runner.d.ts +29 -0
  310. package/dist/services/trigger-runner.js +59 -0
  311. package/dist/services/trigger-runner.js.map +1 -0
  312. package/dist/services/util.d.ts +32 -0
  313. package/dist/services/util.js +244 -0
  314. package/dist/services/util.js.map +1 -0
  315. package/dist/tsconfig.tsbuildinfo +1 -0
  316. package/oclif.manifest.json +635 -0
  317. package/package.json +151 -0
@@ -0,0 +1,33 @@
1
+ export type UnsupportedNpmDependencies = {
2
+ file: string;
3
+ unsupportedDependencies: string[];
4
+ };
5
+ export type ParseError = {
6
+ file: string;
7
+ error: string;
8
+ };
9
+ export declare class Collector {
10
+ entrypoint: string;
11
+ entrypointContent: string;
12
+ missingFiles: string[];
13
+ parseErrors: ParseError[];
14
+ unsupportedNpmDependencies: UnsupportedNpmDependencies[];
15
+ dependencies: Map<string, string>;
16
+ constructor(entrypoint: string, entrypointContent: string);
17
+ hasDependency(path: string): boolean;
18
+ addDependency(path: string, content: string): void;
19
+ addUnsupportedNpmDependencies(file: string, unsupportedDependencies: string[]): void;
20
+ addParsingError(file: string, message: string): void;
21
+ addMissingFile(filePath: string): void;
22
+ validate(): void;
23
+ getItems(): {
24
+ entrypoint: {
25
+ filePath: string;
26
+ content: string;
27
+ };
28
+ dependencies: {
29
+ filePath: string;
30
+ content: string;
31
+ }[];
32
+ };
33
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Collector = void 0;
4
+ const errors_1 = require("./errors");
5
+ class Collector {
6
+ constructor(entrypoint, entrypointContent) {
7
+ this.missingFiles = [];
8
+ this.parseErrors = [];
9
+ this.unsupportedNpmDependencies = [];
10
+ this.dependencies = new Map();
11
+ this.entrypoint = entrypoint;
12
+ this.entrypointContent = entrypointContent;
13
+ }
14
+ hasDependency(path) {
15
+ return this.dependencies.has(path);
16
+ }
17
+ addDependency(path, content) {
18
+ this.dependencies.set(path, content);
19
+ }
20
+ addUnsupportedNpmDependencies(file, unsupportedDependencies) {
21
+ this.unsupportedNpmDependencies.push({ file, unsupportedDependencies });
22
+ }
23
+ addParsingError(file, message) {
24
+ this.parseErrors.push({ file, error: message });
25
+ }
26
+ addMissingFile(filePath) {
27
+ this.missingFiles.push(filePath);
28
+ }
29
+ validate() {
30
+ if (this.missingFiles.length || this.parseErrors.length || this.unsupportedNpmDependencies.length) {
31
+ throw new errors_1.DependencyParseError(this.entrypoint, this.missingFiles, this.unsupportedNpmDependencies, this.parseErrors);
32
+ }
33
+ }
34
+ getItems() {
35
+ return {
36
+ entrypoint: {
37
+ filePath: this.entrypoint,
38
+ content: this.entrypointContent,
39
+ },
40
+ dependencies: Array.from(this.dependencies.entries(), ([key, value]) => ({
41
+ filePath: key,
42
+ content: value,
43
+ })),
44
+ };
45
+ }
46
+ }
47
+ exports.Collector = Collector;
48
+ //# sourceMappingURL=collector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collector.js","sourceRoot":"","sources":["../../../src/services/check-parser/collector.ts"],"names":[],"mappings":";;;AAAA,qCAA+C;AAY/C,MAAa,SAAS;IAQpB,YAAa,UAAkB,EAAE,iBAAyB;QAL1D,iBAAY,GAAa,EAAE,CAAA;QAC3B,gBAAW,GAAiB,EAAE,CAAA;QAC9B,+BAA0B,GAAiC,EAAE,CAAA;QAC7D,iBAAY,GAAG,IAAI,GAAG,EAAkB,CAAA;QAGtC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAA;IAC5C,CAAC;IAED,aAAa,CAAE,IAAY;QACzB,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IACpC,CAAC;IAED,aAAa,CAAE,IAAY,EAAE,OAAe;QAC1C,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IACtC,CAAC;IAED,6BAA6B,CAAE,IAAY,EAAE,uBAAiC;QAC5E,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,uBAAuB,EAAE,CAAC,CAAA;IACzE,CAAC;IAED,eAAe,CAAE,IAAY,EAAE,OAAe;QAC5C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;IACjD,CAAC;IAED,cAAc,CAAE,QAAgB;QAC9B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAClC,CAAC;IAED,QAAQ;QACN,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,IAAI,IAAI,CAAC,0BAA0B,CAAC,MAAM,EAAE,CAAC;YAClG,MAAM,IAAI,6BAAoB,CAC5B,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,0BAA0B,EAC/B,IAAI,CAAC,WAAW,CACjB,CAAA;QACH,CAAC;IACH,CAAC;IAED,QAAQ;QACN,OAAO;YACL,UAAU,EAAE;gBACV,QAAQ,EAAE,IAAI,CAAC,UAAU;gBACzB,OAAO,EAAE,IAAI,CAAC,iBAAiB;aAChC;YACD,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;gBACvE,QAAQ,EAAE,GAAG;gBACb,OAAO,EAAE,KAAK;aACf,CAAC,CAAC;SACJ,CAAA;IACH,CAAC;CACF;AAxDD,8BAwDC"}
@@ -0,0 +1,8 @@
1
+ import { ParseError, UnsupportedNpmDependencies } from './collector';
2
+ export declare class DependencyParseError extends Error {
3
+ entrypoint: string;
4
+ missingFiles: string[];
5
+ unsupportedNpmDependencies: UnsupportedNpmDependencies[];
6
+ parseErrors: ParseError[];
7
+ constructor(entrypoint: string, missingFiles: string[], unsupportedNpmDependencies: UnsupportedNpmDependencies[], parseErrors: ParseError[]);
8
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DependencyParseError = void 0;
4
+ class DependencyParseError extends Error {
5
+ constructor(entrypoint, missingFiles, unsupportedNpmDependencies, parseErrors) {
6
+ let message = `Encountered an error parsing check files for ${entrypoint}.`;
7
+ if (missingFiles.length) {
8
+ message += '\n\nThe following dependencies weren\'t found:\n';
9
+ for (const missingFile of missingFiles) {
10
+ message += `\t${missingFile}\n`;
11
+ }
12
+ }
13
+ if (unsupportedNpmDependencies.length) {
14
+ if (unsupportedNpmDependencies.some(d => d.unsupportedDependencies.some(ud => ud === 'checkly/constructs'))) {
15
+ message += '\n\nIt looks like you\'re trying to use checkly/constructs in a browser check file. ' +
16
+ 'checkly/constructs should only be used in check files: files ending in .check.ts and .check.js, ' +
17
+ 'or the checkMatch pattern set in your configuration. For more information see on the difference between ' +
18
+ 'test files and check files, see https://www.checklyhq.com/docs/cli/\n';
19
+ }
20
+ else {
21
+ message += '\n\nThe following NPM dependencies were used, but aren\'t supported in the runtimes.\n';
22
+ message += 'For more information, see https://www.checklyhq.com/docs/runtimes/.\n';
23
+ for (const { file, unsupportedDependencies } of unsupportedNpmDependencies) {
24
+ message += `\t${file} imports unsupported dependencies:\n`;
25
+ for (const unsupportedDependency of unsupportedDependencies) {
26
+ message += `\t\t${unsupportedDependency}\n`;
27
+ }
28
+ }
29
+ }
30
+ }
31
+ if (parseErrors.length) {
32
+ message += '\n\nThe following files couldn\'t be parsed:\n';
33
+ for (const { file, error } of parseErrors) {
34
+ message += `\t${file} - ${error}\n`;
35
+ }
36
+ }
37
+ super(message);
38
+ this.entrypoint = entrypoint;
39
+ this.missingFiles = missingFiles;
40
+ this.unsupportedNpmDependencies = unsupportedNpmDependencies;
41
+ this.parseErrors = parseErrors;
42
+ }
43
+ }
44
+ exports.DependencyParseError = DependencyParseError;
45
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/services/check-parser/errors.ts"],"names":[],"mappings":";;;AAEA,MAAa,oBAAqB,SAAQ,KAAK;IAK7C,YACE,UAAkB,EAClB,YAAsB,EACtB,0BAAwD,EACxD,WAAyB;QAEzB,IAAI,OAAO,GAAG,gDAAgD,UAAU,GAAG,CAAA;QAC3E,IAAI,YAAY,CAAC,MAAM,EAAE,CAAC;YACxB,OAAO,IAAI,kDAAkD,CAAA;YAC7D,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;gBACvC,OAAO,IAAI,KAAK,WAAW,IAAI,CAAA;YACjC,CAAC;QACH,CAAC;QACD,IAAI,0BAA0B,CAAC,MAAM,EAAE,CAAC;YACtC,IAAI,0BAA0B,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,uBAAuB,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,oBAAoB,CAAC,CAAC,EAAE,CAAC;gBAC5G,OAAO,IAAI,sFAAsF;oBAC/F,kGAAkG;oBAClG,0GAA0G;oBAC1G,uEAAuE,CAAA;YAC3E,CAAC;iBAAM,CAAC;gBACN,OAAO,IAAI,wFAAwF,CAAA;gBACnG,OAAO,IAAI,uEAAuE,CAAA;gBAClF,KAAK,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,IAAI,0BAA0B,EAAE,CAAC;oBAC3E,OAAO,IAAI,KAAK,IAAI,sCAAsC,CAAA;oBAC1D,KAAK,MAAM,qBAAqB,IAAI,uBAAuB,EAAE,CAAC;wBAC5D,OAAO,IAAI,OAAO,qBAAqB,IAAI,CAAA;oBAC7C,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QACD,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;YACvB,OAAO,IAAI,gDAAgD,CAAA;YAC3D,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,WAAW,EAAE,CAAC;gBAC1C,OAAO,IAAI,KAAK,IAAI,MAAM,KAAK,IAAI,CAAA;YACrC,CAAC;QACH,CAAC;QACD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;QAChC,IAAI,CAAC,0BAA0B,GAAG,0BAA0B,CAAA;QAC5D,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;IAChC,CAAC;CACF;AA/CD,oDA+CC"}
@@ -0,0 +1 @@
1
+ export { PackageFilesResolver } from './resolver';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PackageFilesResolver = void 0;
4
+ var resolver_1 = require("./resolver");
5
+ Object.defineProperty(exports, "PackageFilesResolver", { enumerable: true, get: function () { return resolver_1.PackageFilesResolver; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/check-parser/package-files/index.ts"],"names":[],"mappings":";;;AAAA,uCAAiD;AAAxC,gHAAA,oBAAoB,OAAA"}
@@ -0,0 +1,17 @@
1
+ import { TSConfigFile, Schema } from './tsconfig-json-file';
2
+ import { JsonSourceFile } from './json-source-file';
3
+ /**
4
+ * JSConfigFile is essentially the exact same as TSConfigFile but with
5
+ * allowJs implicitly enabled.
6
+ *
7
+ * While we could handle jsconfig.json with just TSConfigFile, it's not that
8
+ * much extra trouble to have a separate wrapper for it and doing it this way
9
+ * may enable some interesting features later.
10
+ */
11
+ export declare class JSConfigFile extends TSConfigFile {
12
+ #private;
13
+ static FILENAME: string;
14
+ readonly id: number;
15
+ static filePath(dirPath: string): string;
16
+ static loadFromJsonSourceFile(jsonFile: JsonSourceFile<Schema>): JSConfigFile | undefined;
17
+ }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8
+ if (kind === "m") throw new TypeError("Private method is not writable");
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
11
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ var _a, _JSConfigFile_id;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.JSConfigFile = void 0;
19
+ const node_path_1 = __importDefault(require("node:path"));
20
+ const tsconfig_json_file_1 = require("./tsconfig-json-file");
21
+ /**
22
+ * JSConfigFile is essentially the exact same as TSConfigFile but with
23
+ * allowJs implicitly enabled.
24
+ *
25
+ * While we could handle jsconfig.json with just TSConfigFile, it's not that
26
+ * much extra trouble to have a separate wrapper for it and doing it this way
27
+ * may enable some interesting features later.
28
+ */
29
+ class JSConfigFile extends tsconfig_json_file_1.TSConfigFile {
30
+ constructor() {
31
+ var _b, _c;
32
+ super(...arguments);
33
+ this.id = __classPrivateFieldSet(_b = _a, _a, (_c = __classPrivateFieldGet(_b, _a, "f", _JSConfigFile_id), ++_c), "f", _JSConfigFile_id);
34
+ }
35
+ static filePath(dirPath) {
36
+ return node_path_1.default.join(dirPath, _a.FILENAME);
37
+ }
38
+ static loadFromJsonSourceFile(jsonFile) {
39
+ return new _a(jsonFile);
40
+ }
41
+ }
42
+ exports.JSConfigFile = JSConfigFile;
43
+ _a = JSConfigFile;
44
+ JSConfigFile.FILENAME = 'jsconfig.json';
45
+ _JSConfigFile_id = { value: 0 };
46
+ //# sourceMappingURL=jsconfig-json-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsconfig-json-file.js","sourceRoot":"","sources":["../../../../src/services/check-parser/package-files/jsconfig-json-file.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,0DAA4B;AAE5B,6DAA2D;AAG3D;;;;;;;GAOG;AACH,MAAa,YAAa,SAAQ,iCAAY;IAA9C;;;QAIW,OAAE,GAAG,oCAAA,CAAE,0DAAgB,EAAlB,IAAkB,CAAA,wBAAA,CAAA;IASlC,CAAC;IAPC,MAAM,CAAC,QAAQ,CAAE,OAAe;QAC9B,OAAO,mBAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAY,CAAC,QAAQ,CAAC,CAAA;IAClD,CAAC;IAED,MAAM,CAAC,sBAAsB,CAAE,QAAgC;QAC7D,OAAO,IAAI,EAAY,CAAC,QAAQ,CAAC,CAAA;IACnC,CAAC;;AAZH,oCAaC;;AAZQ,qBAAQ,GAAG,eAAe,AAAlB,CAAkB;AAE1B,4BAAM,CAAC,EAAJ,CAAI"}
@@ -0,0 +1,10 @@
1
+ import { SourceFile } from './source-file';
2
+ export declare class JsonSourceFile<Schema> {
3
+ #private;
4
+ readonly id: number;
5
+ sourceFile: SourceFile;
6
+ data: Schema;
7
+ private constructor();
8
+ get meta(): import("./source-file").FileMeta;
9
+ static loadFromSourceFile<Schema>(sourceFile: SourceFile): JsonSourceFile<Schema> | undefined;
10
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8
+ if (kind === "m") throw new TypeError("Private method is not writable");
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
11
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12
+ };
13
+ var _a, _JsonSourceFile_id;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.JsonSourceFile = void 0;
16
+ class JsonSourceFile {
17
+ constructor(sourceFile, data) {
18
+ var _b, _c;
19
+ this.id = __classPrivateFieldSet(_b = _a, _a, (_c = __classPrivateFieldGet(_b, _a, "f", _JsonSourceFile_id), ++_c), "f", _JsonSourceFile_id);
20
+ this.sourceFile = sourceFile;
21
+ this.data = data;
22
+ }
23
+ get meta() {
24
+ return this.sourceFile.meta;
25
+ }
26
+ static loadFromSourceFile(sourceFile) {
27
+ try {
28
+ const data = JSON.parse(sourceFile.contents);
29
+ return new _a(sourceFile, data);
30
+ }
31
+ catch (err) {
32
+ }
33
+ }
34
+ }
35
+ exports.JsonSourceFile = JsonSourceFile;
36
+ _a = JsonSourceFile;
37
+ _JsonSourceFile_id = { value: 0 };
38
+ //# sourceMappingURL=json-source-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-source-file.js","sourceRoot":"","sources":["../../../../src/services/check-parser/package-files/json-source-file.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,MAAa,cAAc;IAOzB,YAAqB,UAAsB,EAAE,IAAY;;QALhD,OAAE,GAAG,oCAAA,CAAE,4DAAkB,EAApB,IAAoB,CAAA,0BAAA,CAAA;QAMhC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAA;IAC7B,CAAC;IAED,MAAM,CAAC,kBAAkB,CAAU,UAAsB;QACvD,IAAI,CAAC;YACH,MAAM,IAAI,GAAW,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;YAEpD,OAAO,IAAI,EAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;QAC7C,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;QACpB,CAAC;IACH,CAAC;;AAvBH,wCAwBC;;AAvBQ,8BAAM,CAAC,EAAJ,CAAI"}
@@ -0,0 +1,7 @@
1
+ export type LoadFile<T> = (filePath: string) => T | undefined;
2
+ export declare class FileLoader<T> {
3
+ loader: LoadFile<T>;
4
+ cache: Map<string, T | undefined>;
5
+ constructor(loader: LoadFile<T>);
6
+ load(filePath: string): T | undefined;
7
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FileLoader = void 0;
4
+ class FileLoader {
5
+ constructor(loader) {
6
+ this.cache = new Map();
7
+ this.loader = loader;
8
+ }
9
+ load(filePath) {
10
+ if (this.cache.has(filePath)) {
11
+ return this.cache.get(filePath);
12
+ }
13
+ const file = this.loader(filePath);
14
+ this.cache.set(filePath, file);
15
+ return file;
16
+ }
17
+ }
18
+ exports.FileLoader = FileLoader;
19
+ //# sourceMappingURL=loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../../../src/services/check-parser/package-files/loader.ts"],"names":[],"mappings":";;;AAEA,MAAa,UAAU;IAIrB,YAAa,MAAmB;QAFhC,UAAK,GAAG,IAAI,GAAG,EAAyB,CAAA;QAGtC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,IAAI,CAAE,QAAgB;QACpB,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;QACjC,CAAC;QACD,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;QAClC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;QAC9B,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAhBD,gCAgBC"}
@@ -0,0 +1,20 @@
1
+ import { JsonSourceFile } from './json-source-file';
2
+ type ExportCondition = 'node-addons' | 'node' | 'import' | 'require' | 'module-sync' | 'default';
3
+ type Schema = {
4
+ main?: string;
5
+ exports?: string | string[] | Record<string, string> | Record<ExportCondition, Record<string, string>>;
6
+ };
7
+ export declare class PackageJsonFile {
8
+ #private;
9
+ static FILENAME: string;
10
+ readonly id: number;
11
+ jsonFile: JsonSourceFile<Schema>;
12
+ basePath: string;
13
+ mainPaths: string[];
14
+ private constructor();
15
+ get meta(): import("./source-file").FileMeta;
16
+ static loadFromJsonSourceFile(jsonFile: JsonSourceFile<Schema>): PackageJsonFile | undefined;
17
+ static filePath(dirPath: string): string;
18
+ supportsPackageRelativePaths(): boolean;
19
+ }
20
+ export {};
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8
+ if (kind === "m") throw new TypeError("Private method is not writable");
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
11
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ var _a, _PackageJsonFile_id;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.PackageJsonFile = void 0;
19
+ const node_path_1 = __importDefault(require("node:path"));
20
+ class PackageJsonFile {
21
+ constructor(jsonFile) {
22
+ var _b, _c;
23
+ this.id = __classPrivateFieldSet(_b = _a, _a, (_c = __classPrivateFieldGet(_b, _a, "f", _PackageJsonFile_id), ++_c), "f", _PackageJsonFile_id);
24
+ this.jsonFile = jsonFile;
25
+ this.basePath = jsonFile.meta.dirname;
26
+ const fallbackMainPath = node_path_1.default.resolve(this.basePath, 'index.js');
27
+ this.mainPaths = jsonFile.data.main !== undefined
28
+ ? [node_path_1.default.resolve(this.basePath, jsonFile.data.main), fallbackMainPath]
29
+ : [fallbackMainPath];
30
+ }
31
+ get meta() {
32
+ return this.jsonFile.meta;
33
+ }
34
+ static loadFromJsonSourceFile(jsonFile) {
35
+ return new _a(jsonFile);
36
+ }
37
+ static filePath(dirPath) {
38
+ return node_path_1.default.join(dirPath, _a.FILENAME);
39
+ }
40
+ supportsPackageRelativePaths() {
41
+ return this.jsonFile.data.exports === undefined;
42
+ }
43
+ }
44
+ exports.PackageJsonFile = PackageJsonFile;
45
+ _a = PackageJsonFile;
46
+ PackageJsonFile.FILENAME = 'package.json';
47
+ _PackageJsonFile_id = { value: 0 };
48
+ //# sourceMappingURL=package-json-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-json-file.js","sourceRoot":"","sources":["../../../../src/services/check-parser/package-files/package-json-file.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,0DAA4B;AAY5B,MAAa,eAAe;IAU1B,YAAqB,QAAgC;;QAN5C,OAAE,GAAG,oCAAA,CAAE,6DAAmB,EAArB,IAAqB,CAAA,2BAAA,CAAA;QAOjC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAA;QAErC,MAAM,gBAAgB,GAAG,mBAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;QAEhE,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS;YAC/C,CAAC,CAAC,CAAC,mBAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC;YACrE,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAA;IACxB,CAAC;IAED,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAA;IAC3B,CAAC;IAED,MAAM,CAAC,sBAAsB,CAAE,QAAgC;QAC7D,OAAO,IAAI,EAAe,CAAC,QAAQ,CAAC,CAAA;IACtC,CAAC;IAED,MAAM,CAAC,QAAQ,CAAE,OAAe;QAC9B,OAAO,mBAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAe,CAAC,QAAQ,CAAC,CAAA;IACrD,CAAC;IAED,4BAA4B;QAC1B,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,KAAK,SAAS,CAAA;IACjD,CAAC;;AAnCH,0CAoCC;;AAnCQ,wBAAQ,GAAG,cAAc,AAAjB,CAAiB;AAEzB,+BAAM,CAAC,EAAJ,CAAI"}
@@ -0,0 +1,80 @@
1
+ type Paths = Record<string, Array<string>>;
2
+ declare class TargetPathSpec {
3
+ /**
4
+ * Prefix is the part of the path before an asterisk (wildcard), or the
5
+ * whole path if there's no asterisk.
6
+ *
7
+ * Examples of possible values:
8
+ * - `"./foo/*"` (from `"./foo/"`)
9
+ * - `"./bar/foo-"` (from `"./bar/foo-*.js"`)
10
+ * - `"./bar."` (from `"./bar.*.ts"`)
11
+ * - `""` (from `"*"`)
12
+ */
13
+ prefix: string;
14
+ /**
15
+ * Suffix is the part of the path after the asterisk (wildcard), if any.
16
+ */
17
+ suffix?: string;
18
+ protected constructor(prefix: string, suffix?: string);
19
+ toPath(joker?: string): string;
20
+ static create(spec: string): TargetPathSpec;
21
+ }
22
+ export type TargetPathResult = {
23
+ spec: TargetPathSpec;
24
+ path: string;
25
+ };
26
+ declare class PathMatchResult {
27
+ ok: boolean;
28
+ results: TargetPathResult[];
29
+ private constructor();
30
+ static some(results: TargetPathResult[]): PathMatchResult;
31
+ static none(): PathMatchResult;
32
+ }
33
+ interface PathMatcher {
34
+ get prefixLength(): number;
35
+ match(importPath: string): PathMatchResult;
36
+ }
37
+ declare class SourcePathSpec {
38
+ /**
39
+ * Prefix is the part of the path before an asterisk (wildcard), or the
40
+ * whole path if there's no asterisk.
41
+ *
42
+ * Examples of possible values:
43
+ * - `"@/"` (from `"@/*"`)
44
+ * - `"app/foo-"` (from `"app/foo-*.js"`)
45
+ * - `"bar."` (from `"bar.*.ts"`)
46
+ * - `""` (from `"*"`)
47
+ */
48
+ prefix: string;
49
+ /**
50
+ * Suffix is the part of the path after the asterisk (wildcard), if any.
51
+ */
52
+ suffix?: string;
53
+ protected constructor(prefix: string, suffix?: string);
54
+ get moduleLikeName(): string | undefined;
55
+ matcherForTarget(target: TargetPathSpec[]): PathMatcher;
56
+ static create(spec: string): SourcePathSpec;
57
+ }
58
+ type SourcePathSpecMatcher = {
59
+ spec: SourcePathSpec;
60
+ matcher: PathMatcher;
61
+ };
62
+ export type SourcePathResult = {
63
+ spec: SourcePathSpec;
64
+ path: string;
65
+ };
66
+ export type PathResult = {
67
+ source: SourcePathResult;
68
+ target: TargetPathResult;
69
+ };
70
+ export type ResolveResult = PathResult[];
71
+ export declare class PathResolver {
72
+ baseUrl: string;
73
+ matchers: SourcePathSpecMatcher[];
74
+ private constructor();
75
+ resolve(importPath: string): ResolveResult;
76
+ static createFromPaths(baseUrl: string, paths: Paths): PathResolver;
77
+ private static matcherForPath;
78
+ }
79
+ export declare function isLocalPath(importPath: string): boolean;
80
+ export {};
@@ -0,0 +1,177 @@
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.isLocalPath = exports.PathResolver = void 0;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ class TargetPathSpec {
9
+ constructor(prefix, suffix) {
10
+ this.prefix = prefix;
11
+ this.suffix = suffix;
12
+ }
13
+ toPath(joker) {
14
+ if (this.suffix === undefined) {
15
+ return this.prefix;
16
+ }
17
+ if (joker === undefined) {
18
+ return this.prefix + this.suffix;
19
+ }
20
+ return this.prefix + joker + this.suffix;
21
+ }
22
+ static create(spec) {
23
+ const parts = spec.split('*', 2);
24
+ if (parts.length === 1) {
25
+ return new TargetPathSpec(spec);
26
+ }
27
+ const [prefix, suffix] = parts;
28
+ return new TargetPathSpec(prefix, suffix);
29
+ }
30
+ }
31
+ class PathMatchResult {
32
+ constructor(ok, results) {
33
+ this.ok = ok;
34
+ this.results = results;
35
+ }
36
+ static some(results) {
37
+ return new PathMatchResult(true, results);
38
+ }
39
+ static none() {
40
+ return new PathMatchResult(false, []);
41
+ }
42
+ }
43
+ class ExactPathMatcher {
44
+ constructor(prefix, target) {
45
+ this.prefix = prefix;
46
+ this.target = target;
47
+ }
48
+ get prefixLength() {
49
+ return this.prefix.length;
50
+ }
51
+ match(importPath) {
52
+ if (importPath === this.prefix) {
53
+ return PathMatchResult.some(this.target.map(target => {
54
+ return {
55
+ spec: target,
56
+ path: target.toPath(),
57
+ };
58
+ }));
59
+ }
60
+ return PathMatchResult.none();
61
+ }
62
+ }
63
+ class WildcardPathMatcher {
64
+ constructor(prefix, suffix, target) {
65
+ this.prefix = prefix;
66
+ this.suffix = suffix;
67
+ this.target = target;
68
+ }
69
+ get prefixLength() {
70
+ return this.prefix.length;
71
+ }
72
+ match(importPath) {
73
+ if (importPath.startsWith(this.prefix) && importPath.endsWith(this.suffix)) {
74
+ const joker = importPath.substring(this.prefix.length, importPath.length - this.suffix.length);
75
+ return PathMatchResult.some(this.target.map(target => {
76
+ return {
77
+ spec: target,
78
+ path: target.toPath(joker),
79
+ };
80
+ }));
81
+ }
82
+ return PathMatchResult.none();
83
+ }
84
+ }
85
+ class SourcePathSpec {
86
+ constructor(prefix, suffix) {
87
+ this.prefix = prefix;
88
+ this.suffix = suffix;
89
+ }
90
+ get moduleLikeName() {
91
+ if (this.suffix === undefined) {
92
+ return this.prefix;
93
+ }
94
+ // If prefix is already a directory (ends with `/`), path.dirname will
95
+ // not return the desired result as it will strip the last component
96
+ // entirely. However, we can circumvent this by adding a dummy value to
97
+ // the prefix which ensures that we always get the whole dirname
98
+ // regardless of whether there is already filename or not.
99
+ const moduleLike = node_path_1.default.dirname(this.prefix + 'x');
100
+ if (moduleLike === '') {
101
+ // Reduce mistakes by returning undefined for this special case.
102
+ return undefined;
103
+ }
104
+ return moduleLike;
105
+ }
106
+ matcherForTarget(target) {
107
+ if (this.suffix === undefined) {
108
+ return new ExactPathMatcher(this.prefix, target);
109
+ }
110
+ return new WildcardPathMatcher(this.prefix, this.suffix, target);
111
+ }
112
+ static create(spec) {
113
+ const parts = spec.split('*', 2);
114
+ if (parts.length === 1) {
115
+ return new SourcePathSpec(spec);
116
+ }
117
+ const [prefix, suffix] = parts;
118
+ return new SourcePathSpec(prefix, suffix);
119
+ }
120
+ }
121
+ class PathResolver {
122
+ constructor(baseUrl, matchers) {
123
+ this.baseUrl = baseUrl;
124
+ // Sort by longest prefix now, then we don't have to care about it later.
125
+ matchers.sort((a, b) => b.matcher.prefixLength - a.matcher.prefixLength);
126
+ this.matchers = matchers;
127
+ }
128
+ resolve(importPath) {
129
+ for (const { spec, matcher } of this.matchers) {
130
+ const match = matcher.match(importPath);
131
+ if (match.ok) {
132
+ // We can just return the first match since matchers are already
133
+ // sorted by longest prefix.
134
+ return match.results.map(result => {
135
+ return {
136
+ source: {
137
+ spec,
138
+ path: importPath,
139
+ },
140
+ target: result,
141
+ };
142
+ });
143
+ }
144
+ }
145
+ return [];
146
+ }
147
+ static createFromPaths(baseUrl, paths) {
148
+ const matchers = [];
149
+ for (const path in paths) {
150
+ matchers.push(PathResolver.matcherForPath(path, paths[path]));
151
+ }
152
+ return new PathResolver(baseUrl, matchers);
153
+ }
154
+ static matcherForPath(spec, target) {
155
+ const pathSpec = SourcePathSpec.create(spec);
156
+ const matcher = pathSpec.matcherForTarget(target.map(TargetPathSpec.create));
157
+ return {
158
+ spec: pathSpec,
159
+ matcher,
160
+ };
161
+ }
162
+ }
163
+ exports.PathResolver = PathResolver;
164
+ function isLocalPath(importPath) {
165
+ if (importPath.startsWith('/')) {
166
+ return true;
167
+ }
168
+ if (importPath.startsWith('./')) {
169
+ return true;
170
+ }
171
+ if (importPath.startsWith('../')) {
172
+ return true;
173
+ }
174
+ return false;
175
+ }
176
+ exports.isLocalPath = isLocalPath;
177
+ //# sourceMappingURL=paths.js.map