checkly 4.16.0 → 4.17.0

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 (54) hide show
  1. package/dist/commands/baseCommand.d.ts +1 -0
  2. package/dist/commands/baseCommand.js +7 -0
  3. package/dist/commands/baseCommand.js.map +1 -1
  4. package/dist/commands/deploy.js +6 -2
  5. package/dist/commands/deploy.js.map +1 -1
  6. package/dist/commands/sync-playwright.js +9 -3
  7. package/dist/commands/sync-playwright.js.map +1 -1
  8. package/dist/commands/test.js +6 -2
  9. package/dist/commands/test.js.map +1 -1
  10. package/dist/constructs/api-check.js +1 -5
  11. package/dist/constructs/api-check.js.map +1 -1
  12. package/dist/constructs/browser-check.js +1 -5
  13. package/dist/constructs/browser-check.js.map +1 -1
  14. package/dist/constructs/multi-step-check.js +1 -5
  15. package/dist/constructs/multi-step-check.js.map +1 -1
  16. package/dist/constructs/project.d.ts +3 -0
  17. package/dist/constructs/project.js +14 -0
  18. package/dist/constructs/project.js.map +1 -1
  19. package/dist/services/check-parser/package-files/extension.d.ts +28 -0
  20. package/dist/services/check-parser/package-files/extension.js +56 -0
  21. package/dist/services/check-parser/package-files/extension.js.map +1 -0
  22. package/dist/services/check-parser/package-files/jsconfig-json-file.d.ts +17 -0
  23. package/dist/services/check-parser/package-files/jsconfig-json-file.js +46 -0
  24. package/dist/services/check-parser/package-files/jsconfig-json-file.js.map +1 -0
  25. package/dist/services/check-parser/package-files/json-source-file.d.ts +10 -0
  26. package/dist/services/check-parser/package-files/json-source-file.js +38 -0
  27. package/dist/services/check-parser/package-files/json-source-file.js.map +1 -0
  28. package/dist/services/check-parser/package-files/loader.d.ts +7 -0
  29. package/dist/services/check-parser/package-files/loader.js +19 -0
  30. package/dist/services/check-parser/package-files/loader.js.map +1 -0
  31. package/dist/services/check-parser/package-files/lookup.d.ts +12 -0
  32. package/dist/services/check-parser/package-files/lookup.js +70 -0
  33. package/dist/services/check-parser/package-files/lookup.js.map +1 -0
  34. package/dist/services/check-parser/package-files/package-json-file.d.ts +19 -0
  35. package/dist/services/check-parser/package-files/package-json-file.js +45 -0
  36. package/dist/services/check-parser/package-files/package-json-file.js.map +1 -0
  37. package/dist/services/check-parser/package-files/paths.d.ts +80 -0
  38. package/dist/services/check-parser/package-files/paths.js +164 -0
  39. package/dist/services/check-parser/package-files/paths.js.map +1 -0
  40. package/dist/services/check-parser/package-files/resolver.d.ts +66 -0
  41. package/dist/services/check-parser/package-files/resolver.js +277 -0
  42. package/dist/services/check-parser/package-files/resolver.js.map +1 -0
  43. package/dist/services/check-parser/package-files/source-file.d.ts +15 -0
  44. package/dist/services/check-parser/package-files/source-file.js +54 -0
  45. package/dist/services/check-parser/package-files/source-file.js.map +1 -0
  46. package/dist/services/check-parser/package-files/tsconfig-json-file.d.ts +66 -0
  47. package/dist/services/check-parser/package-files/tsconfig-json-file.js +95 -0
  48. package/dist/services/check-parser/package-files/tsconfig-json-file.js.map +1 -0
  49. package/dist/services/check-parser/parser.d.ts +12 -16
  50. package/dist/services/check-parser/parser.js +75 -96
  51. package/dist/services/check-parser/parser.js.map +1 -1
  52. package/dist/tsconfig.tsbuildinfo +1 -1
  53. package/oclif.manifest.json +1 -1
  54. package/package.json +1 -1
