@astrojs/ts-plugin 1.0.10 → 1.1.1

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 (38) hide show
  1. package/README.md +25 -1
  2. package/dist/astro2tsx.d.ts +15 -2
  3. package/dist/astro2tsx.js +121 -5
  4. package/dist/index.d.ts +1 -6
  5. package/dist/index.js +21 -47
  6. package/dist/language.d.ts +17 -0
  7. package/dist/language.js +47 -0
  8. package/package.json +6 -3
  9. package/dist/astro-snapshots.d.ts +0 -44
  10. package/dist/astro-snapshots.js +0 -234
  11. package/dist/astro-sys.d.ts +0 -6
  12. package/dist/astro-sys.js +0 -30
  13. package/dist/language-service/completions.d.ts +0 -3
  14. package/dist/language-service/completions.js +0 -45
  15. package/dist/language-service/definition.d.ts +0 -3
  16. package/dist/language-service/definition.js +0 -38
  17. package/dist/language-service/diagnostics.d.ts +0 -7
  18. package/dist/language-service/diagnostics.js +0 -62
  19. package/dist/language-service/file-references.d.ts +0 -3
  20. package/dist/language-service/file-references.js +0 -30
  21. package/dist/language-service/find-references.d.ts +0 -4
  22. package/dist/language-service/find-references.js +0 -66
  23. package/dist/language-service/implementation.d.ts +0 -3
  24. package/dist/language-service/implementation.js +0 -30
  25. package/dist/language-service/index.d.ts +0 -5
  26. package/dist/language-service/index.js +0 -44
  27. package/dist/language-service/line-column-offset.d.ts +0 -3
  28. package/dist/language-service/line-column-offset.js +0 -21
  29. package/dist/language-service/rename.d.ts +0 -4
  30. package/dist/language-service/rename.js +0 -34
  31. package/dist/logger.d.ts +0 -8
  32. package/dist/logger.js +0 -40
  33. package/dist/module-loader.d.ts +0 -13
  34. package/dist/module-loader.js +0 -146
  35. package/dist/project-astro-files.d.ts +0 -28
  36. package/dist/project-astro-files.js +0 -102
  37. package/dist/utils.d.ts +0 -16
  38. package/dist/utils.js +0 -61
