typescript-svelte-plugin
Advanced tools
Comparing version 0.2.3 to 0.2.4
@@ -17,8 +17,8 @@ "use strict"; | ||
patchCompilerOptions(info.project); | ||
module_loader_1.patchModuleLoader(logger, snapshotManager, modules.typescript, info.languageServiceHost, info.project); | ||
return language_service_1.decorateLanguageService(info.languageService, snapshotManager, logger); | ||
(0, module_loader_1.patchModuleLoader)(logger, snapshotManager, modules.typescript, info.languageServiceHost, info.project); | ||
return (0, language_service_1.decorateLanguageService)(info.languageService, snapshotManager, logger); | ||
} | ||
function getExternalFiles(project) { | ||
// Needed so the ambient definitions are known inside the tsx files | ||
const svelteTsPath = path_1.dirname(require.resolve('svelte2tsx')); | ||
const svelteTsPath = (0, path_1.dirname)(require.resolve('svelte2tsx')); | ||
const svelteTsxFiles = [ | ||
@@ -28,3 +28,3 @@ './svelte-shims.d.ts', | ||
'./svelte-native-jsx.d.ts' | ||
].map((f) => modules.typescript.sys.resolvePath(path_1.resolve(svelteTsPath, f))); | ||
].map((f) => modules.typescript.sys.resolvePath((0, path_1.resolve)(svelteTsPath, f))); | ||
return svelteTsxFiles; | ||
@@ -52,3 +52,11 @@ } | ||
!compilerOptions.jsxImportSource; | ||
return isNoJsxProject; | ||
try { | ||
const isSvelteProject = typeof compilerOptions.configFilePath !== 'string' || | ||
require.resolve('svelte', { paths: [compilerOptions.configFilePath] }); | ||
return isNoJsxProject && isSvelteProject; | ||
} | ||
catch (e) { | ||
// If require.resolve fails, we end up here | ||
return false; | ||
} | ||
} | ||
@@ -55,0 +63,0 @@ return { create, getExternalFiles }; |
@@ -16,3 +16,3 @@ "use strict"; | ||
entries: completions.entries.map((entry) => { | ||
if (!utils_1.isSvelteFilePath(entry.source || '') || | ||
if (!(0, utils_1.isSvelteFilePath)(entry.source || '') || | ||
!entry.name.endsWith(componentPostfix)) { | ||
@@ -31,3 +31,3 @@ return entry; | ||
const details = getCompletionEntryDetails(fileName, position, entryName, formatOptions, source, preferences, data); | ||
if (details || !utils_1.isSvelteFilePath(source || '')) { | ||
if (details || !(0, utils_1.isSvelteFilePath)(source || '')) { | ||
return details; | ||
@@ -43,5 +43,5 @@ } | ||
logger.debug('Found Svelte Component import completion details'); | ||
return utils_1.replaceDeep(svelteDetails, componentPostfix, ''); | ||
return (0, utils_1.replaceDeep)(svelteDetails, componentPostfix, ''); | ||
}; | ||
} | ||
exports.decorateCompletions = decorateCompletions; |
@@ -17,3 +17,3 @@ "use strict"; | ||
var _a; | ||
if (!utils_1.isSvelteFilePath(def.fileName)) { | ||
if (!(0, utils_1.isSvelteFilePath)(def.fileName)) { | ||
return def; | ||
@@ -20,0 +20,0 @@ } |
@@ -16,3 +16,3 @@ "use strict"; | ||
// by the svelte-language-server / Svelte for VS Code extension | ||
if (utils_1.isSvelteFilePath(fileName)) { | ||
if ((0, utils_1.isSvelteFilePath)(fileName)) { | ||
return []; | ||
@@ -28,3 +28,3 @@ } | ||
// by the svelte-language-server / Svelte for VS Code extension | ||
if (utils_1.isSvelteFilePath(fileName)) { | ||
if ((0, utils_1.isSvelteFilePath)(fileName)) { | ||
return []; | ||
@@ -40,3 +40,3 @@ } | ||
// by the svelte-language-server / Svelte for VS Code extension | ||
if (utils_1.isSvelteFilePath(fileName)) { | ||
if ((0, utils_1.isSvelteFilePath)(fileName)) { | ||
return []; | ||
@@ -43,0 +43,0 @@ } |
@@ -16,3 +16,3 @@ "use strict"; | ||
const snapshot = snapshotManager.get(reference.definition.fileName); | ||
if (!utils_1.isSvelteFilePath(reference.definition.fileName) || !snapshot) { | ||
if (!(0, utils_1.isSvelteFilePath)(reference.definition.fileName) || !snapshot) { | ||
return reference; | ||
@@ -47,3 +47,3 @@ } | ||
const snapshot = snapshotManager.get(reference.fileName); | ||
if (!utils_1.isSvelteFilePath(reference.fileName) || !snapshot) { | ||
if (!(0, utils_1.isSvelteFilePath)(reference.fileName) || !snapshot) { | ||
return reference; | ||
@@ -50,0 +50,0 @@ } |
@@ -11,3 +11,3 @@ "use strict"; | ||
var _a; | ||
if (!utils_1.isSvelteFilePath(impl.fileName)) { | ||
if (!(0, utils_1.isSvelteFilePath)(impl.fileName)) { | ||
return impl; | ||
@@ -14,0 +14,0 @@ } |
@@ -13,8 +13,8 @@ "use strict"; | ||
patchLineColumnOffset(ls, snapshotManager); | ||
rename_1.decorateRename(ls, snapshotManager, logger); | ||
diagnostics_1.decorateDiagnostics(ls, logger); | ||
find_references_1.decorateFindReferences(ls, snapshotManager, logger); | ||
completions_1.decorateCompletions(ls, logger); | ||
definition_1.decorateGetDefinition(ls, snapshotManager, logger); | ||
implementation_1.decorateGetImplementation(ls, snapshotManager, logger); | ||
(0, rename_1.decorateRename)(ls, snapshotManager, logger); | ||
(0, diagnostics_1.decorateDiagnostics)(ls, logger); | ||
(0, find_references_1.decorateFindReferences)(ls, snapshotManager, logger); | ||
(0, completions_1.decorateCompletions)(ls, logger); | ||
(0, definition_1.decorateGetDefinition)(ls, snapshotManager, logger); | ||
(0, implementation_1.decorateGetImplementation)(ls, snapshotManager, logger); | ||
return ls; | ||
@@ -30,3 +30,3 @@ } | ||
ls.toLineColumnOffset = (fileName, position) => { | ||
if (utils_1.isSvelteFilePath(fileName)) { | ||
if ((0, utils_1.isSvelteFilePath)(fileName)) { | ||
const snapshot = snapshotManager.get(fileName); | ||
@@ -33,0 +33,0 @@ if (snapshot) { |
@@ -11,3 +11,3 @@ "use strict"; | ||
const snapshot = snapshotManager.get(renameLocation.fileName); | ||
if (!utils_1.isSvelteFilePath(renameLocation.fileName) || !snapshot) { | ||
if (!(0, utils_1.isSvelteFilePath)(renameLocation.fileName) || !snapshot) { | ||
return renameLocation; | ||
@@ -14,0 +14,0 @@ } |
@@ -40,3 +40,3 @@ "use strict"; | ||
getKey(moduleName, containingFile) { | ||
return containingFile + ':::' + utils_1.ensureRealSvelteFilePath(moduleName); | ||
return containingFile + ':::' + (0, utils_1.ensureRealSvelteFilePath)(moduleName); | ||
} | ||
@@ -55,3 +55,3 @@ } | ||
var _a; | ||
const svelteSys = svelte_sys_1.createSvelteSys(logger); | ||
const svelteSys = (0, svelte_sys_1.createSvelteSys)(logger); | ||
const moduleCache = new ModuleResolutionCache(); | ||
@@ -75,3 +75,3 @@ const origResolveModuleNames = (_a = lsHost.resolveModuleNames) === null || _a === void 0 ? void 0 : _a.bind(lsHost); | ||
const fileName = moduleNames[idx]; | ||
if (moduleName || !utils_1.ensureRealSvelteFilePath(fileName).endsWith('.svelte')) { | ||
if (moduleName || !(0, utils_1.ensureRealSvelteFilePath)(fileName).endsWith('.svelte')) { | ||
return moduleName; | ||
@@ -91,6 +91,6 @@ } | ||
if (!svelteResolvedModule || | ||
!utils_1.isVirtualSvelteFilePath(svelteResolvedModule.resolvedFileName)) { | ||
!(0, utils_1.isVirtualSvelteFilePath)(svelteResolvedModule.resolvedFileName)) { | ||
return svelteResolvedModule; | ||
} | ||
const resolvedFileName = utils_1.ensureRealSvelteFilePath(svelteResolvedModule.resolvedFileName); | ||
const resolvedFileName = (0, utils_1.ensureRealSvelteFilePath)(svelteResolvedModule.resolvedFileName); | ||
logger.log('Resolved', name, 'to Svelte file', resolvedFileName); | ||
@@ -97,0 +97,0 @@ const snapshot = snapshotManager.create(resolvedFileName); |
@@ -38,3 +38,3 @@ "use strict"; | ||
if (typeof mappings === 'string') | ||
this.mappings = sourcemap_codec_1.decode(mappings); | ||
this.mappings = (0, sourcemap_codec_1.decode)(mappings); | ||
else | ||
@@ -41,0 +41,0 @@ this.mappings = mappings; |
@@ -24,3 +24,3 @@ "use strict"; | ||
getOriginalTextSpan(textSpan) { | ||
if (!utils_1.isNoTextSpanInGeneratedCode(this.getText(), textSpan)) { | ||
if (!(0, utils_1.isNoTextSpanInGeneratedCode)(this.getText(), textSpan)) { | ||
return null; | ||
@@ -231,3 +231,3 @@ } | ||
this.projectService.host.readFile = (path) => { | ||
if (utils_1.isSvelteFilePath(path)) { | ||
if ((0, utils_1.isSvelteFilePath)(path)) { | ||
this.logger.debug('Read Svelte file:', path); | ||
@@ -237,3 +237,3 @@ const svelteCode = readFile(path) || ''; | ||
const isTsFile = true; // TODO check file contents? TS might be okay with importing ts into js. | ||
const result = svelte2tsx_1.svelte2tsx(svelteCode, { | ||
const result = (0, svelte2tsx_1.svelte2tsx)(svelteCode, { | ||
filename: path.split('/').pop(), | ||
@@ -240,0 +240,0 @@ isTsFile |
@@ -16,3 +16,3 @@ "use strict"; | ||
fileExists(path) { | ||
return typescript_1.default.sys.fileExists(utils_1.ensureRealSvelteFilePath(path)); | ||
return typescript_1.default.sys.fileExists((0, utils_1.ensureRealSvelteFilePath)(path)); | ||
}, | ||
@@ -27,4 +27,4 @@ readDirectory(path, extensions, exclude, include, depth) { | ||
svelteSys.realpath = function (path) { | ||
if (utils_1.isVirtualSvelteFilePath(path)) { | ||
return realpath(utils_1.toRealSvelteFilePath(path)) + '.ts'; | ||
if ((0, utils_1.isVirtualSvelteFilePath)(path)) { | ||
return realpath((0, utils_1.toRealSvelteFilePath)(path)) + '.ts'; | ||
} | ||
@@ -31,0 +31,0 @@ return realpath(path); |
{ | ||
"name": "typescript-svelte-plugin", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "A TypeScript Plugin providing Svelte intellisense", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48119
1087