@astrojs/ts-plugin
Advanced tools
| import type { VirtualCode } from '@volar/language-core'; | ||
| export declare function astro2tsx(input: string, fileName: string, ts: typeof import('typescript')): { | ||
| export declare function astro2tsx(input: string, fileName: string): { | ||
| virtualFile: VirtualCode<string>; | ||
@@ -4,0 +4,0 @@ diagnostics: import("@astrojs/compiler").DiagnosticMessage[] | { |
@@ -49,6 +49,6 @@ "use strict"; | ||
| } | ||
| function astro2tsx(input, fileName, ts) { | ||
| function astro2tsx(input, fileName) { | ||
| const tsx = safeConvertToTSX(input, { filename: fileName }); | ||
| return { | ||
| virtualFile: getVirtualFileTSX(input, tsx, fileName, ts), | ||
| virtualFile: getVirtualFileTSX(input, tsx, fileName), | ||
| diagnostics: tsx.diagnostics, | ||
@@ -58,3 +58,3 @@ }; | ||
| exports.astro2tsx = astro2tsx; | ||
| function getVirtualFileTSX(input, tsx, fileName, ts) { | ||
| function getVirtualFileTSX(input, tsx, fileName) { | ||
| tsx.code = patchTSX(tsx.code, fileName); | ||
@@ -61,0 +61,0 @@ const v3Mappings = (0, sourcemap_codec_1.decode)(tsx.map.mappings); |
+1
-1
| "use strict"; | ||
| const createLanguageServicePlugin_js_1 = require("@volar/typescript/lib/quickstart/createLanguageServicePlugin.js"); | ||
| const language_js_1 = require("./language.js"); | ||
| module.exports = (0, createLanguageServicePlugin_js_1.createLanguageServicePlugin)((ts) => [(0, language_js_1.getLanguageModule)(ts)]); | ||
| module.exports = (0, createLanguageServicePlugin_js_1.createLanguageServicePlugin)(() => [(0, language_js_1.getLanguageModule)()]); |
| import { type CodeMapping, type LanguagePlugin, type VirtualCode } from '@volar/language-core'; | ||
| import type ts from 'typescript'; | ||
| export declare function getLanguageModule(ts: typeof import('typescript')): LanguagePlugin<AstroVirtualCode>; | ||
| export declare function getLanguageModule(): LanguagePlugin<AstroVirtualCode>; | ||
| export declare class AstroVirtualCode implements VirtualCode { | ||
| fileName: string; | ||
| snapshot: ts.IScriptSnapshot; | ||
| private readonly ts; | ||
| id: string; | ||
@@ -13,5 +12,5 @@ languageId: string; | ||
| codegenStacks: never[]; | ||
| constructor(fileName: string, snapshot: ts.IScriptSnapshot, ts: typeof import('typescript')); | ||
| constructor(fileName: string, snapshot: ts.IScriptSnapshot); | ||
| update(newSnapshot: ts.IScriptSnapshot): void; | ||
| onSnapshotUpdated(): void; | ||
| } |
+6
-6
@@ -6,8 +6,9 @@ "use strict"; | ||
| const astro2tsx_js_1 = require("./astro2tsx.js"); | ||
| function getLanguageModule(ts) { | ||
| function getLanguageModule() { | ||
| return { | ||
| createVirtualCode(fileId, languageId, snapshot) { | ||
| if (languageId === 'astro') { | ||
| const fileName = fileId.includes('://') ? fileId.split('://')[1] : fileId; | ||
| return new AstroVirtualCode(fileName, snapshot, ts); | ||
| // fileId will never be a uri in ts plugin | ||
| const fileName = fileId; | ||
| return new AstroVirtualCode(fileName, snapshot); | ||
| } | ||
@@ -37,6 +38,5 @@ }, | ||
| class AstroVirtualCode { | ||
| constructor(fileName, snapshot, ts) { | ||
| constructor(fileName, snapshot) { | ||
| this.fileName = fileName; | ||
| this.snapshot = snapshot; | ||
| this.ts = ts; | ||
| this.id = 'root'; | ||
@@ -68,3 +68,3 @@ this.languageId = 'astro'; | ||
| this.embeddedCodes = []; | ||
| const tsx = (0, astro2tsx_js_1.astro2tsx)(this.snapshot.getText(0, this.snapshot.getLength()), this.fileName, this.ts); | ||
| const tsx = (0, astro2tsx_js_1.astro2tsx)(this.snapshot.getText(0, this.snapshot.getLength()), this.fileName); | ||
| this.embeddedCodes.push(tsx.virtualFile); | ||
@@ -71,0 +71,0 @@ } |
+3
-3
| { | ||
| "name": "@astrojs/ts-plugin", | ||
| "version": "1.5.1", | ||
| "version": "1.5.2", | ||
| "description": "A TypeScript Plugin providing Astro intellisense", | ||
@@ -25,4 +25,4 @@ "main": "dist/index.js", | ||
| "dependencies": { | ||
| "@volar/language-core": "~2.0.3", | ||
| "@volar/typescript": "~2.0.3", | ||
| "@volar/language-core": "~2.0.4", | ||
| "@volar/typescript": "~2.0.4", | ||
| "@astrojs/compiler": "^2.4.0", | ||
@@ -29,0 +29,0 @@ "@jridgewell/sourcemap-codec": "^1.4.15", |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
13970
-1.2%247
-0.4%Updated
Updated