@astrojs/ts-plugin 1.6.0 → 1.7.0

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 (2) hide show
  1. package/dist/language.js +10 -5
  2. package/package.json +3 -3
package/dist/language.js CHANGED
@@ -5,20 +5,25 @@ const language_core_1 = require("@volar/language-core");
5
5
  const astro2tsx_js_1 = require("./astro2tsx.js");
6
6
  function getLanguageModule() {
7
7
  return {
8
- createVirtualCode(fileId, languageId, snapshot) {
8
+ getLanguageId(scriptId) {
9
+ if (scriptId.endsWith('.astro')) {
10
+ return 'astro';
11
+ }
12
+ },
13
+ createVirtualCode(scriptId, languageId, snapshot) {
9
14
  if (languageId === 'astro') {
10
- // fileId will never be a uri in ts plugin
11
- const fileName = fileId;
15
+ // scriptId will never be a uri in ts plugin
16
+ const fileName = scriptId;
12
17
  return new AstroVirtualCode(fileName, snapshot);
13
18
  }
14
19
  },
15
- updateVirtualCode(_fileId, astroFile, snapshot) {
20
+ updateVirtualCode(_scriptId, astroFile, snapshot) {
16
21
  astroFile.update(snapshot);
17
22
  return astroFile;
18
23
  },
19
24
  typescript: {
20
25
  extraFileExtensions: [{ extension: 'astro', isMixedContent: true, scriptKind: 7 }],
21
- getScript(astroCode) {
26
+ getServiceScript(astroCode) {
22
27
  for (const code of (0, language_core_1.forEachEmbeddedCode)(astroCode)) {
23
28
  if (code.id === 'tsx') {
24
29
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/ts-plugin",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "A TypeScript Plugin providing Astro intellisense",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",
@@ -22,8 +22,8 @@
22
22
  "author": "withastro",
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
- "@volar/language-core": "~2.1.2",
26
- "@volar/typescript": "~2.1.2",
25
+ "@volar/language-core": "~2.2.1",
26
+ "@volar/typescript": "~2.2.1",
27
27
  "@astrojs/compiler": "^2.7.0",
28
28
  "@jridgewell/sourcemap-codec": "^1.4.15",
29
29
  "semver": "^7.3.8",