Skip to content

Commit 03cf10f

Browse files
committed
chore: remove __snapshot
1 parent 7c7f374 commit 03cf10f

File tree

1 file changed

+10
-11
lines changed
  • packages/vue-language-core/src/virtualFile

1 file changed

+10
-11
lines changed

packages/vue-language-core/src/virtualFile/vueFile.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,30 @@ import { computedFiles } from './computedFiles';
66
import { computedMappings } from './computedMappings';
77
import { computedSfc } from './computedSfc';
88
import { computedVueSfc } from './computedVueSfc';
9-
import { Signal, computed, signal } from 'computeds';
9+
import { Signal, signal } from 'computeds';
1010

1111
const jsxReg = /^\.(js|ts)x?$/;
1212

1313
export class VueFile implements VirtualFile {
1414

1515
// sources
1616

17-
__snapshot: Signal<ts.IScriptSnapshot>;
17+
_snapshot: Signal<ts.IScriptSnapshot>;
1818

1919
// computeds
2020

21-
_snapshot = computed(() => this.__snapshot());
22-
vueSfc = computedVueSfc(this.plugins, this.fileName, this._snapshot);
23-
sfc = computedSfc(this.ts, this.plugins, this.fileName, this._snapshot, this.vueSfc);
24-
_mappings = computedMappings(this._snapshot, this.sfc);
25-
_embeddedFiles = computedFiles(this.plugins, this.fileName, this.sfc, this.codegenStack);
21+
getVueSfc = computedVueSfc(this.plugins, this.fileName, () => this._snapshot());
22+
sfc = computedSfc(this.ts, this.plugins, this.fileName, () => this._snapshot(), this.getVueSfc);
23+
getMappings = computedMappings(() => this._snapshot(), this.sfc);
24+
getMmbeddedFiles = computedFiles(this.plugins, this.fileName, this.sfc, this.codegenStack);
2625

2726
// others
2827

2928
capabilities = FileCapabilities.full;
3029
kind = FileKind.TextFile;
3130
codegenStacks: Stack[] = [];
3231
get embeddedFiles() {
33-
return this._embeddedFiles();
32+
return this.getMmbeddedFiles();
3433
}
3534
get mainScriptName() {
3635
let res: string = '';
@@ -45,7 +44,7 @@ export class VueFile implements VirtualFile {
4544
return this._snapshot();
4645
}
4746
get mappings() {
48-
return this._mappings();
47+
return this.getMappings();
4948
}
5049

5150
constructor(
@@ -56,10 +55,10 @@ export class VueFile implements VirtualFile {
5655
public ts: typeof import('typescript/lib/tsserverlibrary'),
5756
public codegenStack: boolean,
5857
) {
59-
this.__snapshot = signal(initSnapshot);
58+
this._snapshot = signal(initSnapshot);
6059
}
6160

6261
update(newSnapshot: ts.IScriptSnapshot) {
63-
this.__snapshot.set(newSnapshot);
62+
this._snapshot.set(newSnapshot);
6463
}
6564
}

0 commit comments

Comments
 (0)