@@ -0,0 +1,277 @@
1
+ "use strict";
2
+ /* eslint-disable no-labels */
3
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
5
+ 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");
6
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ var _PackageFilesCache_instances, _PackageFilesCache_sourceFileCache, _PackageFilesCache_jsonFileLoader, _PackageFilesCache_packageJsonCache, _PackageFilesCache_tsconfigJsonCache, _PackageFilesCache_jsconfigJsonCache;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.PackageFilesResolver = void 0;
14
+ const node_path_1 = __importDefault(require("node:path"));
15
+ const source_file_1 = require("./source-file");
16
+ const package_json_file_1 = require("./package-json-file");
17
+ const tsconfig_json_file_1 = require("./tsconfig-json-file");
18
+ const jsconfig_json_file_1 = require("./jsconfig-json-file");
19
+ const paths_1 = require("./paths");
20
+ const loader_1 = require("./loader");
21
+ const json_source_file_1 = require("./json-source-file");
22
+ const lookup_1 = require("./lookup");
23
+ class PackageFilesCache {
24
+ constructor() {
25
+ _PackageFilesCache_instances.add(this);
26
+ _PackageFilesCache_sourceFileCache.set(this, new loader_1.FileLoader(source_file_1.SourceFile.loadFromFilePath));
27
+ _PackageFilesCache_packageJsonCache.set(this, new loader_1.FileLoader(__classPrivateFieldGet(this, _PackageFilesCache_instances, "m", _PackageFilesCache_jsonFileLoader).call(this, package_json_file_1.PackageJsonFile.loadFromJsonSourceFile)));
28
+ _PackageFilesCache_tsconfigJsonCache.set(this, new loader_1.FileLoader(__classPrivateFieldGet(this, _PackageFilesCache_instances, "m", _PackageFilesCache_jsonFileLoader).call(this, tsconfig_json_file_1.TSConfigFile.loadFromJsonSourceFile)));
29
+ _PackageFilesCache_jsconfigJsonCache.set(this, new loader_1.FileLoader(__classPrivateFieldGet(this, _PackageFilesCache_instances, "m", _PackageFilesCache_jsonFileLoader).call(this, jsconfig_json_file_1.JSConfigFile.loadFromJsonSourceFile)));
30
+ }
31
+ sourceFile(filePath, context) {
32
+ for (const lookupPath of context.collectLookupPaths(filePath)) {
33
+ const sourceFile = __classPrivateFieldGet(this, _PackageFilesCache_sourceFileCache, "f").load(lookupPath);
34
+ if (sourceFile === undefined) {
35
+ continue;
36
+ }
37
+ return sourceFile;
38
+ }
39
+ }
40
+ packageJson(filePath) {
41
+ return __classPrivateFieldGet(this, _PackageFilesCache_packageJsonCache, "f").load(filePath);
42
+ }
43
+ tsconfigJson(filePath) {
44
+ return __classPrivateFieldGet(this, _PackageFilesCache_tsconfigJsonCache, "f").load(filePath);
45
+ }
46
+ jsconfigJson(filePath) {
47
+ return __classPrivateFieldGet(this, _PackageFilesCache_jsconfigJsonCache, "f").load(filePath);
48
+ }
49
+ }
50
+ _PackageFilesCache_sourceFileCache = new WeakMap(), _PackageFilesCache_packageJsonCache = new WeakMap(), _PackageFilesCache_tsconfigJsonCache = new WeakMap(), _PackageFilesCache_jsconfigJsonCache = new WeakMap(), _PackageFilesCache_instances = new WeakSet(), _PackageFilesCache_jsonFileLoader = function _PackageFilesCache_jsonFileLoader(load) {
51
+ return filePath => {
52
+ const sourceFile = __classPrivateFieldGet(this, _PackageFilesCache_sourceFileCache, "f").load(filePath);
53
+ if (sourceFile === undefined) {
54
+ return;
55
+ }
56
+ const jsonFile = json_source_file_1.JsonSourceFile.loadFromSourceFile(sourceFile);
57
+ if (jsonFile === undefined) {
58
+ return;
59
+ }
60
+ return load(jsonFile);
61
+ };
62
+ };
63
+ class PackageFiles {
64
+ satisfyFromDirPath(dirPath, cache) {
65
+ if (this.packageJson === undefined) {
66
+ this.packageJson = cache.packageJson(package_json_file_1.PackageJsonFile.filePath(dirPath));
67
+ }
68
+ if (this.tsconfigJson === undefined && this.jsconfigJson === undefined) {
69
+ this.tsconfigJson = cache.tsconfigJson(tsconfig_json_file_1.TSConfigFile.filePath(dirPath));
70
+ }
71
+ if (this.jsconfigJson === undefined && this.tsconfigJson === undefined) {
72
+ this.jsconfigJson = cache.jsconfigJson(jsconfig_json_file_1.JSConfigFile.filePath(dirPath));
73
+ }
74
+ return this.satisfied;
75
+ }
76
+ get satisfied() {
77
+ // Never satisfied until we find a package.json file.
78
+ if (this.packageJson === undefined) {
79
+ return false;
80
+ }
81
+ // Not satisfied until either a tsconfig.json or a jsconfig.json file
82
+ // is found.
83
+ if (this.tsconfigJson === undefined && this.jsconfigJson === undefined) {
84
+ return false;
85
+ }
86
+ return true;
87
+ }
88
+ }
89
+ class PackageFilesResolver {
90
+ constructor() {
91
+ this.cache = new PackageFilesCache();
92
+ }
93
+ loadPackageFiles(filePath, options) {
94
+ const files = new PackageFiles();
95
+ let currentPath = filePath;
96
+ while (true) {
97
+ const prevPath = currentPath;
98
+ currentPath = node_path_1.default.dirname(prevPath);
99
+ // Bail out if we reach root.
100
+ if (prevPath === currentPath) {
101
+ break;
102
+ }
103
+ // Try to find all files and stop if we do.
104
+ if (files.satisfyFromDirPath(currentPath, this.cache)) {
105
+ break;
106
+ }
107
+ // Stop if we reach the user-specified root directory.
108
+ // TODO: I don't like a string comparison for this but it'll do for now.
109
+ if (currentPath === (options === null || options === void 0 ? void 0 : options.root)) {
110
+ break;
111
+ }
112
+ }
113
+ return files;
114
+ }
115
+ resolveSourceFile(sourceFile, context) {
116
+ if (sourceFile.meta.basename === package_json_file_1.PackageJsonFile.FILENAME) {
117
+ const packageJson = this.cache.packageJson(sourceFile.meta.filePath);
118
+ if (packageJson === undefined) {
119
+ // This should never happen unless the package.json is invalid or
120
+ // something.
121
+ return [sourceFile];
122
+ }
123
+ // Go through each main path. A fallback path is included. If we can
124
+ // find a tsconfig for the main file, look it up and attempt to find
125
+ // the original TypeScript sources roughly the same way tsc does it.
126
+ for (const mainPath of packageJson.mainPaths) {
127
+ const { tsconfigJson, jsconfigJson } = this.loadPackageFiles(mainPath, {
128
+ root: packageJson.basePath,
129
+ });
130
+ // TODO: Prefer jsconfig.json when dealing with a JavaScript file.
131
+ for (const configJson of [tsconfigJson, jsconfigJson]) {
132
+ if (configJson === undefined) {
133
+ continue;
134
+ }
135
+ const candidatePaths = configJson.collectLookupPaths(mainPath).flatMap(filePath => {
136
+ return context.collectLookupPaths(filePath);
137
+ });
138
+ for (const candidatePath of candidatePaths) {
139
+ const mainSourceFile = this.cache.sourceFile(candidatePath, context);
140
+ if (mainSourceFile === undefined) {
141
+ continue;
142
+ }
143
+ configJson.registerRelatedSourceFile(mainSourceFile);
144
+ return [sourceFile, mainSourceFile, configJson.jsonFile.sourceFile];
145
+ }
146
+ }
147
+ const mainSourceFile = this.cache.sourceFile(mainPath, context);
148
+ if (mainSourceFile === undefined) {
149
+ continue;
150
+ }
151
+ return [sourceFile, mainSourceFile];
152
+ }
153
+ // TODO: Is this even useful without any code files?
154
+ return [sourceFile];
155
+ }
156
+ return [sourceFile];
157
+ }
158
+ resolveDependenciesForFilePath(filePath, dependencies) {
159
+ const resolved = {
160
+ external: [],
161
+ missing: [],
162
+ local: [],
163
+ };
164
+ const dirname = node_path_1.default.dirname(filePath);
165
+ const { tsconfigJson, jsconfigJson } = this.loadPackageFiles(filePath);
166
+ const context = lookup_1.LookupContext.forFilePath(filePath);
167
+ resolve: for (const importPath of dependencies) {
168
+ if ((0, paths_1.isBuiltinPath)(importPath)) {
169
+ resolved.external.push({
170
+ importPath,
171
+ });
172
+ continue resolve;
173
+ }
174
+ if ((0, paths_1.isLocalPath)(importPath)) {
175
+ const relativeDepPath = node_path_1.default.resolve(dirname, importPath);
176
+ const sourceFile = this.cache.sourceFile(relativeDepPath, context);
177
+ if (sourceFile !== undefined) {
178
+ const resolvedFiles = this.resolveSourceFile(sourceFile, context);
179
+ let found = false;
180
+ for (const resolvedFile of resolvedFiles) {
181
+ resolved.local.push({
182
+ kind: 'relative-path',
183
+ importPath,
184
+ sourceFile: resolvedFile,
185
+ });
186
+ found = true;
187
+ }
188
+ if (found) {
189
+ continue resolve;
190
+ }
191
+ }
192
+ resolved.missing.push({
193
+ importPath,
194
+ filePath: relativeDepPath,
195
+ });
196
+ continue resolve;
197
+ }
198
+ for (const configJson of [tsconfigJson, jsconfigJson]) {
199
+ if (configJson === undefined) {
200
+ continue;
201
+ }
202
+ const resolvedPaths = configJson.resolvePath(importPath);
203
+ if (resolvedPaths.length > 0) {
204
+ let found = false;
205
+ for (const { source, target } of resolvedPaths) {
206
+ const relativePath = node_path_1.default.resolve(configJson.basePath, target.path);
207
+ const sourceFile = this.cache.sourceFile(relativePath, context);
208
+ if (sourceFile !== undefined) {
209
+ const resolvedFiles = this.resolveSourceFile(sourceFile, context);
210
+ for (const resolvedFile of resolvedFiles) {
211
+ configJson.registerRelatedSourceFile(resolvedFile);
212
+ resolved.local.push({
213
+ kind: 'tsconfig-resolved-path',
214
+ importPath,
215
+ sourceFile: resolvedFile,
216
+ configFile: configJson,
217
+ pathResult: {
218
+ source,
219
+ target,
220
+ },
221
+ });
222
+ resolved.local.push({
223
+ kind: 'tsconfig-file',
224
+ importPath,
225
+ sourceFile: configJson.jsonFile.sourceFile,
226
+ configFile: configJson,
227
+ });
228
+ found = true;
229
+ }
230
+ if (found) {
231
+ // We're trying to find the first match out of many possible
232
+ // candidates. Stop once we find a match.
233
+ break;
234
+ }
235
+ }
236
+ }
237
+ if (found) {
238
+ continue resolve;
239
+ }
240
+ }
241
+ if (configJson.baseUrl !== undefined) {
242
+ const relativePath = node_path_1.default.resolve(configJson.basePath, configJson.baseUrl, importPath);
243
+ const sourceFile = this.cache.sourceFile(relativePath, context);
244
+ if (sourceFile !== undefined) {
245
+ const resolvedFiles = this.resolveSourceFile(sourceFile, context);
246
+ let found = false;
247
+ for (const resolvedFile of resolvedFiles) {
248
+ configJson.registerRelatedSourceFile(resolvedFile);
249
+ resolved.local.push({
250
+ kind: 'tsconfig-baseurl-relative-path',
251
+ importPath,
252
+ sourceFile: resolvedFile,
253
+ configFile: configJson,
254
+ });
255
+ resolved.local.push({
256
+ kind: 'tsconfig-file',
257
+ importPath,
258
+ sourceFile: configJson.jsonFile.sourceFile,
259
+ configFile: configJson,
260
+ });
261
+ found = true;
262
+ }
263
+ if (found) {
264
+ continue resolve;
265
+ }
266
+ }
267
+ }
268
+ }
269
+ resolved.external.push({
270
+ importPath,
271
+ });
272
+ }
273
+ return resolved;
274
+ }
275
+ }
276
+ exports.PackageFilesResolver = PackageFilesResolver;
277
+ //# sourceMappingURL=resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../../../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U;6BACvB,CAAC,CAAA;4BACF,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC;gCAClB,IAAI,EAAE,eAAe;gCACrB,UAAU;gCACV,UAAU,EAAE,UAAU,CAAC,QAAQ,CAAC,UAAU;gCAC1C,UAAU,EAAE,UAAU;6BACvB,CAAC,CAAA;4BACF,KAAK,GAAG,IAAI,CAAA;wBACd,CAAC;wBACD,IAAI,KAAK,EAAE,CAAC;4BACV,SAAS,OAAO,CAAA;wBAClB,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;YAED,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC;gBACrB,UAAU;aACX,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,QAAQ,CAAA;IACjB,CAAC;CACF;AAzND,oDAyNC"}
@@ -0,0 +1,15 @@
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
+ #private;
10
+ readonly id: number;
11
+ contents: string;
12
+ meta: FileMeta;
13
+ private constructor();
14
+ static loadFromFilePath(filePath: string): SourceFile | undefined;
15
+ }
@@ -0,0 +1,54 @@
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, _SourceFile_id;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.SourceFile = exports.FileMeta = void 0;
19
+ const node_fs_1 = __importDefault(require("node:fs"));
20
+ const node_path_1 = __importDefault(require("node:path"));
21
+ class FileMeta {
22
+ constructor(filePath, dirname, basename) {
23
+ this.filePath = filePath;
24
+ this.dirname = dirname;
25
+ this.basename = basename;
26
+ }
27
+ static fromFilePath(filePath) {
28
+ return new FileMeta(filePath, node_path_1.default.dirname(filePath), node_path_1.default.basename(filePath));
29
+ }
30
+ }
31
+ exports.FileMeta = FileMeta;
32
+ class SourceFile {
33
+ constructor(meta, contents) {
34
+ var _b, _c;
35
+ this.id = __classPrivateFieldSet(_b = _a, _a, (_c = __classPrivateFieldGet(_b, _a, "f", _SourceFile_id), ++_c), "f", _SourceFile_id);
36
+ this.meta = meta;
37
+ this.contents = contents;
38
+ }
39
+ static loadFromFilePath(filePath) {
40
+ try {
41
+ const contents = node_fs_1.default.readFileSync(filePath, {
42
+ encoding: 'utf8',
43
+ });
44
+ const meta = FileMeta.fromFilePath(filePath);
45
+ return new _a(meta, contents);
46
+ }
47
+ catch (err) {
48
+ }
49
+ }
50
+ }
51
+ exports.SourceFile = SourceFile;
52
+ _a = SourceFile;
53
+ _SourceFile_id = { value: 0 };
54
+ //# 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;IAOrB,YAAqB,IAAc,EAAE,QAAgB;;QAL5C,OAAE,GAAG,oCAAA,CAAE,wDAAc,EAAhB,IAAgB,CAAA,sBAAA,CAAA;QAM5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAE,QAAgB;QACvC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,iBAAE,CAAC,YAAY,CAAC,QAAQ,EAAE;gBACzC,QAAQ,EAAE,MAAM;aACjB,CAAC,CAAA;YAEF,MAAM,IAAI,GAAG,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAA;YAE5C,OAAO,IAAI,EAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;QACvC,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;QACpB,CAAC;IACH,CAAC;;AAvBH,gCAwBC;;AAvBQ,0BAAM,CAAC,EAAJ,CAAI"}
@@ -0,0 +1,66 @@
1
+ import { SourceFile } from './source-file';
2
+ import { JsonSourceFile } from './json-source-file';
3
+ import { PathResolver, ResolveResult } from './paths';
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 declare class TSConfigFile {
49
+ #private;
50
+ static FILENAME: string;
51
+ readonly id: number;
52
+ jsonFile: JsonSourceFile<Schema>;
53
+ basePath: string;
54
+ moduleResolution: string;
55
+ baseUrl?: string;
56
+ pathResolver: PathResolver;
57
+ relatedSourceFiles: SourceFile[];
58
+ protected constructor(jsonFile: JsonSourceFile<Schema>);
59
+ get meta(): import("./source-file").FileMeta;
60
+ static loadFromJsonSourceFile(jsonFile: JsonSourceFile<Schema>): TSConfigFile | undefined;
61
+ static filePath(dirPath: string): string;
62
+ resolvePath(importPath: string): ResolveResult;
63
+ collectLookupPaths(filePath: string): string[];
64
+ registerRelatedSourceFile(file: SourceFile): void;
65
+ }
66
+ export {};
@@ -0,0 +1,95 @@
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, _TSConfigFile_id;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.TSConfigFile = void 0;
19
+ const node_path_1 = __importDefault(require("node:path"));
20
+ const paths_1 = require("./paths");
21
+ class TSConfigFile {
22
+ constructor(jsonFile) {
23
+ var _b, _c, _d, _e, _f, _g, _h;
24
+ var _j, _k;
25
+ this.id = __classPrivateFieldSet(_j = _a, _a, (_k = __classPrivateFieldGet(_j, _a, "f", _TSConfigFile_id), ++_k), "f", _TSConfigFile_id);
26
+ this.relatedSourceFiles = [];
27
+ this.jsonFile = jsonFile;
28
+ this.basePath = jsonFile.meta.dirname;
29
+ this.moduleResolution = (_d = (_c = (_b = jsonFile.data.compilerOptions) === null || _b === void 0 ? void 0 : _b.moduleResolution) === null || _c === void 0 ? void 0 : _c.toLocaleLowerCase()) !== null && _d !== void 0 ? _d : 'unspecified';
30
+ const baseUrl = (_e = jsonFile.data.compilerOptions) === null || _e === void 0 ? void 0 : _e.baseUrl;
31
+ if (baseUrl !== undefined) {
32
+ this.baseUrl = node_path_1.default.resolve(this.jsonFile.meta.dirname, baseUrl);
33
+ }
34
+ this.pathResolver = paths_1.PathResolver.createFromPaths((_f = this.baseUrl) !== null && _f !== void 0 ? _f : '.', (_h = (_g = jsonFile.data.compilerOptions) === null || _g === void 0 ? void 0 : _g.paths) !== null && _h !== void 0 ? _h : {});
35
+ }
36
+ get meta() {
37
+ return this.jsonFile.meta;
38
+ }
39
+ static loadFromJsonSourceFile(jsonFile) {
40
+ return new _a(jsonFile);
41
+ }
42
+ static filePath(dirPath) {
43
+ return node_path_1.default.join(dirPath, _a.FILENAME);
44
+ }
45
+ resolvePath(importPath) {
46
+ return this.pathResolver.resolve(importPath);
47
+ }
48
+ collectLookupPaths(filePath) {
49
+ var _b;
50
+ let { outDir, rootDir, rootDirs, composite, } = (_b = this.jsonFile.data.compilerOptions) !== null && _b !== void 0 ? _b : {};
51
+ const candidates = [];
52
+ if (outDir === undefined) {
53
+ candidates.push(node_path_1.default.resolve(this.basePath, filePath));
54
+ return candidates; // Nothing more we can do.
55
+ }
56
+ if (composite === undefined) {
57
+ composite = false;
58
+ }
59
+ // Inferred rootDir is tsconfig directory if composite === true.
60
+ if (rootDir === undefined && composite) {
61
+ rootDir = '.';
62
+ }
63
+ // If we still don't have a root, we should calculate the longest common
64
+ // path among input files, but that's a lot of effort. Assume tsconfig
65
+ // directory and hope for the best.
66
+ if (rootDir === undefined) {
67
+ rootDir = '.';
68
+ }
69
+ const absoluteOutDir = node_path_1.default.resolve(this.basePath, outDir);
70
+ const relativePath = node_path_1.default.relative(absoluteOutDir, filePath);
71
+ // If the file is outside outDir, then assume we're looking for
72
+ // something that wasn't compiled using this tsconfig (or at all), and
73
+ // stop looking.
74
+ if (relativePath.startsWith('..')) {
75
+ candidates.push(node_path_1.default.resolve(this.basePath, filePath));
76
+ return candidates;
77
+ }
78
+ candidates.push(node_path_1.default.resolve(this.basePath, rootDir, relativePath));
79
+ // Assume that our inferred (or user specified) rootDir is enough to cover
80
+ // the same conditions we'd have to infer rootDirs, and only add rootDirs
81
+ // if they're actually set.
82
+ for (const multiRootDir of rootDirs !== null && rootDirs !== void 0 ? rootDirs : []) {
83
+ candidates.push(node_path_1.default.resolve(this.basePath, multiRootDir, relativePath));
84
+ }
85
+ return candidates;
86
+ }
87
+ registerRelatedSourceFile(file) {
88
+ this.relatedSourceFiles.push(file);
89
+ }
90
+ }
91
+ exports.TSConfigFile = TSConfigFile;
92
+ _a = TSConfigFile;
93
+ TSConfigFile.FILENAME = 'tsconfig.json';
94
+ _TSConfigFile_id = { value: 0 };
95
+ //# 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;AAI5B,mCAAqD;AA0DrD,MAAa,YAAY;IAcvB,YAAuB,QAAgC;;;QAV9C,OAAE,GAAG,oCAAA,CAAE,0DAAgB,EAAlB,IAAkB,CAAA,wBAAA,CAAA;QAQhC,uBAAkB,GAAiB,EAAE,CAAA;QAGnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QAExB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAA;QAErC,IAAI,CAAC,gBAAgB,GAAG,MAAA,MAAA,MAAA,QAAQ,CAAC,IAAI,CAAC,eAAe,0CAAE,gBAAgB,0CAAE,iBAAiB,EAAE,mCAAI,aAAa,CAAA;QAE7G,MAAM,OAAO,GAAG,MAAA,QAAQ,CAAC,IAAI,CAAC,eAAe,0CAAE,OAAO,CAAA;QACtD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,IAAI,CAAC,OAAO,GAAG,mBAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAClE,CA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ies: Array<string>;
3
+ dependencies: Array<string>;
4
4
  };
