typescript-svelte-plugin 0.3.46 → 0.3.47
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/dist/src/index.js +1 -3
- package/dist/src/utils.d.ts +5 -0
- package/dist/src/utils.js +16 -1
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -32,9 +32,7 @@ function init(modules) {
|
|
|
32
32
|
logger.log('Svelte plugin disabled');
|
|
33
33
|
logger.log(info.config);
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
// where it'll try to load the cached version of the parsedCommandLine
|
|
37
|
-
const parsedCommandLine = info.languageServiceHost.getParsedCommandLine?.((0, utils_1.getConfigPathForProject)(info.project));
|
|
35
|
+
const parsedCommandLine = (0, utils_1.getProjectParsedCommandLine)(info.project);
|
|
38
36
|
// For some reason it's no longer enough to patch this at the projectService level, so we do it here, too
|
|
39
37
|
// TODO investigate if we can use the script snapshot for all Svelte files, too, enabling Svelte file
|
|
40
38
|
// updates getting picked up without a file save - move this logic into the snapshot manager then?
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -48,4 +48,9 @@ export declare function getProjectDirectory(project: ts.server.Project): string
|
|
|
48
48
|
export declare function hasNodeModule(startPath: string, module: string): string | boolean;
|
|
49
49
|
export declare function isSvelteProject(project: ts.server.Project): string | boolean;
|
|
50
50
|
export declare function importSvelteCompiler(fromPath: string | undefined): typeof import('svelte/compiler') | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* This call the ConfiguredProject.getParsedCommandLine
|
|
53
|
+
* where it'll try to load the cached version of the parsedCommandLine
|
|
54
|
+
*/
|
|
55
|
+
export declare function getProjectParsedCommandLine(project: ts.server.Project): ts.ParsedCommandLine | undefined;
|
|
51
56
|
export {};
|
package/dist/src/utils.js
CHANGED
|
@@ -23,6 +23,7 @@ exports.getProjectDirectory = getProjectDirectory;
|
|
|
23
23
|
exports.hasNodeModule = hasNodeModule;
|
|
24
24
|
exports.isSvelteProject = isSvelteProject;
|
|
25
25
|
exports.importSvelteCompiler = importSvelteCompiler;
|
|
26
|
+
exports.getProjectParsedCommandLine = getProjectParsedCommandLine;
|
|
26
27
|
const path_1 = require("path");
|
|
27
28
|
function isSvelteFilePath(filePath) {
|
|
28
29
|
return filePath.endsWith('.svelte');
|
|
@@ -222,7 +223,12 @@ function isSvelteProject(project) {
|
|
|
222
223
|
// The solution project is mostly just a container we don't need to patch it
|
|
223
224
|
// and having any files in this project cause TSServer to send config error while it originally won't
|
|
224
225
|
if (project.isSolution?.()) {
|
|
225
|
-
|
|
226
|
+
// In TypeScript before 5.7, the project files were added later than plugin loading
|
|
227
|
+
// so we need to also check if the parsedCommandLine includes any files
|
|
228
|
+
const parsedCommandLine = getProjectParsedCommandLine(project);
|
|
229
|
+
if (parsedCommandLine?.fileNames.length === 0) {
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
226
232
|
}
|
|
227
233
|
const projectDirectory = getProjectDirectory(project);
|
|
228
234
|
if (projectDirectory) {
|
|
@@ -257,4 +263,13 @@ function importSvelteCompiler(fromPath) {
|
|
|
257
263
|
// ignore
|
|
258
264
|
}
|
|
259
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* This call the ConfiguredProject.getParsedCommandLine
|
|
268
|
+
* where it'll try to load the cached version of the parsedCommandLine
|
|
269
|
+
*/
|
|
270
|
+
function getProjectParsedCommandLine(project) {
|
|
271
|
+
const configPath = getConfigPathForProject(project);
|
|
272
|
+
const parsedCommandLine = project.getParsedCommandLine?.(configPath);
|
|
273
|
+
return parsedCommandLine;
|
|
274
|
+
}
|
|
260
275
|
//# sourceMappingURL=utils.js.map
|