package/dist/astro-sys.js DELETED
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createAstroSys = void 0;
4
- const utils_js_1 = require("./utils.js");
5
- /**
6
- * This should only be accessed by TS astro module resolution.
7
- */
8
- function createAstroSys(logger, typescript) {
9
- const astroSys = {
10
- ...typescript.sys,
11
- fileExists(path) {
12
- return typescript.sys.fileExists((0, utils_js_1.ensureRealAstroFilePath)(path));
13
- },
14
- readDirectory(path, extensions, exclude, include, depth) {
15
- const extensionsWithAstro = (extensions ?? []).concat('.astro');
16
- return typescript.sys.readDirectory(path, extensionsWithAstro, exclude, include, depth);
17
- },
18
- };
19
- if (typescript.sys.realpath) {
20
- const realpath = typescript.sys.realpath;
21
- astroSys.realpath = function (path) {
22
- if ((0, utils_js_1.isVirtualAstroFilePath)(path)) {
23
- return realpath((0, utils_js_1.toRealAstroFilePath)(path)) + '.ts';
24
- }
25
- return realpath(path);
26
- };
27
- }
28
- return astroSys;
29
- }
30
- exports.createAstroSys = createAstroSys;
@@ -1,3 +0,0 @@
1
- import type ts from 'typescript/lib/tsserverlibrary';
2
- import type { Logger } from '../logger.js';
3
- export declare function decorateCompletions(ls: ts.LanguageService, logger: Logger): void;
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decorateCompletions = void 0;
4
- const utils_js_1 = require("../utils.js");
5
- const componentPostfix = '__AstroComponent_';
6
- function decorateCompletions(ls, logger) {
7
- const getCompletionsAtPosition = ls.getCompletionsAtPosition;
8
- ls.getCompletionsAtPosition = (fileName, position, options) => {
9
- const completions = getCompletionsAtPosition(fileName, position, options);
10
- if (!completions) {
11
- return completions;
12
- }
13
- return {
14
- ...completions,
15
- entries: completions.entries.map((entry) => {
16
- if (!(0, utils_js_1.isAstroFilePath)(entry.source || '') || !entry.name.endsWith(componentPostfix)) {
17
- return entry;
18
- }
19
- return {
20
- ...entry,
21
- name: entry.name.slice(0, -componentPostfix.length),
22
- };
23
- }),
24
- };
25
- };
26
- const getCompletionEntryDetails = ls.getCompletionEntryDetails;
27
- ls.getCompletionEntryDetails = (fileName, position, entryName, formatOptions, source, preferences, data) => {
28
- if (!(0, utils_js_1.isAstroFilePath)(source || '')) {
29
- const details = getCompletionEntryDetails(fileName, position, entryName, formatOptions, source, preferences, data);
30
- if (details) {
31
- return details;
32
- }
33
- }
34
- // In the completion list we removed the component postfix. Internally,
35
- // the language service saved the list with the postfix, so details
36
- // won't match anything. Therefore add it back and remove it afterwards again.
37
- const astroDetails = getCompletionEntryDetails(fileName, position, entryName + componentPostfix, formatOptions, source, preferences, data);
38
- if (!astroDetails) {
39
- return undefined;
40
- }
41
- logger.debug('Found Astro Component import completion details');
42
- return (0, utils_js_1.replaceDeep)(astroDetails, componentPostfix, '');
43
- };
44
- }
45
- exports.decorateCompletions = decorateCompletions;
@@ -1,3 +0,0 @@
1
- import type ts from 'typescript/lib/tsserverlibrary';
2
- import type { AstroSnapshotManager } from '../astro-snapshots';
3
- export declare function decorateGetDefinition(ls: ts.LanguageService, snapshotManager: AstroSnapshotManager): void;
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decorateGetDefinition = void 0;
4
- const utils_1 = require("../utils");
5
- function decorateGetDefinition(ls, snapshotManager) {
6
- const getDefinitionAndBoundSpan = ls.getDefinitionAndBoundSpan;
7
- ls.getDefinitionAndBoundSpan = (fileName, position) => {
8
- const definition = getDefinitionAndBoundSpan(fileName, position);
9
- if (!definition?.definitions) {
10
- return definition;
11
- }
12
- return {
13
- ...definition,
14
- definitions: definition.definitions
15
- .map((def) => {
16
- if (!(0, utils_1.isAstroFilePath)(def.fileName)) {
17
- return def;
18
- }
19
- let textSpan = snapshotManager.get(def.fileName)?.getOriginalTextSpan(def.textSpan);
20
- if (!textSpan) {
21
- // Unmapped positions are for example the default export.
22
- // Fall back to the start of the file to at least go to the correct file.
23
- textSpan = { start: 0, length: 1 };
24
- }
25
- return {
26
- ...def,
27
- textSpan,
28
- // Spare the work for now
29
- originalTextSpan: undefined,
30
- contextSpan: undefined,
31
- originalContextSpan: undefined,
32
- };
33
- })
34
- .filter(utils_1.isNotNullOrUndefined),
35
- };
36
- };
37
- }
38
- exports.decorateGetDefinition = decorateGetDefinition;
@@ -1,7 +0,0 @@
1
- import type ts from 'typescript/lib/tsserverlibrary';
2
- type _ts = typeof ts;
3
- export declare enum DiagnosticCodes {
4
- CANNOT_FIND_MODULE = 2307
5
- }
6
- export declare function decorateDiagnostics(ls: ts.LanguageService, typescript: _ts): void;
7
- export {};
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decorateDiagnostics = exports.DiagnosticCodes = void 0;
4
- const utils_js_1 = require("../utils.js");
5
- var DiagnosticCodes;
6
- (function (DiagnosticCodes) {
7
- DiagnosticCodes[DiagnosticCodes["CANNOT_FIND_MODULE"] = 2307] = "CANNOT_FIND_MODULE";
8
- })(DiagnosticCodes || (exports.DiagnosticCodes = DiagnosticCodes = {}));
9
- function decorateDiagnostics(ls, typescript) {
10
- decorateSyntacticDiagnostics(ls);
11
- decorateSemanticDiagnostics(ls, typescript);
12
- decorateSuggestionDiagnostics(ls);
13
- }
14
- exports.decorateDiagnostics = decorateDiagnostics;
15
- function decorateSyntacticDiagnostics(ls) {
16
- const getSyntacticDiagnostics = ls.getSyntacticDiagnostics;
17
- ls.getSyntacticDiagnostics = (fileName) => {
18
- // Diagnostics inside Astro files are done
19
- // by the @astrojs/language-server / Astro for VS Code extension
20
- if ((0, utils_js_1.isAstroFilePath)(fileName)) {
21
- return [];
22
- }
23
- return getSyntacticDiagnostics(fileName);
24
- };
25
- }
26
- function decorateSemanticDiagnostics(ls, typescript) {
27
- const getSemanticDiagnostics = ls.getSemanticDiagnostics;
28
- ls.getSemanticDiagnostics = (fileName) => {
29
- // Diagnostics inside Astro files are done
30
- // by the @astrojs/language-server / Astro for VS Code extension
31
- if ((0, utils_js_1.isAstroFilePath)(fileName)) {
32
- return [];
33
- }
34
- let diagnostics = getSemanticDiagnostics(fileName);
35
- diagnostics = diagnostics.map((diag) => {
36
- const message = typescript.flattenDiagnosticMessageText(diag.messageText, typescript.sys.newLine);
37
- if (diag.code === DiagnosticCodes.CANNOT_FIND_MODULE &&
38
- message.includes('astro:content') &&
39
- // TypeScript will keep the diagnostics here in cache, so if we just blindly always add to it, our added message will be there twice
40
- // Not sure if there's a generic way to ensure that we only add it once, so for now we'll just check for the message we want to add
41
- !message.includes('content collections')) {
42
- diag.messageText =
43
- message +
44
- `${typescript.sys.newLine}${typescript.sys.newLine}` +
45
- "If you're using content collections, make sure to run `astro dev`, `astro build` or `astro sync` to first generate the types so you can import from them. If you already ran one of those commands, restarting the TS Server might be necessary in order for the change to take effect.";
46
- }
47
- return diag;
48
- });
49
- return diagnostics;
50
- };
51
- }
52
- function decorateSuggestionDiagnostics(ls) {
53
- const getSuggestionDiagnostics = ls.getSuggestionDiagnostics;
54
- ls.getSuggestionDiagnostics = (fileName) => {
55
- // Diagnostics inside Astro files are done
56
- // by the @astrojs/language-server / Astro for VS Code extension
57
- if ((0, utils_js_1.isAstroFilePath)(fileName)) {
58
- return [];
59
- }
60
- return getSuggestionDiagnostics(fileName);
61
- };
62
- }
@@ -1,3 +0,0 @@
1
- import type ts from 'typescript/lib/tsserverlibrary';
2
- import type { AstroSnapshotManager } from '../astro-snapshots.js';
3
- export declare function decorateGetFileReferences(ls: ts.LanguageService, snapshotManager: AstroSnapshotManager): void;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decorateGetFileReferences = void 0;
4
- const utils_js_1 = require("../utils.js");
5
- function decorateGetFileReferences(ls, snapshotManager) {
6
- const getFileReferences = ls.getFileReferences;
7
- ls.getFileReferences = (fileName) => {
8
- const references = getFileReferences(fileName);
9
- return references
10
- ?.map((ref) => {
11
- if (!(0, utils_js_1.isAstroFilePath)(ref.fileName)) {
12
- return ref;
13
- }
14
- const textSpan = snapshotManager.get(ref.fileName)?.getOriginalTextSpan(ref.textSpan);
15
- if (!textSpan) {
16
- return undefined;
17
- }
18
- return {
19
- ...ref,
20
- textSpan,
21
- // Spare the work for now
22
- contextSpan: undefined,
23
- originalTextSpan: undefined,
24
- originalContextSpan: undefined,
25
- };
26
- })
27
- .filter(utils_js_1.isNotNullOrUndefined);
28
- };
29
- }
30
- exports.decorateGetFileReferences = decorateGetFileReferences;
@@ -1,4 +0,0 @@
1
- import type ts from 'typescript/lib/tsserverlibrary';
2
- import type { AstroSnapshotManager } from '../astro-snapshots.js';
3
- import type { Logger } from '../logger';
4
- export declare function decorateFindReferences(ls: ts.LanguageService, snapshotManager: AstroSnapshotManager, logger: Logger): void;
@@ -1,66 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decorateFindReferences = void 0;
4
- const utils_js_1 = require("../utils.js");
5
- function decorateFindReferences(ls, snapshotManager, logger) {
6
- decorateGetReferencesAtPosition(ls, snapshotManager, logger);
7
- _decorateFindReferences(ls, snapshotManager, logger);
8
- }
9
- exports.decorateFindReferences = decorateFindReferences;
10
- function _decorateFindReferences(ls, snapshotManager, logger) {
11
- const findReferences = ls.findReferences;
12
- ls.findReferences = (fileName, position) => {
13
- const references = findReferences(fileName, position);
14
- return references
15
- ?.map((reference) => {
16
- const snapshot = snapshotManager.get(reference.definition.fileName);
17
- if (!(0, utils_js_1.isAstroFilePath)(reference.definition.fileName) || !snapshot) {
18
- return reference;
19
- }
20
- const textSpan = snapshot.getOriginalTextSpan(reference.definition.textSpan);
21
- if (!textSpan) {
22
- return null;
23
- }
24
- return {
25
- definition: {
26
- ...reference.definition,
27
- textSpan,
28
- // Spare the work for now
29
- originalTextSpan: undefined,
30
- },
31
- references: mapReferences(reference.references, snapshotManager, logger),
32
- };
33
- })
34
- .filter(utils_js_1.isNotNullOrUndefined);
35
- };
36
- }
37
- function decorateGetReferencesAtPosition(ls, snapshotManager, logger) {
38
- const getReferencesAtPosition = ls.getReferencesAtPosition;
39
- ls.getReferencesAtPosition = (fileName, position) => {
40
- const references = getReferencesAtPosition(fileName, position);
41
- return references && mapReferences(references, snapshotManager, logger);
42
- };
43
- }
44
- function mapReferences(references, snapshotManager, logger) {
45
- return references
46
- .map((reference) => {
47
- const snapshot = snapshotManager.get(reference.fileName);
48
- if (!(0, utils_js_1.isAstroFilePath)(reference.fileName) || !snapshot) {
49
- return reference;
50
- }
51
- const textSpan = snapshot.getOriginalTextSpan(reference.textSpan);
52
- if (!textSpan) {
53
- return null;
54
- }
55
- logger.debug('Find references; map textSpan: changed', reference.textSpan, 'to', textSpan);
56
- return {
57
- ...reference,
58
- textSpan,
59
- // Spare the work for now
60
- contextSpan: undefined,
61
- originalTextSpan: undefined,
62
- originalContextSpan: undefined,
63
- };
64
- })
65
- .filter(utils_js_1.isNotNullOrUndefined);
66
- }
@@ -1,3 +0,0 @@
1
- import type ts from 'typescript/lib/tsserverlibrary';
2
- import type { AstroSnapshotManager } from '../astro-snapshots.js';
3
- export declare function decorateGetImplementation(ls: ts.LanguageService, snapshotManager: AstroSnapshotManager): void;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decorateGetImplementation = void 0;
4
- const utils_js_1 = require("../utils.js");
5
- function decorateGetImplementation(ls, snapshotManager) {
6
- const getImplementationAtPosition = ls.getImplementationAtPosition;
7
- ls.getImplementationAtPosition = (fileName, position) => {
8
- const implementation = getImplementationAtPosition(fileName, position);
9
- return implementation
10
- ?.map((impl) => {
11
- if (!(0, utils_js_1.isAstroFilePath)(impl.fileName)) {
12
- return impl;
13
- }
14
- const textSpan = snapshotManager.get(impl.fileName)?.getOriginalTextSpan(impl.textSpan);
15
- if (!textSpan) {
16
- return undefined;
17
- }
18
- return {
19
- ...impl,
20
- textSpan,
21
- // Spare the work for now
22
- contextSpan: undefined,
23
- originalTextSpan: undefined,
24
- originalContextSpan: undefined,
25
- };
26
- })
27
- .filter(utils_js_1.isNotNullOrUndefined);
28
- };
29
- }
30
- exports.decorateGetImplementation = decorateGetImplementation;
@@ -1,5 +0,0 @@
1
- import type ts from 'typescript/lib/tsserverlibrary';
2
- import type { AstroSnapshotManager } from '../astro-snapshots.js';
3
- import type { Logger } from '../logger';
4
- export declare function isPatched(ls: ts.LanguageService): boolean;
5
- export declare function decorateLanguageService(ls: ts.LanguageService, snapshotManager: AstroSnapshotManager, ts: typeof import('typescript/lib/tsserverlibrary'), logger: Logger): ts.LanguageService;
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decorateLanguageService = exports.isPatched = void 0;
4
- const completions_js_1 = require("./completions.js");
5
- const definition_js_1 = require("./definition.js");
6
- const diagnostics_js_1 = require("./diagnostics.js");
7
- const file_references_js_1 = require("./file-references.js");
8
- const find_references_js_1 = require("./find-references.js");
9
- const implementation_js_1 = require("./implementation.js");
10
- const line_column_offset_js_1 = require("./line-column-offset.js");
11
- const rename_js_1 = require("./rename.js");
12
- const astroPluginPatchSymbol = Symbol('astroPluginPatchSymbol');
13
- function isPatched(ls) {
14
- return ls[astroPluginPatchSymbol] === true;
15
- }
16
- exports.isPatched = isPatched;
17
- function decorateLanguageService(ls, snapshotManager, ts, logger) {
18
- const proxy = new Proxy(ls, createProxyHandler());
19
- (0, line_column_offset_js_1.decorateLineColumnOffset)(proxy, snapshotManager);
20
- (0, rename_js_1.decorateRename)(proxy, snapshotManager, logger);
21
- (0, diagnostics_js_1.decorateDiagnostics)(proxy, ts);
22
- (0, find_references_js_1.decorateFindReferences)(proxy, snapshotManager, logger);
23
- (0, completions_js_1.decorateCompletions)(proxy, logger);
24
- (0, definition_js_1.decorateGetDefinition)(proxy, snapshotManager);
25
- (0, implementation_js_1.decorateGetImplementation)(proxy, snapshotManager);
26
- (0, file_references_js_1.decorateGetFileReferences)(proxy, snapshotManager);
27
- return proxy;
28
- }
29
- exports.decorateLanguageService = decorateLanguageService;
30
- function createProxyHandler() {
31
- const decorated = {};
32
- return {
33
- get(target, p) {
34
- if (p === astroPluginPatchSymbol) {
35
- return true;
36
- }
37
- return decorated[p] ?? target[p];
38
- },
39
- set(_, p, value) {
40
- decorated[p] = value;
41
- return true;
42
- },
43
- };
44
- }
@@ -1,3 +0,0 @@
1
- import type ts from 'typescript/lib/tsserverlibrary';
2
- import type { AstroSnapshotManager } from '../astro-snapshots';
3
- export declare function decorateLineColumnOffset(ls: ts.LanguageService, snapshotManager: AstroSnapshotManager): void;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decorateLineColumnOffset = void 0;
4
- const utils_1 = require("../utils");
5
- function decorateLineColumnOffset(ls, snapshotManager) {
6
- if (!ls.toLineColumnOffset) {
7
- return;
8
- }
9
- // We need to patch this because (according to source, only) getDefinition uses this
10
- const toLineColumnOffset = ls.toLineColumnOffset;
11
- ls.toLineColumnOffset = (fileName, position) => {
12
- if ((0, utils_1.isAstroFilePath)(fileName)) {
13
- const snapshot = snapshotManager.get(fileName);
14
- if (snapshot) {
15
- return snapshot.positionAt(position);
16
- }
17
- }
18
- return toLineColumnOffset(fileName, position);
19
- };
20
- }
21
- exports.decorateLineColumnOffset = decorateLineColumnOffset;
@@ -1,4 +0,0 @@
1
- import type ts from 'typescript/lib/tsserverlibrary';
2
- import type { AstroSnapshotManager } from '../astro-snapshots.js';
3
- import type { Logger } from '../logger.js';
4
- export declare function decorateRename(ls: ts.LanguageService, snapshotManager: AstroSnapshotManager, logger: Logger): void;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decorateRename = void 0;
4
- const utils_js_1 = require("../utils.js");
5
- function decorateRename(ls, snapshotManager, logger) {
6
- const findRenameLocations = ls.findRenameLocations;
7
- ls.findRenameLocations = (fileName, position, findInStrings, findInComments, preferences) => {
8
- const renameLocations = findRenameLocations(fileName, position, findInStrings, findInComments, preferences);
9
- return renameLocations
10
- ?.map((renameLocation) => {
11
- const snapshot = snapshotManager.get(renameLocation.fileName);
12
- if (!(0, utils_js_1.isAstroFilePath)(renameLocation.fileName) || !snapshot) {
13
- return renameLocation;
14
- }
15
- // TODO more needed to filter invalid locations, see RenameProvider
16
- const textSpan = snapshot.getOriginalTextSpan(renameLocation.textSpan);
17
- if (!textSpan) {
18
- return null;
19
- }
20
- const converted = {
21
- ...renameLocation,
22
- textSpan,
23
- };
24
- if (converted.contextSpan) {
25
- // Not important, spare the work
26
- converted.contextSpan = undefined;
27
- }
28
- logger.debug('Converted rename location ', converted);
29
- return converted;
30
- })
31
- .filter(utils_js_1.isNotNullOrUndefined);
32
- };
33
- }
34
- exports.decorateRename = decorateRename;
package/dist/logger.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import type ts from 'typescript/lib/tsserverlibrary';
2
- export declare class Logger {
3
- private tsLogService;
4
- private logDebug;
5
- constructor(tsLogService: ts.server.Logger, suppressNonAstroLogs?: boolean, logDebug?: boolean);
6
- log(...args: any[]): void;
7
- debug(...args: any[]): void;
8
- }
package/dist/logger.js DELETED
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Logger = void 0;
4
- class Logger {
5
- constructor(tsLogService, suppressNonAstroLogs = false, logDebug = false) {
6
- this.tsLogService = tsLogService;
7
- this.logDebug = logDebug;
8
- if (suppressNonAstroLogs) {
9
- const log = this.tsLogService.info.bind(this.tsLogService);
10
- this.tsLogService.info = (s) => {
11
- if (s.startsWith('-Astro Plugin-')) {
12
- log(s);
13
- }
14
- };
15
- }
16
- }
17
- log(...args) {
18
- const str = args
19
- .map((arg) => {
20
- if (typeof arg === 'object') {
21
- try {
22
- return JSON.stringify(arg);
23
- }
24
- catch (e) {
25
- return '[object that cannot by stringified]';
26
- }
27
- }
28
- return arg;
29
- })
30
- .join(' ');
31
- this.tsLogService.info('-Astro Plugin- ' + str);
32
- }
33
- debug(...args) {
34
- if (!this.logDebug) {
35
- return;
36
- }
37
- this.log(...args);
38
- }
39
- }
40
- exports.Logger = Logger;
@@ -1,13 +0,0 @@
1
- import type ts from 'typescript/lib/tsserverlibrary';
2
- import type { AstroSnapshotManager } from './astro-snapshots.js';
3
- import type { Logger } from './logger.js';
4
- /**
5
- * Creates a module loader than can also resolve `.astro` files.
6
- *
7
- * The typescript language service tries to look up other files that are referenced in the currently open astro file.
8
- * For `.ts`/`.js` files this works, for `.astro` files it does not by default.
9
- * Reason: The typescript language service does not know about the `.astro` file ending,
10
- * so it assumes it's a normal typescript file and searches for files like `../Component.astro.ts`, which is wrong.
11
- * In order to fix this, we need to wrap typescript's module resolution and reroute all `.astro.ts` file lookups to .astro.
12
- */
13
- export declare function patchModuleLoader(logger: Logger, snapshotManager: AstroSnapshotManager, typescript: typeof ts, lsHost: ts.LanguageServiceHost, project: ts.server.Project): void;