5
- type SupportedFileExtension = '.js' | '.mjs' | '.ts';
6
- declare const JS_RESOLVE_ORDER: string[];
7
- declare const TS_RESOLVE_ORDER: string[];
8
5
  type ParserOptions = {
9
6
  supportedNpmModules?: Array<string>;
10
7
  checkUnsupportedModules?: boolean;
@@ -12,7 +9,14 @@ type ParserOptions = {
12
9
  export declare class Parser {
13
10
  supportedModules: Set<string>;
14
11
  checkUnsupportedModules: boolean;
12
+ resolver: PackageFilesResolver;
13
+ cache: Map<string, {
14
+ module: Module;
15
+ resolvedDependencies?: Dependencies | undefined;
16
+ error?: any;
17
+ }>;
15
18
  constructor(options: ParserOptions);
19
+ supportsModule(importPath: string): boolean;
16
20
  parse(entrypoint: string): {
17
21
  entrypoint: {
18
22
  filePath: string;
@@ -23,22 +27,14 @@ export declare class Parser {
23
27
  content: string;
24
28
  }[];
25
29
  };
26
- static readDependency(filePath: string, preferedExtenstion: SupportedFileExtension): {
27
- filePath: string;
28
- content: string;
29
- }[];
30
- static tryReadFileExt(filePath: string, exts: typeof JS_RESOLVE_ORDER | typeof TS_RESOLVE_ORDER): {
31
- filePath: string;
32
- content: string;
33
- }[];
34
30
  static parseDependencies(filePath: string, contents: string): {
35
31
  module: Module;
36
32
  error?: any;
37
33
  };
38
- static jsNodeVisitor(localDependencies: Set<string>, npmDependencies: Set<string>): any;
39
- static tsNodeVisitor(tsParser: any, localDependencies: Set<string>, npmDependencies: Set<string>): any;
34
+ static jsNodeVisitor(dependencies: Set<string>): any;
35
+ static tsNodeVisitor(tsParser: any, dependencies: Set<string>): any;
40
36
  static isRequireExpression(node: any): boolean;
41
37
  static getRequireStringArg(node: any): string | null;
42
- static registerDependency(importArg: string | null, localDependencies: Set<string>, npmDependencies: Set<string>): void;
38
+ static registerDependency(importArg: string | null, dependencies: Set<string>): void;
43
39
  }
44
40
  export {};