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.
- package/README.md +102 -0
- package/bin/run +5 -0
- package/bin/run.cmd +3 -0
- package/constructs.d.ts +1 -0
- package/constructs.js +2 -0
- package/dist/auth/index.d.ts +15 -0
- package/dist/auth/index.js +262 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/commands/authCommand.d.ts +5 -0
- package/dist/commands/authCommand.js +37 -0
- package/dist/commands/authCommand.js.map +1 -0
- package/dist/commands/baseCommand.d.ts +13 -0
- package/dist/commands/baseCommand.js +48 -0
- package/dist/commands/baseCommand.js.map +1 -0
- package/dist/commands/deploy.d.ts +18 -0
- package/dist/commands/deploy.js +289 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/destroy.d.ts +10 -0
- package/dist/commands/destroy.js +84 -0
- package/dist/commands/destroy.js.map +1 -0
- package/dist/commands/env/add.d.ts +14 -0
- package/dist/commands/env/add.js +85 -0
- package/dist/commands/env/add.js.map +1 -0
- package/dist/commands/env/ls.d.ts +6 -0
- package/dist/commands/env/ls.js +44 -0
- package/dist/commands/env/ls.js.map +1 -0
- package/dist/commands/env/pull.d.ts +12 -0
- package/dist/commands/env/pull.js +99 -0
- package/dist/commands/env/pull.js.map +1 -0
- package/dist/commands/env/rm.d.ts +12 -0
- package/dist/commands/env/rm.js +82 -0
- package/dist/commands/env/rm.js.map +1 -0
- package/dist/commands/env/update.d.ts +14 -0
- package/dist/commands/env/update.js +88 -0
- package/dist/commands/env/update.js.map +1 -0
- package/dist/commands/help.d.ts +6 -0
- package/dist/commands/help.js +17 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/login.d.ts +13 -0
- package/dist/commands/login.js +134 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +9 -0
- package/dist/commands/logout.js +43 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/runtimes.d.ts +6 -0
- package/dist/commands/runtimes.js +49 -0
- package/dist/commands/runtimes.js.map +1 -0
- package/dist/commands/switch.d.ts +9 -0
- package/dist/commands/switch.js +81 -0
- package/dist/commands/switch.js.map +1 -0
- package/dist/commands/sync-playwright.d.ts +10 -0
- package/dist/commands/sync-playwright.js +98 -0
- package/dist/commands/sync-playwright.js.map +1 -0
- package/dist/commands/test.d.ts +45 -0
- package/dist/commands/test.js +366 -0
- package/dist/commands/test.js.map +1 -0
- package/dist/commands/trigger.d.ts +37 -0
- package/dist/commands/trigger.js +242 -0
- package/dist/commands/trigger.js.map +1 -0
- package/dist/commands/whoami.d.ts +6 -0
- package/dist/commands/whoami.js +42 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/config.d.ts +31 -0
- package/dist/config.js +8 -0
- package/dist/config.js.map +1 -0
- package/dist/constants.d.ts +7 -0
- package/dist/constants.js +10 -0
- package/dist/constants.js.map +1 -0
- package/dist/constructs/alert-channel-subscription.d.ts +44 -0
- package/dist/constructs/alert-channel-subscription.js +39 -0
- package/dist/constructs/alert-channel-subscription.js.map +1 -0
- package/dist/constructs/alert-channel.d.ts +53 -0
- package/dist/constructs/alert-channel.js +55 -0
- package/dist/constructs/alert-channel.js.map +1 -0
- package/dist/constructs/alert-escalation-policy.d.ts +34 -0
- package/dist/constructs/alert-escalation-policy.js +47 -0
- package/dist/constructs/alert-escalation-policy.js.map +1 -0
- package/dist/constructs/api-check.d.ts +187 -0
- package/dist/constructs/api-check.js +279 -0
- package/dist/constructs/api-check.js.map +1 -0
- package/dist/constructs/browser-check.d.ts +90 -0
- package/dist/constructs/browser-check.js +151 -0
- package/dist/constructs/browser-check.js.map +1 -0
- package/dist/constructs/check-group.d.ts +162 -0
- package/dist/constructs/check-group.js +208 -0
- package/dist/constructs/check-group.js.map +1 -0
- package/dist/constructs/check.d.ts +144 -0
- package/dist/constructs/check.js +133 -0
- package/dist/constructs/check.js.map +1 -0
- package/dist/constructs/construct.d.ts +17 -0
- package/dist/constructs/construct.js +22 -0
- package/dist/constructs/construct.js.map +1 -0
- package/dist/constructs/dashboard.d.ts +138 -0
- package/dist/constructs/dashboard.js +126 -0
- package/dist/constructs/dashboard.js.map +1 -0
- package/dist/constructs/email-alert-channel.d.ts +26 -0
- package/dist/constructs/email-alert-channel.js +37 -0
- package/dist/constructs/email-alert-channel.js.map +1 -0
- package/dist/constructs/environment-variable.d.ts +2 -0
- package/dist/constructs/environment-variable.js +3 -0
- package/dist/constructs/environment-variable.js.map +1 -0
- package/dist/constructs/frequency.d.ts +20 -0
- package/dist/constructs/frequency.js +26 -0
- package/dist/constructs/frequency.js.map +1 -0
- package/dist/constructs/heartbeat-check.d.ts +43 -0
- package/dist/constructs/heartbeat-check.js +61 -0
- package/dist/constructs/heartbeat-check.js.map +1 -0
- package/dist/constructs/http-header.d.ts +2 -0
- package/dist/constructs/http-header.js +3 -0
- package/dist/constructs/http-header.js.map +1 -0
- package/dist/constructs/index.d.ts +27 -0
- package/dist/constructs/index.js +44 -0
- package/dist/constructs/index.js.map +1 -0
- package/dist/constructs/key-value-pair.d.ts +6 -0
- package/dist/constructs/key-value-pair.js +3 -0
- package/dist/constructs/key-value-pair.js.map +1 -0
- package/dist/constructs/maintenance-window.d.ts +61 -0
- package/dist/constructs/maintenance-window.js +47 -0
- package/dist/constructs/maintenance-window.js.map +1 -0
- package/dist/constructs/multi-step-check.d.ts +65 -0
- package/dist/constructs/multi-step-check.js +153 -0
- package/dist/constructs/multi-step-check.js.map +1 -0
- package/dist/constructs/opsgenie-alert-channel.d.ts +45 -0
- package/dist/constructs/opsgenie-alert-channel.js +44 -0
- package/dist/constructs/opsgenie-alert-channel.js.map +1 -0
- package/dist/constructs/pagerduty-alert-channel.d.ts +39 -0
- package/dist/constructs/pagerduty-alert-channel.js +42 -0
- package/dist/constructs/pagerduty-alert-channel.js.map +1 -0
- package/dist/constructs/phone-call-alert-channel.d.ts +34 -0
- package/dist/constructs/phone-call-alert-channel.js +42 -0
- package/dist/constructs/phone-call-alert-channel.js.map +1 -0
- package/dist/constructs/playwright-config.d.ts +52 -0
- package/dist/constructs/playwright-config.js +3 -0
- package/dist/constructs/playwright-config.js.map +1 -0
- package/dist/constructs/private-location-check-assignment.d.ts +29 -0
- package/dist/constructs/private-location-check-assignment.js +35 -0
- package/dist/constructs/private-location-check-assignment.js.map +1 -0
- package/dist/constructs/private-location-group-assignment.d.ts +29 -0
- package/dist/constructs/private-location-group-assignment.js +35 -0
- package/dist/constructs/private-location-group-assignment.js.map +1 -0
- package/dist/constructs/private-location.d.ts +51 -0
- package/dist/constructs/private-location.js +61 -0
- package/dist/constructs/private-location.js.map +1 -0
- package/dist/constructs/project.d.ts +66 -0
- package/dist/constructs/project.js +155 -0
- package/dist/constructs/project.js.map +1 -0
- package/dist/constructs/query-param.d.ts +2 -0
- package/dist/constructs/query-param.js +3 -0
- package/dist/constructs/query-param.js.map +1 -0
- package/dist/constructs/ref.d.ts +5 -0
- package/dist/constructs/ref.js +13 -0
- package/dist/constructs/ref.js.map +1 -0
- package/dist/constructs/retry-strategy.d.ts +50 -0
- package/dist/constructs/retry-strategy.js +51 -0
- package/dist/constructs/retry-strategy.js.map +1 -0
- package/dist/constructs/slack-alert-channel.d.ts +26 -0
- package/dist/constructs/slack-alert-channel.js +40 -0
- package/dist/constructs/slack-alert-channel.js.map +1 -0
- package/dist/constructs/sms-alert-channel.d.ts +32 -0
- package/dist/constructs/sms-alert-channel.js +40 -0
- package/dist/constructs/sms-alert-channel.js.map +1 -0
- package/dist/constructs/validator-error.d.ts +2 -0
- package/dist/constructs/validator-error.js +7 -0
- package/dist/constructs/validator-error.js.map +1 -0
- package/dist/constructs/webhook-alert-channel.d.ts +67 -0
- package/dist/constructs/webhook-alert-channel.js +52 -0
- package/dist/constructs/webhook-alert-channel.js.map +1 -0
- package/dist/help/examples.d.ts +6 -0
- package/dist/help/examples.js +22 -0
- package/dist/help/examples.js.map +1 -0
- package/dist/help/help-extension.d.ts +7 -0
- package/dist/help/help-extension.js +59 -0
- package/dist/help/help-extension.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/messages/common-messages.d.ts +5 -0
- package/dist/messages/common-messages.js +9 -0
- package/dist/messages/common-messages.js.map +1 -0
- package/dist/playwright/playwright-config-loader.d.ts +1 -0
- package/dist/playwright/playwright-config-loader.js +26 -0
- package/dist/playwright/playwright-config-loader.js.map +1 -0
- package/dist/playwright/playwright-config-template.d.ts +8 -0
- package/dist/playwright/playwright-config-template.js +78 -0
- package/dist/playwright/playwright-config-template.js.map +1 -0
- package/dist/reporters/abstract-list.d.ts +41 -0
- package/dist/reporters/abstract-list.js +171 -0
- package/dist/reporters/abstract-list.js.map +1 -0
- package/dist/reporters/ci.d.ts +12 -0
- package/dist/reporters/ci.js +34 -0
- package/dist/reporters/ci.js.map +1 -0
- package/dist/reporters/dot.d.ts +10 -0
- package/dist/reporters/dot.js +29 -0
- package/dist/reporters/dot.js.map +1 -0
- package/dist/reporters/github.d.ts +32 -0
- package/dist/reporters/github.js +119 -0
- package/dist/reporters/github.js.map +1 -0
- package/dist/reporters/json.d.ts +26 -0
- package/dist/reporters/json.js +101 -0
- package/dist/reporters/json.js.map +1 -0
- package/dist/reporters/list.d.ts +15 -0
- package/dist/reporters/list.js +85 -0
- package/dist/reporters/list.js.map +1 -0
- package/dist/reporters/reporter.d.ts +16 -0
- package/dist/reporters/reporter.js +29 -0
- package/dist/reporters/reporter.js.map +1 -0
- package/dist/reporters/util.d.ts +18 -0
- package/dist/reporters/util.js +325 -0
- package/dist/reporters/util.js.map +1 -0
- package/dist/rest/accounts.d.ts +12 -0
- package/dist/rest/accounts.js +15 -0
- package/dist/rest/accounts.js.map +1 -0
- package/dist/rest/api.d.ts +33 -0
- package/dist/rest/api.js +98 -0
- package/dist/rest/api.js.map +1 -0
- package/dist/rest/assets.d.ts +13 -0
- package/dist/rest/assets.js +30 -0
- package/dist/rest/assets.js.map +1 -0
- package/dist/rest/checkly-storage.d.ts +12 -0
- package/dist/rest/checkly-storage.js +15 -0
- package/dist/rest/checkly-storage.js.map +1 -0
- package/dist/rest/environment-variables.d.ts +17 -0
- package/dist/rest/environment-variables.js +25 -0
- package/dist/rest/environment-variables.js.map +1 -0
- package/dist/rest/heartbeat-checks.d.ts +11 -0
- package/dist/rest/heartbeat-checks.js +17 -0
- package/dist/rest/heartbeat-checks.js.map +1 -0
- package/dist/rest/locations.d.ts +11 -0
- package/dist/rest/locations.js +12 -0
- package/dist/rest/locations.js.map +1 -0
- package/dist/rest/private-locations.d.ts +10 -0
- package/dist/rest/private-locations.js +12 -0
- package/dist/rest/private-locations.js.map +1 -0
- package/dist/rest/projects.d.ts +46 -0
- package/dist/rest/projects.js +25 -0
- package/dist/rest/projects.js.map +1 -0
- package/dist/rest/runtimes.d.ts +16 -0
- package/dist/rest/runtimes.js +15 -0
- package/dist/rest/runtimes.js.map +1 -0
- package/dist/rest/test-sessions.d.ts +59 -0
- package/dist/rest/test-sessions.js +24 -0
- package/dist/rest/test-sessions.js.map +1 -0
- package/dist/rest/users.d.ts +12 -0
- package/dist/rest/users.js +12 -0
- package/dist/rest/users.js.map +1 -0
- package/dist/rest/util.d.ts +4 -0
- package/dist/rest/util.js +17 -0
- package/dist/rest/util.js.map +1 -0
- package/dist/services/abstract-check-runner.d.ts +60 -0
- package/dist/services/abstract-check-runner.js +225 -0
- package/dist/services/abstract-check-runner.js.map +1 -0
- package/dist/services/check-parser/collector.d.ts +33 -0
- package/dist/services/check-parser/collector.js +48 -0
- package/dist/services/check-parser/collector.js.map +1 -0
- package/dist/services/check-parser/errors.d.ts +8 -0
- package/dist/services/check-parser/errors.js +45 -0
- package/dist/services/check-parser/errors.js.map +1 -0
- package/dist/services/check-parser/package-files/index.d.ts +1 -0
- package/dist/services/check-parser/package-files/index.js +6 -0
- package/dist/services/check-parser/package-files/index.js.map +1 -0
- package/dist/services/check-parser/package-files/json-source-file.d.ts +13 -0
- package/dist/services/check-parser/package-files/json-source-file.js +34 -0
- package/dist/services/check-parser/package-files/json-source-file.js.map +1 -0
- package/dist/services/check-parser/package-files/loader.d.ts +7 -0
- package/dist/services/check-parser/package-files/loader.js +19 -0
- package/dist/services/check-parser/package-files/loader.js.map +1 -0
- package/dist/services/check-parser/package-files/package-json-file.d.ts +23 -0
- package/dist/services/check-parser/package-files/package-json-file.js +44 -0
- package/dist/services/check-parser/package-files/package-json-file.js.map +1 -0
- package/dist/services/check-parser/package-files/paths.d.ts +22 -0
- package/dist/services/check-parser/package-files/paths.js +108 -0
- package/dist/services/check-parser/package-files/paths.js.map +1 -0
- package/dist/services/check-parser/package-files/resolver.d.ts +32 -0
- package/dist/services/check-parser/package-files/resolver.js +186 -0
- package/dist/services/check-parser/package-files/resolver.js.map +1 -0
- package/dist/services/check-parser/package-files/source-file.d.ts +13 -0
- package/dist/services/check-parser/package-files/source-file.js +41 -0
- package/dist/services/check-parser/package-files/source-file.js.map +1 -0
- package/dist/services/check-parser/package-files/tsconfig-json-file.d.ts +68 -0
- package/dist/services/check-parser/package-files/tsconfig-json-file.js +119 -0
- package/dist/services/check-parser/package-files/tsconfig-json-file.js.map +1 -0
- package/dist/services/check-parser/parser.d.ts +32 -0
- package/dist/services/check-parser/parser.js +303 -0
- package/dist/services/check-parser/parser.js.map +1 -0
- package/dist/services/checkly-config-loader.d.ts +72 -0
- package/dist/services/checkly-config-loader.js +103 -0
- package/dist/services/checkly-config-loader.js.map +1 -0
- package/dist/services/config.d.ts +28 -0
- package/dist/services/config.js +99 -0
- package/dist/services/config.js.map +1 -0
- package/dist/services/project-parser.d.ts +21 -0
- package/dist/services/project-parser.js +192 -0
- package/dist/services/project-parser.js.map +1 -0
- package/dist/services/snapshot-service.d.ts +13 -0
- package/dist/services/snapshot-service.js +85 -0
- package/dist/services/snapshot-service.js.map +1 -0
- package/dist/services/socket-client.d.ts +4 -0
- package/dist/services/socket-client.js +88 -0
- package/dist/services/socket-client.js.map +1 -0
- package/dist/services/test-filters.d.ts +3 -0
- package/dist/services/test-filters.js +27 -0
- package/dist/services/test-filters.js.map +1 -0
- package/dist/services/test-runner.d.ts +24 -0
- package/dist/services/test-runner.js +91 -0
- package/dist/services/test-runner.js.map +1 -0
- package/dist/services/trigger-runner.d.ts +29 -0
- package/dist/services/trigger-runner.js +59 -0
- package/dist/services/trigger-runner.js.map +1 -0
- package/dist/services/util.d.ts +32 -0
- package/dist/services/util.js +244 -0
- package/dist/services/util.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/oclif.manifest.json +635 -0
- 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,oBA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AO,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,13 @@
|
|
|
1
|
+
import { SourceFile } from './source-file';
|
|
2
|
+
import type { LoadFile } from './loader';
|
|
3
|
+
export type Options = {
|
|
4
|
+
sourceFileLoader?: LoadFile<SourceFile>;
|
|
5
|
+
};
|
|
6
|
+
export declare class JsonSourceFile<Schema> {
|
|
7
|
+
sourceFile: SourceFile;
|
|
8
|
+
data: Schema;
|
|
9
|
+
private constructor();
|
|
10
|
+
get meta(): import("./source-file").FileMeta;
|
|
11
|
+
static loadFromSourceFile<Schema>(sourceFile: SourceFile): JsonSourceFile<Schema> | undefined;
|
|
12
|
+
static loadFromFilePath<Schema>(filePath: string, options?: Options): JsonSourceFile<Schema> | undefined;
|
|
13
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JsonSourceFile = void 0;
|
|
4
|
+
const source_file_1 = require("./source-file");
|
|
5
|
+
class JsonSourceFile {
|
|
6
|
+
constructor(sourceFile, data) {
|
|
7
|
+
this.sourceFile = sourceFile;
|
|
8
|
+
this.data = data;
|
|
9
|
+
}
|
|
10
|
+
get meta() {
|
|
11
|
+
return this.sourceFile.meta;
|
|
12
|
+
}
|
|
13
|
+
static loadFromSourceFile(sourceFile) {
|
|
14
|
+
try {
|
|
15
|
+
const data = JSON.parse(sourceFile.contents);
|
|
16
|
+
return new JsonSourceFile(sourceFile, data);
|
|
17
|
+
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
static loadFromFilePath(filePath, options) {
|
|
22
|
+
const { sourceFileLoader } = {
|
|
23
|
+
sourceFileLoader: source_file_1.SourceFile.loadFromFilePath,
|
|
24
|
+
...options,
|
|
25
|
+
};
|
|
26
|
+
const sourceFile = sourceFileLoader(filePath);
|
|
27
|
+
if (sourceFile === undefined) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
return JsonSourceFile.loadFromSourceFile(sourceFile);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.JsonSourceFile = JsonSourceFile;
|
|
34
|
+
//# 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":";;;AAAA,+CAA0C;AAO1C,MAAa,cAAc;IAIzB,YAAqB,UAAsB,EAAE,IAAY;QACvD,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,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;QAC7C,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;QACpB,CAAC;IACH,CAAC;IAED,MAAM,CAAC,gBAAgB,CACrB,QAAgB,EAChB,OAAiB;QAEjB,MAAM,EAAE,gBAAgB,EAAE,GAAG;YAC3B,gBAAgB,EAAE,wBAAU,CAAC,gBAAgB;YAC7C,GAAG,OAAO;SACX,CAAA;QAED,MAAM,UAAU,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAA;QAC7C,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC7B,OAAM;QACR,CAAC;QAED,OAAO,cAAc,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAA;IACtD,CAAC;CACF;AAtCD,wCAsCC"}
|
|
@@ -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,23 @@
|
|
|
1
|
+
import { JsonSourceFile } from './json-source-file';
|
|
2
|
+
import type { LoadFile } from './loader';
|
|
3
|
+
type ExportCondition = 'node-addons' | 'node' | 'import' | 'require' | 'module-sync' | 'default';
|
|
4
|
+
type Schema = {
|
|
5
|
+
main?: string;
|
|
6
|
+
exports?: string | string[] | Record<string, string> | Record<ExportCondition, Record<string, string>>;
|
|
7
|
+
};
|
|
8
|
+
export type Options = {
|
|
9
|
+
jsonSourceFileLoader?: LoadFile<JsonSourceFile<Schema>>;
|
|
10
|
+
};
|
|
11
|
+
export declare class PackageJsonFile {
|
|
12
|
+
static FILENAME: string;
|
|
13
|
+
jsonFile: JsonSourceFile<Schema>;
|
|
14
|
+
basePath: string;
|
|
15
|
+
mainPaths: string[];
|
|
16
|
+
private constructor();
|
|
17
|
+
get meta(): import("./source-file").FileMeta;
|
|
18
|
+
static loadFromJsonSourceFile(jsonFile: JsonSourceFile<Schema>): PackageJsonFile | undefined;
|
|
19
|
+
static loadFromFilePath(filePath: string, options?: Options): PackageJsonFile | undefined;
|
|
20
|
+
static filePath(dirPath: string): string;
|
|
21
|
+
supportsPackageRelativePaths(): boolean;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
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.PackageJsonFile = void 0;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const json_source_file_1 = require("./json-source-file");
|
|
9
|
+
class PackageJsonFile {
|
|
10
|
+
constructor(jsonFile) {
|
|
11
|
+
this.jsonFile = jsonFile;
|
|
12
|
+
this.basePath = jsonFile.meta.dirname;
|
|
13
|
+
const fallbackMainPath = node_path_1.default.resolve(this.basePath, 'index.js');
|
|
14
|
+
this.mainPaths = jsonFile.data.main !== undefined
|
|
15
|
+
? [node_path_1.default.resolve(this.basePath, jsonFile.data.main), fallbackMainPath]
|
|
16
|
+
: [fallbackMainPath];
|
|
17
|
+
}
|
|
18
|
+
get meta() {
|
|
19
|
+
return this.jsonFile.meta;
|
|
20
|
+
}
|
|
21
|
+
static loadFromJsonSourceFile(jsonFile) {
|
|
22
|
+
return new PackageJsonFile(jsonFile);
|
|
23
|
+
}
|
|
24
|
+
static loadFromFilePath(filePath, options) {
|
|
25
|
+
const { jsonSourceFileLoader } = {
|
|
26
|
+
jsonSourceFileLoader: (json_source_file_1.JsonSourceFile.loadFromFilePath),
|
|
27
|
+
...options,
|
|
28
|
+
};
|
|
29
|
+
const jsonFile = jsonSourceFileLoader(filePath);
|
|
30
|
+
if (jsonFile === undefined) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
return new PackageJsonFile(jsonFile);
|
|
34
|
+
}
|
|
35
|
+
static filePath(dirPath) {
|
|
36
|
+
return node_path_1.default.join(dirPath, PackageJsonFile.FILENAME);
|
|
37
|
+
}
|
|
38
|
+
supportsPackageRelativePaths() {
|
|
39
|
+
return this.jsonFile.data.exports === undefined;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.PackageJsonFile = PackageJsonFile;
|
|
43
|
+
PackageJsonFile.FILENAME = 'package.json';
|
|
44
|
+
//# 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;AAE5B,yDAAmD;AAenD,MAAa,eAAe;IAO1B,YAAqB,QAAgC;QACnD,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,gBAAgB,CAAE,QAAgB,EAAE,OAAiB;QAC1D,MAAM,EAAE,oBAAoB,EAAE,GAAG;YAC/B,oBAAoB,EAAE,CAAA,iCAAc,CAAC,gBAAwB,CAAA;YAC7D,GAAG,OAAO;SACX,CAAA;QAED,MAAM,QAAQ,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAA;QAC/C,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAM;QACR,CAAC;QAED,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;;AA9CH,0CA+CC;AA9CQ,wBAAQ,GAAG,cAAc,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type Paths = Record<string, Array<string>>;
|
|
2
|
+
declare class PathMatch {
|
|
3
|
+
ok: boolean;
|
|
4
|
+
results: string[];
|
|
5
|
+
private constructor();
|
|
6
|
+
static some(results: string[]): PathMatch;
|
|
7
|
+
static none(): PathMatch;
|
|
8
|
+
}
|
|
9
|
+
interface PathMatcher {
|
|
10
|
+
get prefixLength(): number;
|
|
11
|
+
match(importPath: string): PathMatch;
|
|
12
|
+
}
|
|
13
|
+
export declare class PathResolver {
|
|
14
|
+
baseUrl: string;
|
|
15
|
+
matchers: PathMatcher[];
|
|
16
|
+
constructor(baseUrl: string, matchers: PathMatcher[]);
|
|
17
|
+
resolve(importPath: string): string[];
|
|
18
|
+
static createFromPaths(baseUrl: string, paths: Paths): PathResolver;
|
|
19
|
+
private static matcherForPath;
|
|
20
|
+
}
|
|
21
|
+
export declare function isLocalPath(importPath: string): boolean;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
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 PathMatch {
|
|
9
|
+
constructor(ok, results) {
|
|
10
|
+
this.ok = ok;
|
|
11
|
+
this.results = results;
|
|
12
|
+
}
|
|
13
|
+
static some(results) {
|
|
14
|
+
return new PathMatch(true, results);
|
|
15
|
+
}
|
|
16
|
+
static none() {
|
|
17
|
+
return new PathMatch(false, []);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
class ExactPathMatcher {
|
|
21
|
+
constructor(source, target) {
|
|
22
|
+
this.source = source;
|
|
23
|
+
this.target = target;
|
|
24
|
+
}
|
|
25
|
+
get prefixLength() {
|
|
26
|
+
return this.source.length;
|
|
27
|
+
}
|
|
28
|
+
match(importPath) {
|
|
29
|
+
if (importPath === this.source) {
|
|
30
|
+
return PathMatch.some(this.target);
|
|
31
|
+
}
|
|
32
|
+
return PathMatch.none();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
class WildcardPathMatcher {
|
|
36
|
+
constructor(prefix, suffix, target) {
|
|
37
|
+
this.prefix = prefix;
|
|
38
|
+
this.suffix = suffix;
|
|
39
|
+
this.target = target;
|
|
40
|
+
}
|
|
41
|
+
get prefixLength() {
|
|
42
|
+
return this.prefix.length;
|
|
43
|
+
}
|
|
44
|
+
match(importPath) {
|
|
45
|
+
if (importPath.startsWith(this.prefix) && importPath.endsWith(this.suffix)) {
|
|
46
|
+
const joker = importPath.substring(this.prefix.length, importPath.length - this.suffix.length);
|
|
47
|
+
return PathMatch.some(this.target.map(target => target.replace('*', joker)));
|
|
48
|
+
}
|
|
49
|
+
return PathMatch.none();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
class AnyMatcher {
|
|
53
|
+
get prefixLength() {
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
56
|
+
match(importPath) {
|
|
57
|
+
return PathMatch.some([importPath]);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
class PathResolver {
|
|
61
|
+
constructor(baseUrl, matchers) {
|
|
62
|
+
this.baseUrl = baseUrl;
|
|
63
|
+
// Sort by longest prefix now, then we don't have to care about it later.
|
|
64
|
+
matchers.sort((a, b) => b.prefixLength - a.prefixLength);
|
|
65
|
+
this.matchers = matchers;
|
|
66
|
+
}
|
|
67
|
+
resolve(importPath) {
|
|
68
|
+
for (const matcher of this.matchers) {
|
|
69
|
+
const match = matcher.match(importPath);
|
|
70
|
+
if (match.ok) {
|
|
71
|
+
// We can just return the first match since matchers are already
|
|
72
|
+
// sorted by longest prefix.
|
|
73
|
+
return match.results.map(resultPath => node_path_1.default.join(this.baseUrl, resultPath));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return [];
|
|
77
|
+
}
|
|
78
|
+
static createFromPaths(baseUrl, paths) {
|
|
79
|
+
const matchers = [];
|
|
80
|
+
for (const path in paths) {
|
|
81
|
+
matchers.push(PathResolver.matcherForPath(path, paths[path]));
|
|
82
|
+
}
|
|
83
|
+
return new PathResolver(baseUrl, matchers);
|
|
84
|
+
}
|
|
85
|
+
static matcherForPath(importPath, target) {
|
|
86
|
+
const parts = importPath.split('*', 2);
|
|
87
|
+
if (parts.length === 1) {
|
|
88
|
+
return new ExactPathMatcher(importPath, target);
|
|
89
|
+
}
|
|
90
|
+
const [prefix, suffix] = parts;
|
|
91
|
+
return new WildcardPathMatcher(prefix, suffix, target);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.PathResolver = PathResolver;
|
|
95
|
+
function isLocalPath(importPath) {
|
|
96
|
+
if (importPath.startsWith('/')) {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
if (importPath.startsWith('./')) {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
if (importPath.startsWith('../')) {
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
exports.isLocalPath = isLocalPath;
|
|
108
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../../../src/services/check-parser/package-files/paths.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAI5B,MAAM,SAAS;IAIb,YAAqB,EAAW,EAAE,OAAiB;QACjD,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;QACZ,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,MAAM,CAAC,IAAI,CAAE,OAAiB;QAC5B,OAAO,IAAI,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IACrC,CAAC;IAED,MAAM,CAAC,IAAI;QACT,OAAO,IAAI,SAAS,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;IACjC,CAAC;CACF;AAOD,MAAM,gBAAgB;IAIpB,YAAa,MAAc,EAAE,MAAgB;QAC3C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAA;IAC3B,CAAC;IAED,KAAK,CAAE,UAAkB;QACvB,IAAI,UAAU,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;YAC/B,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACpC,CAAC;QAED,OAAO,SAAS,CAAC,IAAI,EAAE,CAAA;IACzB,CAAC;CACF;AAED,MAAM,mBAAmB;IAKvB,YAAa,MAAc,EAAE,MAAc,EAAE,MAAgB;QAC3D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAA;IAC3B,CAAC;IAED,KAAK,CAA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AO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAdD,kCAcC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { SourceFile } from './source-file';
|
|
2
|
+
import { PackageJsonFile } from './package-json-file';
|
|
3
|
+
import { TSConfigFile } from './tsconfig-json-file';
|
|
4
|
+
import { FileLoader } from './loader';
|
|
5
|
+
type PackageFiles = {
|
|
6
|
+
packageJson?: PackageJsonFile;
|
|
7
|
+
tsconfigJson?: TSConfigFile;
|
|
8
|
+
};
|
|
9
|
+
type Origin = 'tsconfig-resolved-path' | 'tsconfig-baseurl-relative-path' | 'package-relative-path' | 'relative-path';
|
|
10
|
+
type LocalDependency = {
|
|
11
|
+
sourceFile: SourceFile;
|
|
12
|
+
origin: Origin;
|
|
13
|
+
};
|
|
14
|
+
type MissingDependency = {
|
|
15
|
+
spec: string;
|
|
16
|
+
filePath: string;
|
|
17
|
+
};
|
|
18
|
+
type Dependencies = {
|
|
19
|
+
external: string[];
|
|
20
|
+
missing: MissingDependency[];
|
|
21
|
+
local: LocalDependency[];
|
|
22
|
+
};
|
|
23
|
+
export declare class PackageFilesResolver {
|
|
24
|
+
packageJsonCache: FileLoader<PackageJsonFile>;
|
|
25
|
+
tsconfigJsonCache: FileLoader<TSConfigFile>;
|
|
26
|
+
loadPackageFiles(filePath: string, options?: {
|
|
27
|
+
root?: string;
|
|
28
|
+
}): PackageFiles;
|
|
29
|
+
private resolveSourceFile;
|
|
30
|
+
resolveDependenciesForFilePath(filePath: string, dependencies: string[], suffixes: string[]): Dependencies;
|
|
31
|
+
}
|
|
32
|
+
export {};
|