@typescript-eslint/typescript-estree 7.0.3-alpha.16 → 7.0.3-alpha.18
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProgramFromProjectService.d.ts","sourceRoot":"","sources":["../src/useProgramFromProjectService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useProgramFromProjectService.d.ts","sourceRoot":"","sources":["../src/useProgramFromProjectService.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAM5D,wBAAgB,4BAA4B,CAC1C,EAAE,2BAA2B,EAAE,OAAO,EAAE,EAAE,sBAAsB,EAChE,aAAa,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EAC7C,sBAAsB,EAAE,OAAO,GAC9B,qBAAqB,GAAG,SAAS,CAqEnC"}
|
|
@@ -6,38 +6,47 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.useProgramFromProjectService = void 0;
|
|
7
7
|
const debug_1 = __importDefault(require("debug"));
|
|
8
8
|
const minimatch_1 = require("minimatch");
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
9
10
|
const createProjectProgram_1 = require("./create-program/createProjectProgram");
|
|
10
|
-
const shared_1 = require("./create-program/shared");
|
|
11
11
|
const log = (0, debug_1.default)('typescript-eslint:typescript-estree:useProgramFromProjectService');
|
|
12
12
|
function useProgramFromProjectService({ allowDefaultProjectForFiles, service }, parseSettings, hasFullTypeInformation) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
13
|
+
// We don't canonicalize the filename because it caused a performance regression.
|
|
14
|
+
// See https://github.com/typescript-eslint/typescript-eslint/issues/8519
|
|
15
|
+
const filePathAbsolute = absolutify(parseSettings.filePath);
|
|
16
|
+
log('Opening project service file for: %s at absolute path %s', parseSettings.filePath, filePathAbsolute);
|
|
17
|
+
const opened = service.openClientFile(filePathAbsolute, parseSettings.codeFullText,
|
|
16
18
|
/* scriptKind */ undefined, parseSettings.tsconfigRootDir);
|
|
17
19
|
log('Opened project service file: %o', opened);
|
|
18
20
|
if (hasFullTypeInformation) {
|
|
19
21
|
log('Project service type information enabled; checking for file path match on: %o', allowDefaultProjectForFiles);
|
|
22
|
+
const isDefaultProjectAllowedPath = filePathMatchedBy(parseSettings.filePath, allowDefaultProjectForFiles);
|
|
23
|
+
log('Default project allowed path: %s, based on config file: %s', isDefaultProjectAllowedPath, opened.configFileName);
|
|
20
24
|
if (opened.configFileName) {
|
|
21
|
-
if (
|
|
22
|
-
throw new Error(`${filePath} was included by allowDefaultProjectForFiles but also was found in the project service. Consider removing it from allowDefaultProjectForFiles.`);
|
|
25
|
+
if (isDefaultProjectAllowedPath) {
|
|
26
|
+
throw new Error(`${parseSettings.filePath} was included by allowDefaultProjectForFiles but also was found in the project service. Consider removing it from allowDefaultProjectForFiles.`);
|
|
23
27
|
}
|
|
24
28
|
}
|
|
25
|
-
else if (!
|
|
26
|
-
throw new Error(`${filePath} was not found by the project service. Consider either including it in the tsconfig.json or including it in allowDefaultProjectForFiles.`);
|
|
29
|
+
else if (!isDefaultProjectAllowedPath) {
|
|
30
|
+
throw new Error(`${parseSettings.filePath} was not found by the project service. Consider either including it in the tsconfig.json or including it in allowDefaultProjectForFiles.`);
|
|
27
31
|
}
|
|
28
32
|
}
|
|
29
|
-
log('Retrieving script info and then program for: %s',
|
|
30
|
-
const scriptInfo = service.getScriptInfo(
|
|
33
|
+
log('Retrieving script info and then program for: %s', filePathAbsolute);
|
|
34
|
+
const scriptInfo = service.getScriptInfo(filePathAbsolute);
|
|
31
35
|
const program = service
|
|
32
36
|
.getDefaultProjectForFile(scriptInfo.fileName, true)
|
|
33
37
|
.getLanguageService(/*ensureSynchronized*/ true)
|
|
34
38
|
.getProgram();
|
|
35
39
|
if (!program) {
|
|
36
|
-
log('Could not find project service program for: %s',
|
|
40
|
+
log('Could not find project service program for: %s', filePathAbsolute);
|
|
37
41
|
return undefined;
|
|
38
42
|
}
|
|
39
|
-
log('Found project service program for: %s',
|
|
43
|
+
log('Found project service program for: %s', filePathAbsolute);
|
|
40
44
|
return (0, createProjectProgram_1.createProjectProgram)(parseSettings, [program]);
|
|
45
|
+
function absolutify(filePath) {
|
|
46
|
+
return path_1.default.isAbsolute(filePath)
|
|
47
|
+
? filePath
|
|
48
|
+
: path_1.default.join(service.host.getCurrentDirectory(), filePath);
|
|
49
|
+
}
|
|
41
50
|
}
|
|
42
51
|
exports.useProgramFromProjectService = useProgramFromProjectService;
|
|
43
52
|
function filePathMatchedBy(filePath, allowDefaultProjectForFiles) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProgramFromProjectService.js","sourceRoot":"","sources":["../src/useProgramFromProjectService.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,yCAAsC;
|
|
1
|
+
{"version":3,"file":"useProgramFromProjectService.js","sourceRoot":"","sources":["../src/useProgramFromProjectService.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,yCAAsC;AACtC,gDAAwB;AAExB,gFAA6E;AAK7E,MAAM,GAAG,GAAG,IAAA,eAAK,EACf,kEAAkE,CACnE,CAAC;AAEF,SAAgB,4BAA4B,CAC1C,EAAE,2BAA2B,EAAE,OAAO,EAA0B,EAChE,aAA6C,EAC7C,sBAA+B;IAE/B,iFAAiF;IACjF,yEAAyE;IACzE,MAAM,gBAAgB,GAAG,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC5D,GAAG,CACD,0DAA0D,EAC1D,aAAa,CAAC,QAAQ,EACtB,gBAAgB,CACjB,CAAC;IAEF,MAAM,MAAM,GAAG,OAAO,CAAC,cAAc,CACnC,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,CAAC,CAAC,CAAC;IAEtD,SAAS,UAAU,CAAC,QAAgB;QAClC,OAAO,cAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;YAC9B,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC;AAzED,oEAyEC;AAED,SAAS,iBAAiB,CACxB,QAAgB,EAChB,2BAAiD;IAEjD,OAAO,CAAC,CAAC,2BAA2B,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,CACnD,IAAA,qBAAS,EAAC,QAAQ,EAAE,OAAO,CAAC,CAC7B,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typescript-eslint/typescript-estree",
|
|
3
|
-
"version": "7.0.3-alpha.
|
|
3
|
+
"version": "7.0.3-alpha.18",
|
|
4
4
|
"description": "A parser that converts TypeScript source code into an ESTree compatible form",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@typescript-eslint/types": "7.0.3-alpha.
|
|
57
|
-
"@typescript-eslint/visitor-keys": "7.0.3-alpha.
|
|
56
|
+
"@typescript-eslint/types": "7.0.3-alpha.18",
|
|
57
|
+
"@typescript-eslint/visitor-keys": "7.0.3-alpha.18",
|
|
58
58
|
"debug": "^4.3.4",
|
|
59
59
|
"globby": "^11.1.0",
|
|
60
60
|
"is-glob": "^4.0.3",
|