typescript-svelte-plugin 0.3.16 → 0.3.17
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/language-service/completions.d.ts +4 -2
- package/dist/src/language-service/completions.js +3 -7
- package/dist/src/language-service/index.js +1 -1
- package/dist/src/module-loader.js +1 -1
- package/dist/src/svelte-sys.d.ts +4 -2
- package/dist/src/svelte-sys.js +6 -10
- package/package.json +1 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import ts from 'typescript
|
|
1
|
+
import type ts from 'typescript';
|
|
2
2
|
import { Logger } from '../logger';
|
|
3
|
-
|
|
3
|
+
type _ts = typeof ts;
|
|
4
|
+
export declare function decorateCompletions(ls: ts.LanguageService, ts: _ts, logger: Logger): void;
|
|
5
|
+
export {};
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.decorateCompletions = void 0;
|
|
7
4
|
const path_1 = require("path");
|
|
8
|
-
const tsserverlibrary_1 = __importDefault(require("typescript/lib/tsserverlibrary"));
|
|
9
5
|
const utils_1 = require("../utils");
|
|
10
6
|
const componentPostfix = '__SvelteComponent_';
|
|
11
|
-
function decorateCompletions(ls, logger) {
|
|
7
|
+
function decorateCompletions(ls, ts, logger) {
|
|
12
8
|
const getCompletionsAtPosition = ls.getCompletionsAtPosition;
|
|
13
9
|
ls.getCompletionsAtPosition = (fileName, position, options) => {
|
|
14
10
|
var _a, _b, _c, _d;
|
|
@@ -55,10 +51,10 @@ function decorateCompletions(ls, logger) {
|
|
|
55
51
|
if ((0, path_1.extname)(fileName) === '.js') {
|
|
56
52
|
completions.entries.push({
|
|
57
53
|
// TODO doesn't show up for "export" and "load" only at the bottom for "function"
|
|
58
|
-
kind:
|
|
54
|
+
kind: ts.ScriptElementKind.functionElement,
|
|
59
55
|
name: 'export function load() {}',
|
|
60
56
|
sortText: '-99',
|
|
61
|
-
kindModifiers:
|
|
57
|
+
kindModifiers: ts.ScriptElementKindModifier.exportedModifier,
|
|
62
58
|
insertText: `/** @type {import('./$types').Foo} */\nexport function load() {}`
|
|
63
59
|
});
|
|
64
60
|
}
|
|
@@ -28,7 +28,7 @@ function decorateLanguageServiceInner(ls, snapshotManager, logger, typescript) {
|
|
|
28
28
|
(0, rename_1.decorateRename)(ls, snapshotManager, logger);
|
|
29
29
|
(0, diagnostics_1.decorateDiagnostics)(ls, logger);
|
|
30
30
|
(0, find_references_1.decorateFindReferences)(ls, snapshotManager, logger);
|
|
31
|
-
(0, completions_1.decorateCompletions)(ls, logger);
|
|
31
|
+
(0, completions_1.decorateCompletions)(ls, typescript, logger);
|
|
32
32
|
(0, definition_1.decorateGetDefinition)(ls, snapshotManager, logger);
|
|
33
33
|
(0, implementation_1.decorateGetImplementation)(ls, snapshotManager, logger);
|
|
34
34
|
(0, update_imports_1.decorateUpdateImports)(ls, snapshotManager, logger);
|
|
@@ -58,7 +58,7 @@ class ModuleResolutionCache {
|
|
|
58
58
|
*/
|
|
59
59
|
function patchModuleLoader(logger, snapshotManager, typescript, lsHost, project, configManager) {
|
|
60
60
|
var _a, _b;
|
|
61
|
-
const svelteSys = (0, svelte_sys_1.createSvelteSys)(logger);
|
|
61
|
+
const svelteSys = (0, svelte_sys_1.createSvelteSys)(typescript, logger);
|
|
62
62
|
const moduleCache = new ModuleResolutionCache(project.projectService);
|
|
63
63
|
const origResolveModuleNames = (_a = lsHost.resolveModuleNames) === null || _a === void 0 ? void 0 : _a.bind(lsHost);
|
|
64
64
|
const origResolveModuleNamLiterals = (_b = lsHost.resolveModuleNameLiterals) === null || _b === void 0 ? void 0 : _b.bind(lsHost);
|
package/dist/src/svelte-sys.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import ts from 'typescript';
|
|
1
|
+
import type ts from 'typescript';
|
|
2
2
|
import { Logger } from './logger';
|
|
3
|
+
type _ts = typeof ts;
|
|
3
4
|
/**
|
|
4
5
|
* This should only be accessed by TS svelte module resolution.
|
|
5
6
|
*/
|
|
6
|
-
export declare function createSvelteSys(logger: Logger): ts.System;
|
|
7
|
+
export declare function createSvelteSys(ts: _ts, logger: Logger): ts.System;
|
|
8
|
+
export {};
|
package/dist/src/svelte-sys.js
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.createSvelteSys = void 0;
|
|
7
|
-
const typescript_1 = __importDefault(require("typescript"));
|
|
8
4
|
const utils_1 = require("./utils");
|
|
9
5
|
/**
|
|
10
6
|
* This should only be accessed by TS svelte module resolution.
|
|
11
7
|
*/
|
|
12
|
-
function createSvelteSys(logger) {
|
|
8
|
+
function createSvelteSys(ts, logger) {
|
|
13
9
|
const svelteSys = {
|
|
14
|
-
...
|
|
10
|
+
...ts.sys,
|
|
15
11
|
fileExists(path) {
|
|
16
|
-
return
|
|
12
|
+
return ts.sys.fileExists((0, utils_1.ensureRealSvelteFilePath)(path));
|
|
17
13
|
},
|
|
18
14
|
readDirectory(path, extensions, exclude, include, depth) {
|
|
19
15
|
const extensionsWithSvelte = (extensions !== null && extensions !== void 0 ? extensions : []).concat('.svelte');
|
|
20
|
-
return
|
|
16
|
+
return ts.sys.readDirectory(path, extensionsWithSvelte, exclude, include, depth);
|
|
21
17
|
}
|
|
22
18
|
};
|
|
23
|
-
if (
|
|
24
|
-
const realpath =
|
|
19
|
+
if (ts.sys.realpath) {
|
|
20
|
+
const realpath = ts.sys.realpath;
|
|
25
21
|
svelteSys.realpath = function (path) {
|
|
26
22
|
if ((0, utils_1.isVirtualSvelteFilePath)(path)) {
|
|
27
23
|
return realpath((0, utils_1.toRealSvelteFilePath)(path)) + '.ts';
|