Skip to content

Commit 04a9f0a

Browse files
committed
chore: update alien-signals to 0.2.0
1 parent 9977aea commit 04a9f0a

File tree

6 files changed

+25
-25
lines changed

6 files changed

+25
-25
lines changed

packages/language-core/lib/virtualFile/computedEmbeddedCodes.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { VirtualCode } from '@volar/language-core';
2-
import { Computed, computed } from 'alien-signals';
2+
import { computed, ISignal } from 'alien-signals';
33
import { toString } from 'muggle-string';
44
import type * as ts from 'typescript';
55
import type { Code, Sfc, SfcBlock, VueLanguagePluginReturn } from '../types';
@@ -105,9 +105,9 @@ function computedPluginEmbeddedCodes(
105105
plugin: VueLanguagePluginReturn,
106106
fileName: string,
107107
sfc: Sfc,
108-
nameToBlock: Computed<Record<string, SfcBlock>>
108+
nameToBlock: ISignal<Record<string, SfcBlock>>
109109
) {
110-
const computeds = new Map<string, Computed<{ code: VueEmbeddedCode; snapshot: ts.IScriptSnapshot; }>>();
110+
const computeds = new Map<string, ISignal<{ code: VueEmbeddedCode; snapshot: ts.IScriptSnapshot; }>>();
111111
const getComputedKey = (code: {
112112
id: string;
113113
lang: string;

packages/language-core/lib/virtualFile/computedSfc.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type * as CompilerDOM from '@vue/compiler-dom';
22
import type { SFCBlock, SFCParseResult } from '@vue/compiler-sfc';
3-
import { Computed, computed, Signal, System, Unstable } from 'alien-signals';
3+
import { computed, ISignal, Signal, System, Unstable } from 'alien-signals';
44
import type * as ts from 'typescript';
55
import type { Sfc, SfcBlock, SFCStyleOverride, VueLanguagePluginReturn } from '../types';
66
import { parseCssClassNames } from '../utils/parseCssClassNames';
@@ -11,14 +11,14 @@ export function computedSfc(
1111
plugins: VueLanguagePluginReturn[],
1212
fileName: string,
1313
snapshot: Signal<ts.IScriptSnapshot>,
14-
parsed: Computed<SFCParseResult | undefined>
14+
parsed: ISignal<SFCParseResult | undefined>
1515
): Sfc {
1616

1717
const untrackedSnapshot = () => {
18-
const depth = System.activeSubsDepth;
19-
System.activeSubsDepth = 0;
18+
const prevTrackId = System.activeTrackId = 0;
19+
System.activeTrackId = 0;
2020
const res = snapshot.get();
21-
System.activeSubsDepth = depth;
21+
System.activeTrackId = prevTrackId;
2222
return res;
2323
};
2424
const content = computed(() => {
@@ -180,10 +180,10 @@ export function computedSfc(
180180
const change = untrackedSnapshot().getChangeRange(cache.snapshot);
181181
if (change) {
182182

183-
const depth = System.activeSubsDepth;
184-
System.activeSubsDepth = 0;
183+
const prevTrackId = System.activeTrackId;
184+
System.activeTrackId = 0;
185185
const templateOffset = base.startTagEnd;
186-
System.activeSubsDepth = depth;
186+
System.activeTrackId = prevTrackId;
187187

188188
const newText = untrackedSnapshot().getText(change.span.start, change.span.start + change.newLength);
189189
const newResult = cache.plugin.updateSFCTemplate(cache.result, {
@@ -263,8 +263,8 @@ export function computedSfc(
263263
function computedNullableSfcBlock<T extends SFCBlock, K extends SfcBlock>(
264264
name: string,
265265
defaultLang: string,
266-
block: Computed<T | undefined>,
267-
resolve: (block: Computed<T>, base: SfcBlock) => K
266+
block: ISignal<T | undefined>,
267+
resolve: (block: ISignal<T>, base: SfcBlock) => K
268268
) {
269269
const hasBlock = computed(() => !!block.get());
270270
return computed<K | undefined>(() => {
@@ -279,7 +279,7 @@ export function computedSfc(
279279
function computedSfcBlock<T extends SFCBlock>(
280280
name: string,
281281
defaultLang: string,
282-
block: Computed<T>
282+
block: ISignal<T>
283283
) {
284284
const lang = computed(() => block.get().lang ?? defaultLang);
285285
const attrs = computed(() => block.get().attrs); // TODO: computed it

packages/language-core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"@vue/compiler-dom": "^3.5.2",
1717
"@vue/compiler-vue2": "^2.7.16",
1818
"@vue/shared": "^3.5.2",
19-
"alien-signals": "^0.1.0",
19+
"alien-signals": "^0.2.0",
2020
"minimatch": "^9.0.3",
2121
"muggle-string": "^0.4.1",
2222
"path-browserify": "^1.0.1"

packages/language-service/lib/ideFeatures/nameCasing.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { LanguageServiceContext, ProviderResult, VirtualCode } from '@volar
22
import type { CompilerDOM } from '@vue/language-core';
33
import * as vue from '@vue/language-core';
44
import { hyphenateAttr, hyphenateTag, VueVirtualCode } from '@vue/language-core';
5-
import { Computed, computed } from 'alien-signals';
5+
import { computed, ISignal } from 'alien-signals';
66
import type * as vscode from 'vscode-languageserver-protocol';
77
import type { URI } from 'vscode-uri';
88
import { AttrNameCasing, TagNameCasing } from '../types';
@@ -201,7 +201,7 @@ type Tags = Map<string, {
201201
}>,
202202
}>;
203203

204-
const map = new WeakMap<VirtualCode, Computed<Tags | undefined>>();
204+
const map = new WeakMap<VirtualCode, ISignal<Tags | undefined>>();
205205

206206
function getTemplateTagsAndAttrs(sourceFile: VirtualCode): Tags {
207207

packages/language-service/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"@vue/language-core": "2.1.6",
2424
"@vue/shared": "^3.4.0",
2525
"@vue/typescript-plugin": "2.1.6",
26-
"alien-signals": "^0.1.0",
26+
"alien-signals": "^0.2.0",
2727
"path-browserify": "^1.0.1",
2828
"volar-service-css": "0.0.62",
2929
"volar-service-emmet": "0.0.62",

pnpm-lock.yaml

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)